]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/opencrypto/xform_auth.h
MFV: file 5.45.
[FreeBSD/FreeBSD.git] / sys / opencrypto / xform_auth.h
1 /*      $OpenBSD: xform.h,v 1.8 2001/08/28 12:20:43 ben Exp $   */
2
3 /*-
4  * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
5  *
6  * This code was written by Angelos D. Keromytis in Athens, Greece, in
7  * February 2000. Network Security Technologies Inc. (NSTI) kindly
8  * supported the development of this code.
9  *
10  * Copyright (c) 2000 Angelos D. Keromytis
11  * Copyright (c) 2014 The FreeBSD Foundation
12  * All rights reserved.
13  *
14  * Portions of this software were developed by John-Mark Gurney
15  * under sponsorship of the FreeBSD Foundation and
16  * Rubicon Communications, LLC (Netgate).
17  *
18  * Permission to use, copy, and modify this software without fee
19  * is hereby granted, provided that this entire notice is included in
20  * all source code copies of any software which is or includes a copy or
21  * modification of this software. 
22  *
23  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
24  * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
25  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
26  * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
27  * PURPOSE.
28  */
29
30 #ifndef _CRYPTO_XFORM_AUTH_H_
31 #define _CRYPTO_XFORM_AUTH_H_
32
33 #include <sys/types.h>
34
35 #include <crypto/sha1.h>
36 #include <crypto/sha2/sha224.h>
37 #include <crypto/sha2/sha256.h>
38 #include <crypto/sha2/sha384.h>
39 #include <crypto/sha2/sha512.h>
40 #include <opencrypto/rmd160.h>
41 #include <opencrypto/gmac.h>
42 #include <opencrypto/cbc_mac.h>
43
44 #include <opencrypto/cryptodev.h>
45
46 /* XXX use a define common with other hash stuff ! */
47 #define AH_ALEN_MAX     64      /* max authenticator hash length */
48
49 /* Declarations */
50 struct auth_hash {
51         int type;
52         const char *name;
53         uint16_t keysize;
54         uint16_t hashsize; 
55         uint16_t ctxsize;
56         uint16_t blocksize;
57         void (*Init) (void *);
58         void (*Setkey) (void *, const uint8_t *, u_int);
59         void (*Reinit) (void *, const uint8_t *, u_int);
60         int  (*Update) (void *, const void *, u_int);
61         void (*Final) (uint8_t *, void *);
62 };
63
64 extern const struct auth_hash auth_hash_null;
65 extern const struct auth_hash auth_hash_hmac_sha1;
66 extern const struct auth_hash auth_hash_hmac_ripemd_160;
67 extern const struct auth_hash auth_hash_hmac_sha2_224;
68 extern const struct auth_hash auth_hash_hmac_sha2_256;
69 extern const struct auth_hash auth_hash_hmac_sha2_384;
70 extern const struct auth_hash auth_hash_hmac_sha2_512;
71 extern const struct auth_hash auth_hash_ripemd_160;
72 extern const struct auth_hash auth_hash_sha1;
73 extern const struct auth_hash auth_hash_sha2_224;
74 extern const struct auth_hash auth_hash_sha2_256;
75 extern const struct auth_hash auth_hash_sha2_384;
76 extern const struct auth_hash auth_hash_sha2_512;
77 extern const struct auth_hash auth_hash_nist_gmac_aes_128;
78 extern const struct auth_hash auth_hash_nist_gmac_aes_192;
79 extern const struct auth_hash auth_hash_nist_gmac_aes_256;
80 extern const struct auth_hash auth_hash_blake2b;
81 extern const struct auth_hash auth_hash_blake2s;
82 extern const struct auth_hash auth_hash_poly1305;
83 extern const struct auth_hash auth_hash_ccm_cbc_mac_128;
84 extern const struct auth_hash auth_hash_ccm_cbc_mac_192;
85 extern const struct auth_hash auth_hash_ccm_cbc_mac_256;
86
87 union authctx {
88         SHA1_CTX sha1ctx;
89         RMD160_CTX rmd160ctx;
90         SHA224_CTX sha224ctx;
91         SHA256_CTX sha256ctx;
92         SHA384_CTX sha384ctx;
93         SHA512_CTX sha512ctx;
94         struct aes_gmac_ctx aes_gmac_ctx;
95         struct aes_cbc_mac_ctx aes_cbc_mac_ctx;
96 };
97
98 #endif /* _CRYPTO_XFORM_AUTH_H_ */