blob: 0c9eac351aabab4364be9f3dcc3f6a0bd57fc3d0 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Uwe Zeisbergerf30c2262006-10-03 23:01:26 +02003 * linux/include/linux/sunrpc/auth_gss.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
5 * Declarations for RPCSEC_GSS
6 *
7 * Dug Song <dugsong@monkey.org>
8 * Andy Adamson <andros@umich.edu>
9 * Bruce Fields <bfields@umich.edu>
10 * Copyright (c) 2000 The Regents of the University of Michigan
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
13#ifndef _LINUX_SUNRPC_AUTH_GSS_H
14#define _LINUX_SUNRPC_AUTH_GSS_H
15
16#ifdef __KERNEL__
Reshetova, Elena0fa10472017-07-04 15:53:13 +030017#include <linux/refcount.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <linux/sunrpc/auth.h>
19#include <linux/sunrpc/svc.h>
20#include <linux/sunrpc/gss_api.h>
21
22#define RPC_GSS_VERSION 1
23
24#define MAXSEQ 0x80000000 /* maximum legal sequence number, from rfc 2203 */
25
26enum rpc_gss_proc {
27 RPC_GSS_PROC_DATA = 0,
28 RPC_GSS_PROC_INIT = 1,
29 RPC_GSS_PROC_CONTINUE_INIT = 2,
30 RPC_GSS_PROC_DESTROY = 3
31};
32
33enum rpc_gss_svc {
34 RPC_GSS_SVC_NONE = 1,
35 RPC_GSS_SVC_INTEGRITY = 2,
36 RPC_GSS_SVC_PRIVACY = 3
37};
38
39/* on-the-wire gss cred: */
40struct rpc_gss_wire_cred {
41 u32 gc_v; /* version */
42 u32 gc_proc; /* control procedure */
43 u32 gc_seq; /* sequence number */
44 u32 gc_svc; /* service */
45 struct xdr_netobj gc_ctx; /* context handle */
46};
47
48/* on-the-wire gss verifier: */
49struct rpc_gss_wire_verf {
50 u32 gv_flavor;
51 struct xdr_netobj gv_verf;
52};
53
54/* return from gss NULL PROC init sec context */
55struct rpc_gss_init_res {
56 struct xdr_netobj gr_ctx; /* context handle */
57 u32 gr_major; /* major status */
58 u32 gr_minor; /* minor status */
59 u32 gr_win; /* sequence window */
60 struct xdr_netobj gr_token; /* token */
61};
62
63/* The gss_cl_ctx struct holds all the information the rpcsec_gss client
64 * code needs to know about a single security context. In particular,
65 * gc_gss_ctx is the context handle that is used to do gss-api calls, while
66 * gc_wire_ctx is the context handle that is used to identify the context on
67 * the wire when communicating with a server. */
68
69struct gss_cl_ctx {
Reshetova, Elena0fa10472017-07-04 15:53:13 +030070 refcount_t count;
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 enum rpc_gss_proc gc_proc;
72 u32 gc_seq;
73 spinlock_t gc_seq_lock;
Jeff Laytona3b25572014-07-16 06:52:18 -040074 struct gss_ctx *gc_gss_ctx;
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 struct xdr_netobj gc_wire_ctx;
Jeff Layton2004c722014-06-21 20:52:15 -040076 struct xdr_netobj gc_acceptor;
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 u32 gc_win;
78 unsigned long gc_expiry;
Trond Myklebust5d28dc82007-06-26 19:18:38 -040079 struct rcu_head gc_rcu;
Linus Torvalds1da177e2005-04-16 15:20:36 -070080};
81
82struct gss_upcall_msg;
83struct gss_cred {
84 struct rpc_cred gc_base;
85 enum rpc_gss_svc gc_service;
Arnd Bergmann5b222162010-03-03 10:20:10 +010086 struct gss_cl_ctx __rcu *gc_ctx;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 struct gss_upcall_msg *gc_upcall;
Trond Myklebust68c97152012-01-03 13:22:46 -050088 const char *gc_principal;
Trond Myklebust126e2162010-05-13 12:55:38 -040089 unsigned long gc_upcall_timestamp;
Linus Torvalds1da177e2005-04-16 15:20:36 -070090};
91
Linus Torvalds1da177e2005-04-16 15:20:36 -070092#endif /* __KERNEL__ */
93#endif /* _LINUX_SUNRPC_AUTH_GSS_H */
94