1 /*
2  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the project nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 /* YIPS @(#)$Id: oakley.h,v 1.4 2002-12-11 07:13:56 guy Exp $ */
30 
31 /* refer to RFC 2409 */
32 
33 #if !defined(_ISAKMP_OAKLEY_H_)
34 #define _ISAKMP_OAKLEY_H_
35 
36 /* Attribute Classes */
37 #define OAKLEY_ATTR_ENC_ALG                   1 /* B */
38 #define   OAKLEY_ATTR_ENC_ALG_DES               1
39 #define   OAKLEY_ATTR_ENC_ALG_IDEA              2
40 #define   OAKLEY_ATTR_ENC_ALG_BL                3
41 #define   OAKLEY_ATTR_ENC_ALG_RC5               4
42 #define   OAKLEY_ATTR_ENC_ALG_3DES              5
43 #define   OAKLEY_ATTR_ENC_ALG_CAST              6
44 #define OAKLEY_ATTR_HASH_ALG                  2 /* B */
45 #define   OAKLEY_ATTR_HASH_ALG_MD5              1
46 #define   OAKLEY_ATTR_HASH_ALG_SHA              2
47 #define   OAKLEY_ATTR_HASH_ALG_TIGER            3
48 #define OAKLEY_ATTR_AUTH_METHOD               3 /* B */
49 #define   OAKLEY_ATTR_AUTH_METHOD_PSKEY         1
50 #define   OAKLEY_ATTR_AUTH_METHOD_DSS           2
51 #define   OAKLEY_ATTR_AUTH_METHOD_RSA           3
52 #define   OAKLEY_ATTR_AUTH_METHOD_RSAENC        4
53 #define   OAKLEY_ATTR_AUTH_METHOD_RSAREV        5
54 #define OAKLEY_ATTR_GRP_DESC                  4 /* B */
55 #define   OAKLEY_ATTR_GRP_DESC_MODP768          1
56 #define   OAKLEY_ATTR_GRP_DESC_MODP1024         2
57 #define   OAKLEY_ATTR_GRP_DESC_EC2N155          3
58 #define   OAKLEY_ATTR_GRP_DESC_EC2N185          4
59 #define OAKLEY_ATTR_GRP_TYPE                  5 /* B */
60 #define   OAKLEY_ATTR_GRP_TYPE_MODP             1
61 #define   OAKLEY_ATTR_GRP_TYPE_ECP              2
62 #define   OAKLEY_ATTR_GRP_TYPE_EC2N             3
63 #define OAKLEY_ATTR_GRP_PI                    6 /* V */
64 #define OAKLEY_ATTR_GRP_GEN_ONE               7 /* V */
65 #define OAKLEY_ATTR_GRP_GEN_TWO               8 /* V */
66 #define OAKLEY_ATTR_GRP_CURVE_A               9 /* V */
67 #define OAKLEY_ATTR_GRP_CURVE_B              10 /* V */
68 #define OAKLEY_ATTR_SA_LTYPE                 11 /* B */
69 #define   OAKLEY_ATTR_SA_LTYPE_DEFAULT          1
70 #define   OAKLEY_ATTR_SA_LTYPE_SEC              1
71 #define   OAKLEY_ATTR_SA_LTYPE_KB               2
72 #define OAKLEY_ATTR_SA_LDUR                  12 /* V */
73 #define   OAKLEY_ATTR_SA_LDUR_DEFAULT           28800 /* 8 hours */
74 #define OAKLEY_ATTR_PRF                      13 /* B */
75 #define OAKLEY_ATTR_KEY_LEN                  14 /* B */
76 #define OAKLEY_ATTR_FIELD_SIZE               15 /* B */
77 #define OAKLEY_ATTR_GRP_ORDER                16 /* V */
78 
79 #define OAKLEY_ID_IPV4_ADDR          0
80 #define OAKLEY_ID_IPV4_ADDR_SUBNET   1
81 #define OAKLEY_ID_IPV6_ADDR          2
82 #define OAKLEY_ID_IPV6_ADDR_SUBNET   3
83 
84 /* Additional Exchange Type */
85 #define ISAKMP_ETYPE_QUICK    32
86 #define ISAKMP_ETYPE_NEWGRP   33
87 
88 /* The use for checking proposal payload. This is not exchange type. */
89 #define OAKLEY_MAIN_MODE    0
90 #define OAKLEY_QUICK_MODE   1
91 
92 #define OAKLEY_PRIME_MODP768 "\
93 	FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 \
94 	29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD \
95 	EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 \
96 	E485B576 625E7EC6 F44C42E9 A63A3620 FFFFFFFF FFFFFFFF"
97 
98 #define OAKLEY_PRIME_MODP1024 "\
99 	FFFFFFFF FFFFFFFF C90FDAA2 2168C234 C4C6628B 80DC1CD1 \
100 	29024E08 8A67CC74 020BBEA6 3B139B22 514A0879 8E3404DD \
101 	EF9519B3 CD3A431B 302B0A6D F25F1437 4FE1356D 6D51C245 \
102 	E485B576 625E7EC6 F44C42E9 A637ED6B 0BFF5CB6 F406B7ED \
103 	EE386BFB 5A899FA5 AE9F2411 7C4B1FE6 49286651 ECE65381 \
104 	FFFFFFFF FFFFFFFF"
105 
106 #define DEFAULTSECRETSIZE ( 128 / 8 ) /* 128 bits */
107 #define DEFAULTNONCESIZE  ( 128 / 8 ) /* 128 bits */
108 
109 #define MAXPADLWORD 20
110 
111 #if 0
112 /* isakmp sa structure */
113 struct oakley_sa {
114 	u_int8_t  proto_id;            /* OAKLEY */
115 	vchar_t   *spi;                /* spi */
116 	u_int8_t  dhgrp;               /* DH; group */
117 	u_int8_t  auth_t;              /* method of authentication */
118 	u_int8_t  prf_t;               /* type of prf */
119 	u_int8_t  hash_t;              /* type of hash */
120 	u_int8_t  enc_t;               /* type of cipher */
121 	u_int8_t  life_t;              /* type of duration of lifetime */
122 	u_int32_t ldur;                /* life duration */
123 };
124 #endif
125 
126 #endif /* !defined(_ISAKMP_OAKLEY_H_) */
127