1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 #ifndef _CRYPTO_XFORM_H_
25 #define _CRYPTO_XFORM_H_
26
27 #include <crypto/md5.h>
28 #include <crypto/sha1.h>
29 #include <crypto/rmd160.h>
30 #include <crypto/sha2.h>
31
32
33 struct auth_hash {
34 int type;
35 char *name;
36 u_int16_t keysize;
37 u_int16_t hashsize;
38 u_int16_t authsize;
39 u_int16_t ctxsize;
40 void (*Init) (void *);
41 int (*Update) (void *, u_int8_t *, u_int16_t);
42 void (*Final) (u_int8_t *, void *);
43 };
44
45 struct enc_xform {
46 int type;
47 char *name;
48 u_int16_t blocksize, ivsize;
49 u_int16_t minkey, maxkey;
50 void (*encrypt) (caddr_t, u_int8_t *);
51 void (*decrypt) (caddr_t, u_int8_t *);
52 int (*setkey) (u_int8_t **, u_int8_t *, int len);
53 void (*zerokey) (u_int8_t **);
54 void (*reinit) (caddr_t, u_int8_t *);
55 };
56
57 struct comp_algo {
58 int type;
59 char *name;
60 size_t minlen;
61 u_int32_t (*compress) (u_int8_t *, u_int32_t, u_int8_t **);
62 u_int32_t (*decompress) (u_int8_t *, u_int32_t, u_int8_t **);
63 };
64
65 union authctx {
66 MD5_CTX md5ctx;
67 SHA1_CTX sha1ctx;
68 RMD160_CTX rmd160ctx;
69 SHA256_CTX sha2_256ctx;
70 SHA384_CTX sha2_384ctx;
71 SHA512_CTX sha2_512ctx;
72 };
73
74 extern struct enc_xform enc_xform_des;
75 extern struct enc_xform enc_xform_3des;
76 extern struct enc_xform enc_xform_blf;
77 extern struct enc_xform enc_xform_cast5;
78 extern struct enc_xform enc_xform_skipjack;
79 extern struct enc_xform enc_xform_rijndael128;
80 extern struct enc_xform enc_xform_aes_ctr;
81 extern struct enc_xform enc_xform_arc4;
82 extern struct enc_xform enc_xform_null;
83
84 extern struct auth_hash auth_hash_md5;
85 extern struct auth_hash auth_hash_sha1;
86 extern struct auth_hash auth_hash_key_md5;
87 extern struct auth_hash auth_hash_key_sha1;
88 extern struct auth_hash auth_hash_hmac_md5_96;
89 extern struct auth_hash auth_hash_hmac_sha1_96;
90 extern struct auth_hash auth_hash_hmac_ripemd_160_96;
91 extern struct auth_hash auth_hash_hmac_sha2_256_96;
92 extern struct auth_hash auth_hash_hmac_sha2_384_96;
93 extern struct auth_hash auth_hash_hmac_sha2_512_96;
94
95 extern struct comp_algo comp_algo_deflate;
96 extern struct comp_algo comp_algo_lzs;
97
98 #endif