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