OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / pluto / spdb.h
1 /* Security Policy Data Base (such as it is)
2  * Copyright (C) 1998, 1999  D. Hugh Redelmeier.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * for more details.
13  *
14  * RCSID $Id: spdb.h,v 1.11 2000/09/15 09:09:28 dhr Exp $
15  */
16
17 /* database of SA properties */
18
19 /* Attribute type and value pair.
20  * Note: only "basic" values are represented so far.
21  */
22 struct db_attr {
23     u_int16_t type;     /* ISAKMP_ATTR_AF_TV is implied; 0 for end */
24     u_int16_t val;
25 };
26
27 /* transform */
28 struct db_trans {
29     u_int8_t transid;   /* Transform-Id */
30     struct db_attr *attrs;      /* array */
31     int attr_cnt;       /* number of elements */
32 };
33
34 /* proposal */
35 struct db_prop {
36     u_int8_t protoid;   /* Protocol-Id */
37     struct db_trans *trans;     /* array (disjunction) */
38     int trans_cnt;      /* number of elements */
39     /* SPI size and value isn't part of DB */
40 };
41
42 /* conjunction of proposals */
43 struct db_prop_conj {
44     struct db_prop *props;      /* array */
45     int prop_cnt;       /* number of elements */
46 };
47
48 /* security association */
49 struct db_sa {
50     struct db_prop_conj *prop_conjs;    /* array */
51     int prop_conj_cnt;  /* number of elements */
52     /* Hardwired for now;
53      * DOI: ISAKMP_DOI_IPSEC
54      * Situation: SIT_IDENTITY_ONLY
55      */
56 };
57
58 /* The oakley sadb is subscripted by a bitset with members
59  * from POLICY_PSK and POLICY_RSASIG.
60  */
61 extern struct db_sa oakley_sadb[1 << 2];
62
63 /* The oakley sadb for aggressive mode.
64  */
65 extern struct db_sa otpsk768des3sha_sadb_am;
66 extern struct db_sa otpsk1024des3sha_sadb_am;
67 extern struct db_sa otpsk1536des3sha_sadb_am;
68 extern struct db_sa otpsk768des3md5_sadb_am;
69 extern struct db_sa otpsk1024des3md5_sadb_am;
70 extern struct db_sa otpsk1536des3md5_sadb_am;
71 extern struct db_sa otpsk768dessha_sadb_am;
72 extern struct db_sa otpsk1024dessha_sadb_am;
73 extern struct db_sa otpsk1536dessha_sadb_am;
74 extern struct db_sa otpsk768desmd5_sadb_am;
75 extern struct db_sa otpsk1024desmd5_sadb_am;
76 extern struct db_sa otpsk1536desmd5_sadb_am;
77
78
79 /* The ipsec sadb is subscripted by a bitset with members
80  * from POLICY_ENCRYPT, POLICY_AUTHENTICATE, POLICY_COMPRESS
81  */
82 extern struct db_sa ipsec_sadb[1 << 3];
83
84 extern bool out_sa(
85     pb_stream *outs,
86     struct db_sa *sadb,
87     struct state *st,
88     bool oakley_mode,
89     u_int8_t np);
90 #if FREESWAN_OLD
91 extern complaint_t accept_oakley_auth_method(
92     struct state *st,   /* current state object */
93     u_int32_t amethod,  /* room for larger values */
94     bool credcheck);    /* whether we can check credentials now */
95
96 extern int init_st_oakley(struct state *st, lset_t policy);
97 #endif
98 extern notification_t parse_isakmp_sa_body(
99     pb_stream *sa_pbs,  /* body of input SA Payload */
100     const struct isakmp_sa *sa, /* header of input SA Payload */
101     pb_stream *r_sa_pbs,        /* if non-NULL, where to emit winning SA */
102     bool selection,     /* if this SA is a selection, only one tranform can appear */
103     struct state *st);  /* current state object */
104
105 extern notification_t parse_ipsec_sa_body(
106     pb_stream *sa_pbs,  /* body of input SA Payload */
107     const struct isakmp_sa *sa, /* header of input SA Payload */
108     pb_stream *r_sa_pbs,        /* if non-NULL, where to emit winning SA */
109     bool selection,     /* if this SA is a selection, only one tranform can appear */
110     struct state *st);  /* current state object */