ipsec_doi.h revision 190207
1250883Sed/*
2250883Sed * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3250883Sed * All rights reserved.
4250883Sed *
5250883Sed * Redistribution and use in source and binary forms, with or without
6250883Sed * modification, are permitted provided that the following conditions
7250883Sed * are met:
8250883Sed * 1. Redistributions of source code must retain the above copyright
9250883Sed *    notice, this list of conditions and the following disclaimer.
10250883Sed * 2. Redistributions in binary form must reproduce the above copyright
11250883Sed *    notice, this list of conditions and the following disclaimer in the
12250883Sed *    documentation and/or other materials provided with the distribution.
13250883Sed * 3. Neither the name of the project nor the names of its contributors
14250883Sed *    may be used to endorse or promote products derived from this software
15250883Sed *    without specific prior written permission.
16250883Sed *
17250883Sed * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
18250883Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19250883Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20250883Sed * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21250883Sed * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22250883Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23250883Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24250883Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25250883Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26250883Sed * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27250883Sed * SUCH DAMAGE.
28250883Sed */
29250883Sed/* YIPS @(#)$Id: ipsec_doi.h,v 1.7 2002-12-11 07:13:53 guy Exp $ */
30250883Sed
31250883Sed/* refer to RFC 2407 */
32250883Sed
33250883Sed#if !defined(_IPSEC_DOI_H_)
34250883Sed#define _IPSEC_DOI_H_
35250883Sed
36250883Sed#define IPSEC_DOI 1
37250883Sed
38250883Sed/* 4.2 IPSEC Situation Definition */
39250883Sed#define IPSECDOI_SIT_IDENTITY_ONLY           0x00000001
40250883Sed#define IPSECDOI_SIT_SECRECY                 0x00000002
41250883Sed#define IPSECDOI_SIT_INTEGRITY               0x00000004
42250883Sed
43290532Sngie/* 4.4.1 IPSEC Security Protocol Identifiers */
44290532Sngie  /* 4.4.2 IPSEC ISAKMP Transform Values */
45291178Sngie#define IPSECDOI_PROTO_ISAKMP                        1
46291178Sngie#define   IPSECDOI_KEY_IKE                             1
47250883Sed
48291178Sngie/* 4.4.1 IPSEC Security Protocol Identifiers */
49250883Sed#define IPSECDOI_PROTO_IPSEC_AH                      2
50291178Sngie  /* 4.4.3 IPSEC AH Transform Values */
51291178Sngie#define   IPSECDOI_AH_MD5                              2
52291178Sngie#define   IPSECDOI_AH_SHA                              3
53291178Sngie#define   IPSECDOI_AH_DES                              4
54250883Sed#define   IPSECDOI_AH_SHA2_256                         5
55291178Sngie#define   IPSECDOI_AH_SHA2_384                         6
56291178Sngie#define   IPSECDOI_AH_SHA2_512                         7
57291178Sngie
58291178Sngie/* 4.4.1 IPSEC Security Protocol Identifiers */
59291178Sngie#define IPSECDOI_PROTO_IPSEC_ESP                     3
60291178Sngie  /* 4.4.4 IPSEC ESP Transform Identifiers */
61291178Sngie#define   IPSECDOI_ESP_DES_IV64                        1
62291178Sngie#define   IPSECDOI_ESP_DES                             2
63291178Sngie#define   IPSECDOI_ESP_3DES                            3
64291178Sngie#define   IPSECDOI_ESP_RC5                             4
65291178Sngie#define   IPSECDOI_ESP_IDEA                            5
66291178Sngie#define   IPSECDOI_ESP_CAST                            6
67250883Sed#define   IPSECDOI_ESP_BLOWFISH                        7
68250883Sed#define   IPSECDOI_ESP_3IDEA                           8
69250883Sed#define   IPSECDOI_ESP_DES_IV32                        9
70250883Sed#define   IPSECDOI_ESP_RC4                            10
71290532Sngie#define   IPSECDOI_ESP_NULL                           11
72290532Sngie#define   IPSECDOI_ESP_RIJNDAEL				12
73250883Sed#define   IPSECDOI_ESP_AES				12
74250883Sed
75250883Sed/* 4.4.1 IPSEC Security Protocol Identifiers */
76250883Sed#define IPSECDOI_PROTO_IPCOMP                        4
77290532Sngie  /* 4.4.5 IPSEC IPCOMP Transform Identifiers */
78290532Sngie#define   IPSECDOI_IPCOMP_OUI                          1
79250883Sed#define   IPSECDOI_IPCOMP_DEFLATE                      2
80250883Sed#define   IPSECDOI_IPCOMP_LZS                          3
81290532Sngie
82290532Sngie/* 4.5 IPSEC Security Association Attributes */
83250883Sed#define IPSECDOI_ATTR_SA_LTYPE                1 /* B */
84250883Sed#define   IPSECDOI_ATTR_SA_LTYPE_DEFAULT        1
85250883Sed#define   IPSECDOI_ATTR_SA_LTYPE_SEC            1
86250883Sed#define   IPSECDOI_ATTR_SA_LTYPE_KB             2
87290532Sngie#define IPSECDOI_ATTR_SA_LDUR                 2 /* V */
88290532Sngie#define   IPSECDOI_ATTR_SA_LDUR_DEFAULT         28800 /* 8 hours */
89250883Sed#define IPSECDOI_ATTR_GRP_DESC                3 /* B */
90250883Sed#define IPSECDOI_ATTR_ENC_MODE                4 /* B */
91250883Sed	/* default value: host dependent */
92250883Sed#define   IPSECDOI_ATTR_ENC_MODE_TUNNEL         1
93290532Sngie#define   IPSECDOI_ATTR_ENC_MODE_TRNS           2
94290532Sngie#define IPSECDOI_ATTR_AUTH                    5 /* B */
95290532Sngie	/* 0 means not to use authentication. */
96290532Sngie#define   IPSECDOI_ATTR_AUTH_HMAC_MD5           1
97291178Sngie#define   IPSECDOI_ATTR_AUTH_HMAC_SHA1          2
98250883Sed#define   IPSECDOI_ATTR_AUTH_DES_MAC            3
99291178Sngie#define   IPSECDOI_ATTR_AUTH_KPDK               4 /*RFC-1826(Key/Pad/Data/Key)*/
100291178Sngie	/*
101291178Sngie	 * When negotiating ESP without authentication, the Auth
102251314Sed	 * Algorithm attribute MUST NOT be included in the proposal.
103291178Sngie	 * When negotiating ESP without confidentiality, the Auth
104251314Sed	 * Algorithm attribute MUST be included in the proposal and
105251314Sed	 * the ESP transform ID must be ESP_NULL.
106251314Sed	*/
107251314Sed#define IPSECDOI_ATTR_KEY_LENGTH              6 /* B */
108290532Sngie#define IPSECDOI_ATTR_KEY_ROUNDS              7 /* B */
109290532Sngie#define IPSECDOI_ATTR_COMP_DICT_SIZE          8 /* B */
110290532Sngie#define IPSECDOI_ATTR_COMP_PRIVALG            9 /* V */
111291178Sngie
112251314Sed/* 4.6.1 Security Association Payload */
113291178Sngiestruct ipsecdoi_sa {
114291178Sngie	struct isakmp_gen h;
115291178Sngie	u_int32_t doi; /* Domain of Interpretation */
116251314Sed	u_int32_t sit; /* Situation */
117291178Sngie};
118251314Sed
119251314Sedstruct ipsecdoi_secrecy_h {
120251314Sed	u_int16_t len;
121251314Sed	u_int16_t reserved;
122290532Sngie};
123290532Sngie
124291178Sngie/* 4.6.2.1 Identification Type Values */
125251314Sedstruct ipsecdoi_id {
126291178Sngie	struct isakmp_gen h;
127291178Sngie	u_int8_t  type;		/* ID Type */
128291178Sngie	u_int8_t  proto_id;	/* Protocol ID */
129250883Sed	u_int16_t port;		/* Port */
130291178Sngie	/* Identification Data */
131250883Sed};
132250883Sed
133250883Sed#define IPSECDOI_ID_IPV4_ADDR                        1
134250883Sed#define IPSECDOI_ID_FQDN                             2
135290532Sngie#define IPSECDOI_ID_USER_FQDN                        3
136290532Sngie#define IPSECDOI_ID_IPV4_ADDR_SUBNET                 4
137290532Sngie#define IPSECDOI_ID_IPV6_ADDR                        5
138250883Sed#define IPSECDOI_ID_IPV6_ADDR_SUBNET                 6
139250883Sed#define IPSECDOI_ID_IPV4_ADDR_RANGE                  7
140250883Sed#define IPSECDOI_ID_IPV6_ADDR_RANGE                  8
141250883Sed#define IPSECDOI_ID_DER_ASN1_DN                      9
142250883Sed#define IPSECDOI_ID_DER_ASN1_GN                      10
143250883Sed#define IPSECDOI_ID_KEY_ID                           11
144290532Sngie
145290532Sngie/* 4.6.3 IPSEC DOI Notify Message Types */
146290532Sngie/* Notify Messages - Status Types */
147290532Sngie#define IPSECDOI_NTYPE_RESPONDER_LIFETIME                  24576
148250883Sed#define IPSECDOI_NTYPE_REPLAY_STATUS                       24577
149250883Sed#define IPSECDOI_NTYPE_INITIAL_CONTACT                     24578
150250883Sed
151250883Sed#endif /* !defined(_IPSEC_DOI_H_) */
152290532Sngie