xref: /openbsd/sbin/isakmpd/policy.h (revision 23d41768)
1 /*	$OpenBSD: policy.h,v 1.7 2000/10/07 06:57:08 niklas Exp $	*/
2 /*	$EOM: policy.h,v 1.12 2000/09/28 12:53:27 niklas Exp $ */
3 
4 /*
5  * Copyright (c) 1999, 2000 Angelos D. Keromytis.  All rights reserved.
6  * Copyright (c) 2000 Niklas Hallqvist.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. All advertising materials mentioning features or use of this software
17  *    must display the following acknowledgement:
18  *	This product includes software developed by Ericsson Radio Systems.
19  * 4. The name of the author may not be used to endorse or promote products
20  *    derived from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /*
35  * This code was written under funding by Ericsson Radio Systems.
36  */
37 
38 #ifndef _POLICY_H_
39 #define _POLICY_H_
40 
41 #ifndef POLICY_FILE_DEFAULT
42 #define POLICY_FILE_DEFAULT "/etc/isakmpd/isakmpd.policy"
43 #endif /* POLICY_FILE_DEFAULT */
44 
45 #if defined (USE_KEYNOTE)
46 #define CREDENTIAL_FILE "credentials"
47 #define PRIVATE_KEY_FILE "private_key"
48 
49 #define LK(sym, args) sym args
50 #define LKV(sym) sym
51 #elif defined (HAVE_DLOPEN) && 0
52 #define LK(sym, args) lk_ ## sym args
53 #define LKV(sym) *lk_ ## sym
54 #else
55 #define LK(sym, args) !!libkeynote called but no USE_KEYNOTE nor HAVE_DLOPEN!!
56 #define LKV(sym) !!libkeynote called but no USE_KEYNOTE nor HAVE_DLOPEN!!
57 #endif
58 
59 #if defined(HAVE_DLOPEN) && !defined(USE_KEYNOTE) && 0
60 struct keynote_deckey;
61 
62 extern void *libkeynote;
63 
64 /*
65  * These prototypes matches OpenBSD keynote.h 1.6.  If you use
66  * a different version than that, you are on your own.
67  */
68 extern int *lk_keynote_errno;
69 extern int (*lk_kn_add_action) (int, char *, char *, int);
70 extern int (*lk_kn_add_assertion) (int, char *, int, int);
71 extern int (*lk_kn_add_authorizer) (int, char *);
72 extern int (*lk_kn_close) (int);
73 extern int (*lk_kn_do_query) (int, char **, int);
74 extern char *(*lk_kn_encode_key) (struct keynote_deckey *, int, int, int);
75 extern int (*lk_kn_init) (void);
76 extern char **(*lk_kn_read_asserts) (char *, int, int *);
77 extern int (*lk_kn_remove_authorizer) (int, char *);
78 extern void (*lk_kn_free_key) (struct keynote_deckey *);
79 extern void *(*lk_kn_get_authorizer) (int, int, int*);
80 #endif /* HAVE_DLOPEN && !USE_KEYNOTE */
81 
82 extern int keynote_sessid;
83 extern int keynote_policy_asserts_num;
84 extern int x509_policy_asserts_num;
85 extern int x509_policy_asserts_num_alloc;
86 extern char **keynote_policy_asserts;
87 extern char **x509_policy_asserts;
88 extern struct exchange *policy_exchange;
89 extern struct sa *policy_sa;
90 extern struct sa *policy_isakmp_sa;
91 
92 extern void policy_init (void);
93 extern char *policy_callback (char *);
94 extern int keynote_cert_init (void);
95 extern void *keynote_cert_get (u_int8_t *, u_int32_t);
96 extern int keynote_cert_validate (void *);
97 extern int keynote_cert_insert (int, void *);
98 extern void keynote_cert_free (void *);
99 extern int keynote_certreq_validate (u_int8_t *, u_int32_t);
100 extern void *keynote_certreq_decode (u_int8_t *, u_int32_t);
101 extern void keynote_free_aca (void *);
102 extern int keynote_cert_obtain (u_int8_t *, size_t, void *,
103 				u_int8_t **, u_int32_t *);
104 extern int keynote_cert_get_subjects (void *, int *, u_int8_t ***,
105 				      u_int32_t **);
106 extern int keynote_cert_get_key (void *, void *);
107 #endif /* _POLICY_H_ */
108