www.usr.com/support/gpl/USR9108_release1.5.tar.gz
[bcm963xx.git] / userapps / opensource / ipsec-tools / src / racoon / gssapi.h
1 /* $Id: gssapi.h,v 1.4 2004/06/11 16:00:16 ludvigm Exp $ */
2
3 /*
4  * Copyright 2000 Wasabi Systems, Inc.
5  * All rights reserved.
6  *
7  * This software was written by Frank van der Linden of Wasabi Systems
8  * for Zembu Labs, Inc. http://www.zembu.com/
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. The name of Wasabi Systems, Inc. may not be used to endorse
19  *    or promote products derived from this software without specific prior
20  *    written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
26  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34
35 #ifdef __FreeBSD__
36 #include "/usr/include/gssapi.h"
37 #else
38 #include <gssapi/gssapi.h>
39 #endif
40
41 #define GSSAPI_DEF_NAME         "ike"
42
43 struct ph1handle;
44 struct isakmpsa;
45
46 struct gssapi_ph1_state {
47         int gsscnt;                     /* # of token we're working on */
48         int gsscnt_p;                   /* # of token we're working on */
49
50         gss_buffer_desc gss[3];         /* gss-api tokens. */
51                                         /* NOTE: XXX this restricts the max # */
52                                         /* to 3. More should never happen */
53
54         gss_buffer_desc gss_p[3];
55
56         gss_ctx_id_t gss_context;       /* context for gss_init_sec_context */
57
58         OM_uint32 gss_status;           /* retval from gss_init_sec_context */
59         gss_cred_id_t gss_cred;         /* acquired credentials */
60
61         int gss_flags;
62 #define GSSFLAG_ID_SENT         0x0001
63 #define GSSFLAG_ID_RCVD         0x0001
64 };
65
66 #define gssapi_get_state(ph)                                            \
67         ((struct gssapi_ph1_state *)((ph)->gssapi_state))
68
69 #define gssapi_set_state(ph, st)                                        \
70         (ph)->gssapi_state = (st)
71
72 #define gssapi_more_tokens(ph)                                          \
73         ((gssapi_get_state(ph)->gss_status & GSS_S_CONTINUE_NEEDED) != 0)
74
75 int gssapi_get_itoken __P((struct ph1handle *, int *));
76 int gssapi_get_rtoken __P((struct ph1handle *, int *));
77 int gssapi_save_received_token __P((struct ph1handle *, vchar_t *));
78 int gssapi_get_token_to_send __P((struct ph1handle *, vchar_t **));
79 int gssapi_get_itokens __P((struct ph1handle *, vchar_t **));
80 int gssapi_get_rtokens __P((struct ph1handle *, vchar_t **));
81 vchar_t *gssapi_wraphash __P((struct ph1handle *));
82 vchar_t *gssapi_unwraphash __P((struct ph1handle *));
83 void gssapi_set_id_sent __P((struct ph1handle *));
84 int gssapi_id_sent __P((struct ph1handle *));
85 void gssapi_set_id_rcvd __P((struct ph1handle *));
86 int gssapi_id_rcvd __P((struct ph1handle *));
87 void gssapi_free_state __P((struct ph1handle *));
88 vchar_t *gssapi_get_default_id __P((struct ph1handle *));