1
2
3
4
5
6
7
8
9
10
11
12#ifndef _LINUX_SUNRPC_GSS_API_H
13#define _LINUX_SUNRPC_GSS_API_H
14
15#ifdef __KERNEL__
16#include <linux/sunrpc/xdr.h>
17#include <linux/sunrpc/msg_prot.h>
18#include <linux/uio.h>
19
20
21struct gss_ctx {
22 struct gss_api_mech *mech_type;
23 void *internal_ctx_id;
24};
25
26#define GSS_C_NO_BUFFER ((struct xdr_netobj) 0)
27#define GSS_C_NO_CONTEXT ((struct gss_ctx *) 0)
28#define GSS_C_QOP_DEFAULT (0)
29
30
31#define GSS_OID_MAX_LEN 32
32struct rpcsec_gss_oid {
33 unsigned int len;
34 u8 data[GSS_OID_MAX_LEN];
35};
36
37
38struct rpcsec_gss_info {
39 struct rpcsec_gss_oid oid;
40 u32 qop;
41 u32 service;
42};
43
44
45
46int gss_import_sec_context(
47 const void* input_token,
48 size_t bufsize,
49 struct gss_api_mech *mech,
50 struct gss_ctx **ctx_id,
51 time_t *endtime,
52 gfp_t gfp_mask);
53u32 gss_get_mic(
54 struct gss_ctx *ctx_id,
55 struct xdr_buf *message,
56 struct xdr_netobj *mic_token);
57u32 gss_verify_mic(
58 struct gss_ctx *ctx_id,
59 struct xdr_buf *message,
60 struct xdr_netobj *mic_token);
61u32 gss_wrap(
62 struct gss_ctx *ctx_id,
63 int offset,
64 struct xdr_buf *outbuf,
65 struct page **inpages);
66u32 gss_unwrap(
67 struct gss_ctx *ctx_id,
68 int offset,
69 struct xdr_buf *inbuf);
70u32 gss_delete_sec_context(
71 struct gss_ctx **ctx_id);
72
73rpc_authflavor_t gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 qop,
74 u32 service);
75u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);
76char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);
77
78struct pf_desc {
79 u32 pseudoflavor;
80 u32 qop;
81 u32 service;
82 char *name;
83 char *auth_domain_name;
84};
85
86
87
88
89
90struct gss_api_mech {
91 struct list_head gm_list;
92 struct module *gm_owner;
93 struct rpcsec_gss_oid gm_oid;
94 char *gm_name;
95 const struct gss_api_ops *gm_ops;
96
97 int gm_pf_num;
98 struct pf_desc * gm_pfs;
99
100 const char *gm_upcall_enctypes;
101};
102
103
104struct gss_api_ops {
105 int (*gss_import_sec_context)(
106 const void *input_token,
107 size_t bufsize,
108 struct gss_ctx *ctx_id,
109 time_t *endtime,
110 gfp_t gfp_mask);
111 u32 (*gss_get_mic)(
112 struct gss_ctx *ctx_id,
113 struct xdr_buf *message,
114 struct xdr_netobj *mic_token);
115 u32 (*gss_verify_mic)(
116 struct gss_ctx *ctx_id,
117 struct xdr_buf *message,
118 struct xdr_netobj *mic_token);
119 u32 (*gss_wrap)(
120 struct gss_ctx *ctx_id,
121 int offset,
122 struct xdr_buf *outbuf,
123 struct page **inpages);
124 u32 (*gss_unwrap)(
125 struct gss_ctx *ctx_id,
126 int offset,
127 struct xdr_buf *buf);
128 void (*gss_delete_sec_context)(
129 void *internal_ctx_id);
130};
131
132int gss_mech_register(struct gss_api_mech *);
133void gss_mech_unregister(struct gss_api_mech *);
134
135
136
137struct gss_api_mech * gss_mech_get_by_OID(struct rpcsec_gss_oid *);
138
139
140rpc_authflavor_t gss_mech_info2flavor(struct rpcsec_gss_info *);
141
142
143int gss_mech_flavor2info(rpc_authflavor_t, struct rpcsec_gss_info *);
144
145
146struct gss_api_mech *gss_mech_get_by_name(const char *);
147
148
149struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
150
151
152int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int);
153
154struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
155
156
157
158void gss_mech_put(struct gss_api_mech *);
159
160#endif
161#endif
162
163