]>
Commit | Line | Data |
---|---|---|
52b7d2ce A |
1 | /* $Id: algorithm.h,v 1.8 2004/11/18 15:14:44 ludvigm Exp $ */ |
2 | ||
3 | /* | |
4 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. | |
5 | * All rights reserved. | |
6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | |
15 | * 3. Neither the name of the project nor the names of its contributors | |
16 | * may be used to endorse or promote products derived from this software | |
17 | * without specific prior written permission. | |
18 | * | |
19 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND | |
20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE | |
23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
29 | * SUCH DAMAGE. | |
30 | */ | |
31 | ||
32 | #ifndef _ALGORITHM_H | |
33 | #define _ALGORITHM_H | |
34 | ||
d1e348cf | 35 | #include "Algorithm_types.h" |
52b7d2ce | 36 | |
52b7d2ce A |
37 | |
38 | struct hmac_algorithm { | |
39 | char *name; | |
40 | int type; | |
41 | int doi; | |
65c25746 A |
42 | caddr_t (*init) (vchar_t *); |
43 | void (*update) (caddr_t, vchar_t *); | |
44 | vchar_t *(*final) (caddr_t); | |
45 | int (*hashlen) (void); | |
46 | vchar_t *(*one) (vchar_t *, vchar_t *); | |
52b7d2ce A |
47 | }; |
48 | ||
49 | struct hash_algorithm { | |
50 | char *name; | |
51 | int type; | |
52 | int doi; | |
65c25746 A |
53 | caddr_t (*init) (void); |
54 | void (*update) (caddr_t, vchar_t *); | |
55 | vchar_t *(*final) (caddr_t); | |
56 | int (*hashlen) (void); | |
57 | vchar_t *(*one) (vchar_t *); | |
52b7d2ce A |
58 | }; |
59 | ||
60 | struct enc_algorithm { | |
61 | char *name; | |
62 | int type; | |
63 | int doi; | |
64 | int blocklen; | |
65c25746 A |
65 | vchar_t *(*encrypt) (vchar_t *, vchar_t *, vchar_t *); |
66 | vchar_t *(*decrypt) (vchar_t *, vchar_t *, vchar_t *); | |
67 | int (*weakkey) (vchar_t *); | |
68 | int (*keylen) (int); | |
52b7d2ce A |
69 | }; |
70 | ||
71 | /* dh group */ | |
72 | struct dh_algorithm { | |
73 | char *name; | |
74 | int type; | |
75 | int doi; | |
76 | struct dhgroup *dhgroup; | |
77 | }; | |
78 | ||
79 | /* ipcomp, auth meth, dh group */ | |
80 | struct misc_algorithm { | |
81 | char *name; | |
82 | int type; | |
83 | int doi; | |
84 | }; | |
85 | ||
65c25746 A |
86 | extern int alg_oakley_hashdef_ok (int); |
87 | extern int alg_oakley_hashdef_doi (int); | |
88 | extern int alg_oakley_hashdef_hashlen (int); | |
89 | extern vchar_t *alg_oakley_hashdef_one (int, vchar_t *); | |
52b7d2ce | 90 | |
65c25746 A |
91 | extern int alg_oakley_hmacdef_doi (int); |
92 | extern vchar_t *alg_oakley_hmacdef_one (int, vchar_t *, vchar_t *); | |
52b7d2ce | 93 | |
65c25746 A |
94 | extern int alg_oakley_encdef_ok (int); |
95 | extern int alg_oakley_encdef_doi (int); | |
96 | extern int alg_oakley_encdef_keylen (int, int); | |
97 | extern int alg_oakley_encdef_blocklen (int); | |
98 | extern vchar_t *alg_oakley_encdef_decrypt (int, vchar_t *, vchar_t *, vchar_t *); | |
99 | extern vchar_t *alg_oakley_encdef_encrypt (int, vchar_t *, vchar_t *, vchar_t *); | |
52b7d2ce | 100 | |
65c25746 A |
101 | extern int alg_ipsec_encdef_doi (int); |
102 | extern int alg_ipsec_encdef_keylen (int, int); | |
52b7d2ce | 103 | |
65c25746 A |
104 | extern int alg_ipsec_hmacdef_doi (int); |
105 | extern int alg_ipsec_hmacdef_hashlen (int); | |
52b7d2ce | 106 | |
65c25746 | 107 | extern int alg_ipsec_compdef_doi (int); |
52b7d2ce | 108 | |
65c25746 A |
109 | extern int alg_oakley_dhdef_doi (int); |
110 | extern int alg_oakley_dhdef_ok (int); | |
111 | extern struct dhgroup *alg_oakley_dhdef_group (int); | |
52b7d2ce | 112 | |
65c25746 | 113 | extern int alg_oakley_authdef_doi (int); |
52b7d2ce | 114 | |
65c25746 A |
115 | extern int default_keylen (int, int); |
116 | extern int check_keylen (int, int, int); | |
117 | extern int algtype2doi (int, int); | |
118 | extern int algclass2doi (int); | |
119 | ||
120 | extern const char *alg_oakley_encdef_name (int); | |
121 | extern const char *alg_oakley_hashdef_name (int); | |
122 | extern const char *alg_oakley_dhdef_name (int); | |
123 | extern const char *alg_oakley_authdef_name (int); | |
52b7d2ce | 124 | |
52b7d2ce | 125 | #endif /* _ALGORITHM_H */ |