Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/crypto/krb5/src/include/gssrpc/auth_gss.h
34907 views
1
/* include/gssrpc/auth_gss.h */
2
/*
3
Copyright (c) 2000 The Regents of the University of Michigan.
4
All rights reserved.
5
6
Copyright (c) 2000 Dug Song <[email protected]>.
7
All rights reserved, all wrongs reversed.
8
9
Redistribution and use in source and binary forms, with or without
10
modification, are permitted provided that the following conditions
11
are met:
12
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. Neither the name of the University nor the names of its
19
contributors may be used to endorse or promote products derived
20
from this software without specific prior written permission.
21
22
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
23
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26
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
29
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34
Id: auth_gss.h,v 1.13 2002/05/08 16:54:33 andros Exp
35
*/
36
37
#ifndef GSSRPC_AUTH_GSS_H
38
#define GSSRPC_AUTH_GSS_H
39
40
#include <gssrpc/rpc.h>
41
#include <gssrpc/clnt.h>
42
#ifdef HAVE_HEIMDAL
43
#include <gssapi.h>
44
#else
45
#include <gssapi/gssapi.h>
46
#endif
47
48
GSSRPC__BEGIN_DECLS
49
50
/* RPCSEC_GSS control procedures. */
51
typedef enum {
52
RPCSEC_GSS_DATA = 0,
53
RPCSEC_GSS_INIT = 1,
54
RPCSEC_GSS_CONTINUE_INIT = 2,
55
RPCSEC_GSS_DESTROY = 3
56
} rpc_gss_proc_t;
57
58
/* RPCSEC_GSS services. */
59
typedef enum {
60
RPCSEC_GSS_SVC_NONE = 1,
61
RPCSEC_GSS_SVC_INTEGRITY = 2,
62
RPCSEC_GSS_SVC_PRIVACY = 3
63
} rpc_gss_svc_t;
64
65
#define RPCSEC_GSS_VERSION 1
66
67
/* RPCSEC_GSS security triple. */
68
struct rpc_gss_sec {
69
gss_OID mech; /* mechanism */
70
gss_qop_t qop; /* quality of protection */
71
rpc_gss_svc_t svc; /* service */
72
gss_cred_id_t cred; /* cred handle */
73
uint32_t req_flags; /* req flags for init_sec_context */
74
};
75
76
/* Private data required for kernel implementation */
77
struct authgss_private_data {
78
gss_ctx_id_t pd_ctx; /* Session context handle */
79
gss_buffer_desc pd_ctx_hndl; /* Credentials context handle */
80
uint32_t pd_seq_win; /* Sequence window */
81
};
82
83
/* Krb 5 default mechanism
84
#define KRB5OID "1.2.840.113554.1.2.2"
85
86
gss_OID_desc krb5oid = {
87
20, KRB5OID
88
};
89
*/
90
91
/*
92
struct rpc_gss_sec krb5mech = {
93
(gss_OID)&krb5oid,
94
GSS_QOP_DEFAULT,
95
RPCSEC_GSS_SVC_NONE
96
};
97
*/
98
99
/* Credentials. */
100
struct rpc_gss_cred {
101
u_int gc_v; /* version */
102
rpc_gss_proc_t gc_proc; /* control procedure */
103
uint32_t gc_seq; /* sequence number */
104
rpc_gss_svc_t gc_svc; /* service */
105
gss_buffer_desc gc_ctx; /* context handle */
106
};
107
108
/* Context creation response. */
109
struct rpc_gss_init_res {
110
gss_buffer_desc gr_ctx; /* context handle */
111
uint32_t gr_major; /* major status */
112
uint32_t gr_minor; /* minor status */
113
uint32_t gr_win; /* sequence window */
114
gss_buffer_desc gr_token; /* token */
115
};
116
117
/* Maximum sequence number value. */
118
#define MAXSEQ 0x80000000
119
120
/* Prototypes. */
121
bool_t xdr_rpc_gss_buf (XDR *xdrs, gss_buffer_t, u_int maxsize);
122
bool_t xdr_rpc_gss_cred (XDR *xdrs, struct rpc_gss_cred *p);
123
bool_t xdr_rpc_gss_init_args (XDR *xdrs, gss_buffer_desc *p);
124
bool_t xdr_rpc_gss_init_res (XDR *xdrs, struct rpc_gss_init_res *p);
125
bool_t xdr_rpc_gss_data (XDR *xdrs, xdrproc_t xdr_func,
126
caddr_t xdr_ptr, gss_ctx_id_t ctx,
127
gss_qop_t qop, rpc_gss_svc_t svc,
128
uint32_t seq);
129
bool_t xdr_rpc_gss_wrap_data (XDR *xdrs, xdrproc_t xdr_func, caddr_t
130
xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop,
131
rpc_gss_svc_t svc, uint32_t seq);
132
bool_t xdr_rpc_gss_unwrap_data (XDR *xdrs, xdrproc_t xdr_func, caddr_t
133
xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop,
134
rpc_gss_svc_t svc, uint32_t seq);
135
136
AUTH *authgss_create (CLIENT *, gss_name_t, struct rpc_gss_sec *);
137
AUTH *authgss_create_default (CLIENT *, char *, struct rpc_gss_sec *);
138
bool_t authgss_service (AUTH *auth, int svc);
139
bool_t authgss_get_private_data (AUTH *auth, struct authgss_private_data *);
140
141
#ifdef GSSRPC__IMPL
142
void log_debug (const char *fmt, ...);
143
void log_status (char *m, OM_uint32 major, OM_uint32 minor);
144
void log_hexdump (const u_char *buf, int len, int offset);
145
#endif
146
147
GSSRPC__END_DECLS
148
#endif /* !defined(GSSRPC_AUTH_GSS_H) */
149
150