xref: /freebsd-src/sys/rpc/rpcsec_gss/rpcsec_gss_int.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
1a9148abdSDoug Rabson /*
2a9148abdSDoug Rabson   rpcsec_gss.h
3a9148abdSDoug Rabson 
4*51369649SPedro F. Giffuni   SPDX-License-Identifier: BSD-3-Clause
5*51369649SPedro F. Giffuni 
6a9148abdSDoug Rabson   Copyright (c) 2000 The Regents of the University of Michigan.
7a9148abdSDoug Rabson   All rights reserved.
8a9148abdSDoug Rabson 
9a9148abdSDoug Rabson   Copyright (c) 2000 Dug Song <dugsong@UMICH.EDU>.
10a9148abdSDoug Rabson   All rights reserved, all wrongs reversed.
11a9148abdSDoug Rabson 
12a9148abdSDoug Rabson   Redistribution and use in source and binary forms, with or without
13a9148abdSDoug Rabson   modification, are permitted provided that the following conditions
14a9148abdSDoug Rabson   are met:
15a9148abdSDoug Rabson 
16a9148abdSDoug Rabson   1. Redistributions of source code must retain the above copyright
17a9148abdSDoug Rabson      notice, this list of conditions and the following disclaimer.
18a9148abdSDoug Rabson   2. Redistributions in binary form must reproduce the above copyright
19a9148abdSDoug Rabson      notice, this list of conditions and the following disclaimer in the
20a9148abdSDoug Rabson      documentation and/or other materials provided with the distribution.
21a9148abdSDoug Rabson   3. Neither the name of the University nor the names of its
22a9148abdSDoug Rabson      contributors may be used to endorse or promote products derived
23a9148abdSDoug Rabson      from this software without specific prior written permission.
24a9148abdSDoug Rabson 
25a9148abdSDoug Rabson   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
26a9148abdSDoug Rabson   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27a9148abdSDoug Rabson   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28a9148abdSDoug Rabson   DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29a9148abdSDoug Rabson   FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30a9148abdSDoug Rabson   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31a9148abdSDoug Rabson   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32a9148abdSDoug Rabson   BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33a9148abdSDoug Rabson   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34a9148abdSDoug Rabson   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35a9148abdSDoug Rabson   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36a9148abdSDoug Rabson 
37a9148abdSDoug Rabson   $Id: auth_gss.h,v 1.12 2001/04/30 19:44:47 andros Exp $
38a9148abdSDoug Rabson */
39a9148abdSDoug Rabson 
40a9148abdSDoug Rabson #ifndef _RPCSEC_GSS_INT_H
41a9148abdSDoug Rabson #define _RPCSEC_GSS_INT_H
42a9148abdSDoug Rabson 
43a9148abdSDoug Rabson #include <kgssapi/gssapi_impl.h>
44a9148abdSDoug Rabson 
45a9148abdSDoug Rabson /* RPCSEC_GSS control procedures. */
46a9148abdSDoug Rabson typedef enum {
47a9148abdSDoug Rabson 	RPCSEC_GSS_DATA = 0,
48a9148abdSDoug Rabson 	RPCSEC_GSS_INIT = 1,
49a9148abdSDoug Rabson 	RPCSEC_GSS_CONTINUE_INIT = 2,
50a9148abdSDoug Rabson 	RPCSEC_GSS_DESTROY = 3
51a9148abdSDoug Rabson } rpc_gss_proc_t;
52a9148abdSDoug Rabson 
53a9148abdSDoug Rabson #define RPCSEC_GSS_VERSION	1
54a9148abdSDoug Rabson 
55a9148abdSDoug Rabson /* Credentials. */
56a9148abdSDoug Rabson struct rpc_gss_cred {
57a9148abdSDoug Rabson 	u_int		gc_version;	/* version */
58a9148abdSDoug Rabson 	rpc_gss_proc_t	gc_proc;	/* control procedure */
59a9148abdSDoug Rabson 	u_int		gc_seq;		/* sequence number */
60a9148abdSDoug Rabson 	rpc_gss_service_t gc_svc;	/* service */
61a9148abdSDoug Rabson 	gss_buffer_desc	gc_handle;	/* handle to server-side context */
62a9148abdSDoug Rabson };
63a9148abdSDoug Rabson 
64a9148abdSDoug Rabson /* Context creation response. */
65a9148abdSDoug Rabson struct rpc_gss_init_res {
66a9148abdSDoug Rabson 	gss_buffer_desc	gr_handle;	/* handle to server-side context */
67a9148abdSDoug Rabson 	u_int		gr_major;	/* major status */
68a9148abdSDoug Rabson 	u_int		gr_minor;	/* minor status */
69a9148abdSDoug Rabson 	u_int		gr_win;		/* sequence window */
70a9148abdSDoug Rabson 	gss_buffer_desc	gr_token;	/* token */
71a9148abdSDoug Rabson };
72a9148abdSDoug Rabson 
73a9148abdSDoug Rabson /* Maximum sequence number value. */
74a9148abdSDoug Rabson #define MAXSEQ		0x80000000
75a9148abdSDoug Rabson 
76a9148abdSDoug Rabson /* Prototypes. */
77a9148abdSDoug Rabson __BEGIN_DECLS
78a9148abdSDoug Rabson 
79a9148abdSDoug Rabson bool_t	xdr_rpc_gss_cred(XDR *xdrs, struct rpc_gss_cred *p);
80a9148abdSDoug Rabson bool_t	xdr_rpc_gss_init_res(XDR *xdrs, struct rpc_gss_init_res *p);
81a9148abdSDoug Rabson bool_t xdr_rpc_gss_wrap_data(struct mbuf **argsp,
82a9148abdSDoug Rabson     gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_service_t svc,
83a9148abdSDoug Rabson     u_int seq);
84a9148abdSDoug Rabson bool_t xdr_rpc_gss_unwrap_data(struct mbuf **resultsp,
85a9148abdSDoug Rabson     gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_service_t svc, u_int seq);
86a9148abdSDoug Rabson const char *_rpc_gss_num_to_qop(const char *mech, u_int num);
87a9148abdSDoug Rabson void	_rpc_gss_set_error(int rpc_gss_error, int system_error);
88a9148abdSDoug Rabson 
89a9148abdSDoug Rabson void	rpc_gss_log_debug(const char *fmt, ...);
90a9148abdSDoug Rabson void	rpc_gss_log_status(const char *m, gss_OID mech, OM_uint32 major,
91a9148abdSDoug Rabson     OM_uint32 minor);
92a9148abdSDoug Rabson 
93a9148abdSDoug Rabson __END_DECLS
94a9148abdSDoug Rabson 
95a9148abdSDoug Rabson #endif /* !_RPCSEC_GSS_INT_H */
96