blob: 8eee9dbbfe7aaddbdb5aaebfbaf5ad82669f846d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Uwe Zeisbergerf30c2262006-10-03 23:01:26 +02002 * linux/include/linux/sunrpc/auth_gss.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
4 * Declarations for RPCSEC_GSS
5 *
6 * Dug Song <dugsong@monkey.org>
7 * Andy Adamson <andros@umich.edu>
8 * Bruce Fields <bfields@umich.edu>
9 * Copyright (c) 2000 The Regents of the University of Michigan
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 */
11
12#ifndef _LINUX_SUNRPC_AUTH_GSS_H
13#define _LINUX_SUNRPC_AUTH_GSS_H
14
15#ifdef __KERNEL__
16#include <linux/sunrpc/auth.h>
17#include <linux/sunrpc/svc.h>
18#include <linux/sunrpc/gss_api.h>
19
20#define RPC_GSS_VERSION 1
21
22#define MAXSEQ 0x80000000 /* maximum legal sequence number, from rfc 2203 */
23
24enum rpc_gss_proc {
25 RPC_GSS_PROC_DATA = 0,
26 RPC_GSS_PROC_INIT = 1,
27 RPC_GSS_PROC_CONTINUE_INIT = 2,
28 RPC_GSS_PROC_DESTROY = 3
29};
30
31enum rpc_gss_svc {
32 RPC_GSS_SVC_NONE = 1,
33 RPC_GSS_SVC_INTEGRITY = 2,
34 RPC_GSS_SVC_PRIVACY = 3
35};
36
37/* on-the-wire gss cred: */
38struct rpc_gss_wire_cred {
39 u32 gc_v; /* version */
40 u32 gc_proc; /* control procedure */
41 u32 gc_seq; /* sequence number */
42 u32 gc_svc; /* service */
43 struct xdr_netobj gc_ctx; /* context handle */
44};
45
46/* on-the-wire gss verifier: */
47struct rpc_gss_wire_verf {
48 u32 gv_flavor;
49 struct xdr_netobj gv_verf;
50};
51
52/* return from gss NULL PROC init sec context */
53struct rpc_gss_init_res {
54 struct xdr_netobj gr_ctx; /* context handle */
55 u32 gr_major; /* major status */
56 u32 gr_minor; /* minor status */
57 u32 gr_win; /* sequence window */
58 struct xdr_netobj gr_token; /* token */
59};
60
61/* The gss_cl_ctx struct holds all the information the rpcsec_gss client
62 * code needs to know about a single security context. In particular,
63 * gc_gss_ctx is the context handle that is used to do gss-api calls, while
64 * gc_wire_ctx is the context handle that is used to identify the context on
65 * the wire when communicating with a server. */
66
67struct gss_cl_ctx {
68 atomic_t count;
69 enum rpc_gss_proc gc_proc;
70 u32 gc_seq;
71 spinlock_t gc_seq_lock;
Arnd Bergmann5b222162010-03-03 10:20:10 +010072 struct gss_ctx __rcu *gc_gss_ctx;
Linus Torvalds1da177e2005-04-16 15:20:36 -070073 struct xdr_netobj gc_wire_ctx;
74 u32 gc_win;
75 unsigned long gc_expiry;
Trond Myklebust5d28dc82007-06-26 19:18:38 -040076 struct rcu_head gc_rcu;
Linus Torvalds1da177e2005-04-16 15:20:36 -070077};
78
79struct gss_upcall_msg;
80struct gss_cred {
81 struct rpc_cred gc_base;
82 enum rpc_gss_svc gc_service;
Arnd Bergmann5b222162010-03-03 10:20:10 +010083 struct gss_cl_ctx __rcu *gc_ctx;
Linus Torvalds1da177e2005-04-16 15:20:36 -070084 struct gss_upcall_msg *gc_upcall;
Trond Myklebust126e2162010-05-13 12:55:38 -040085 unsigned long gc_upcall_timestamp;
Trond Myklebust7c67db32008-04-07 20:50:11 -040086 unsigned char gc_machine_cred : 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087};
88
Linus Torvalds1da177e2005-04-16 15:20:36 -070089#endif /* __KERNEL__ */
90#endif /* _LINUX_SUNRPC_AUTH_GSS_H */
91