xref: /linux-6.15/include/linux/sunrpc/auth_gss.h (revision bb7e5ce7)
1 /*
2  * linux/include/linux/sunrpc/auth_gss.h
3  *
4  * Declarations for RPCSEC_GSS
5  *
6  * Dug Song <[email protected]>
7  * Andy Adamson <[email protected]>
8  * Bruce Fields <[email protected]>
9  * Copyright (c) 2000 The Regents of the University of Michigan
10  */
11 
12 #ifndef _LINUX_SUNRPC_AUTH_GSS_H
13 #define _LINUX_SUNRPC_AUTH_GSS_H
14 
15 #ifdef __KERNEL__
16 #include <linux/refcount.h>
17 #include <linux/sunrpc/auth.h>
18 #include <linux/sunrpc/svc.h>
19 #include <linux/sunrpc/gss_api.h>
20 
21 #define RPC_GSS_VERSION		1
22 
23 #define MAXSEQ 0x80000000 /* maximum legal sequence number, from rfc 2203 */
24 
25 enum rpc_gss_proc {
26 	RPC_GSS_PROC_DATA = 0,
27 	RPC_GSS_PROC_INIT = 1,
28 	RPC_GSS_PROC_CONTINUE_INIT = 2,
29 	RPC_GSS_PROC_DESTROY = 3
30 };
31 
32 enum rpc_gss_svc {
33 	RPC_GSS_SVC_NONE = 1,
34 	RPC_GSS_SVC_INTEGRITY = 2,
35 	RPC_GSS_SVC_PRIVACY = 3
36 };
37 
38 /* on-the-wire gss cred: */
39 struct rpc_gss_wire_cred {
40 	u32			gc_v;		/* version */
41 	u32			gc_proc;	/* control procedure */
42 	u32			gc_seq;		/* sequence number */
43 	u32			gc_svc;		/* service */
44 	struct xdr_netobj	gc_ctx;		/* context handle */
45 };
46 
47 /* on-the-wire gss verifier: */
48 struct rpc_gss_wire_verf {
49 	u32			gv_flavor;
50 	struct xdr_netobj	gv_verf;
51 };
52 
53 /* return from gss NULL PROC init sec context */
54 struct rpc_gss_init_res {
55 	struct xdr_netobj	gr_ctx;		/* context handle */
56 	u32			gr_major;	/* major status */
57 	u32			gr_minor;	/* minor status */
58 	u32			gr_win;		/* sequence window */
59 	struct xdr_netobj	gr_token;	/* token */
60 };
61 
62 /* The gss_cl_ctx struct holds all the information the rpcsec_gss client
63  * code needs to know about a single security context.  In particular,
64  * gc_gss_ctx is the context handle that is used to do gss-api calls, while
65  * gc_wire_ctx is the context handle that is used to identify the context on
66  * the wire when communicating with a server. */
67 
68 struct gss_cl_ctx {
69 	refcount_t		count;
70 	enum rpc_gss_proc	gc_proc;
71 	u32			gc_seq;
72 	spinlock_t		gc_seq_lock;
73 	struct gss_ctx		*gc_gss_ctx;
74 	struct xdr_netobj	gc_wire_ctx;
75 	struct xdr_netobj	gc_acceptor;
76 	u32			gc_win;
77 	unsigned long		gc_expiry;
78 	struct rcu_head		gc_rcu;
79 };
80 
81 struct gss_upcall_msg;
82 struct gss_cred {
83 	struct rpc_cred		gc_base;
84 	enum rpc_gss_svc	gc_service;
85 	struct gss_cl_ctx __rcu	*gc_ctx;
86 	struct gss_upcall_msg	*gc_upcall;
87 	const char		*gc_principal;
88 	unsigned long		gc_upcall_timestamp;
89 };
90 
91 #endif /* __KERNEL__ */
92 #endif /* _LINUX_SUNRPC_AUTH_GSS_H */
93 
94