1 /* $NetBSD: xform.h,v 1.5 2003/08/27 00:20:57 thorpej Exp $ */
2 /* $FreeBSD: src/sys/opencrypto/xform.h,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $ */
3 /* $OpenBSD: xform.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $ */
4
5 /*
6 * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
7 *
8 * This code was written by Angelos D. Keromytis in Athens, Greece, in
9 * February 2000. Network Security Technologies Inc. (NSTI) kindly
10 * supported the development of this code.
11 *
12 * Copyright (c) 2000 Angelos D. Keromytis
13 *
14 * Permission to use, copy, and modify this software with or without fee
15 * is hereby granted, provided that this entire notice is included in
16 * all source code copies of any software which is or includes a copy or
17 * modification of this software.
18 *
19 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
20 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
21 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
22 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
23 * PURPOSE.
24 */
25
26 #ifndef _CRYPTO_XFORM_H_
27 #define _CRYPTO_XFORM_H_
28
29 #include <sys/md5.h>
30 #include <sys/sha1.h>
31 #include <crypto/sha2/sha2.h>
32 #include <crypto/ripemd160/rmd160.h>
33
34 /* Declarations */
35 struct auth_hash {
36 int type;
37 char *name;
38 u_int16_t keysize;
39 u_int16_t hashsize;
40 u_int16_t authsize;
41 u_int16_t ctxsize;
42 void (*Init) (void *);
43 int (*Update) (void *, const u_int8_t *, u_int16_t);
44 void (*Final) (u_int8_t *, void *);
45 };
46
47 /* Provide array-limit for clients (e.g., netipsec) */
48 #define AH_ALEN_MAX 20 /* max authenticator hash length */
49
50 struct enc_xform {
51 int type;
52 char *name;
53 u_int16_t blocksize;
54 u_int16_t minkey, maxkey;
55 void (*encrypt) (caddr_t, u_int8_t *);
56 void (*decrypt) (caddr_t, u_int8_t *);
57 int (*setkey) (u_int8_t **, const u_int8_t *, int len);
58 void (*zerokey) (u_int8_t **);
59 };
60
61 struct comp_algo {
62 int type;
63 char *name;
64 size_t minlen;
65 u_int32_t (*compress) (u_int8_t *, u_int32_t, u_int8_t **);
66 u_int32_t (*decompress) (u_int8_t *, u_int32_t, u_int8_t **);
67 };
68
69 union authctx {
70 MD5_CTX md5ctx;
71 SHA1_CTX sha1ctx;
72 RMD160_CTX rmd160ctx;
73 SHA256_CTX sha256ctx;
74 SHA384_CTX sha384ctx;
75 SHA512_CTX sha512ctx;
76 };
77
78 extern struct enc_xform enc_xform_null;
79 extern struct enc_xform enc_xform_des;
80 extern struct enc_xform enc_xform_3des;
81 extern struct enc_xform enc_xform_blf;
82 extern struct enc_xform enc_xform_cast5;
83 extern struct enc_xform enc_xform_skipjack;
84 extern struct enc_xform enc_xform_rijndael128;
85 extern struct enc_xform enc_xform_arc4;
86
87 extern struct auth_hash auth_hash_null;
88 extern struct auth_hash auth_hash_md5;
89 extern struct auth_hash auth_hash_sha1;
90 extern struct auth_hash auth_hash_key_md5;
91 extern struct auth_hash auth_hash_key_sha1;
92 extern struct auth_hash auth_hash_hmac_md5_96;
93 extern struct auth_hash auth_hash_hmac_sha1_96;
94 extern struct auth_hash auth_hash_hmac_ripemd_160_96;
95 extern struct auth_hash auth_hash_hmac_sha2_256;
96 extern struct auth_hash auth_hash_hmac_sha2_384;
97 extern struct auth_hash auth_hash_hmac_sha2_512;
98
99 extern struct comp_algo comp_algo_deflate;
100
101 #ifdef _KERNEL
102 #include <sys/malloc.h>
103 MALLOC_DECLARE(M_XDATA);
104 #endif
105 #endif /* _CRYPTO_XFORM_H_ */
Cache object: 8639bc7fd56f0f23fe546c1db4dddd51
|