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