]>
Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
f30c2269 | 2 | * linux/include/linux/sunrpc/gss_api.h |
1da177e4 LT |
3 | * |
4 | * Somewhat simplified version of the gss api. | |
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 | |
1da177e4 LT |
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> | |
6a1a1e34 | 17 | #include <linux/sunrpc/msg_prot.h> |
1da177e4 LT |
18 | #include <linux/uio.h> |
19 | ||
20 | /* The mechanism-independent gss-api context: */ | |
21 | struct 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_NULL_OID ((struct xdr_netobj) 0) | |
29 | ||
30 | /*XXX arbitrary length - is this set somewhere? */ | |
31 | #define GSS_OID_MAX_LEN 32 | |
32 | ||
33 | /* gss-api prototypes; note that these are somewhat simplified versions of | |
34 | * the prototypes specified in RFC 2744. */ | |
35 | int gss_import_sec_context( | |
36 | const void* input_token, | |
37 | size_t bufsize, | |
38 | struct gss_api_mech *mech, | |
1f4c86c0 | 39 | struct gss_ctx **ctx_id, |
400f26b5 | 40 | time_t *endtime, |
1f4c86c0 | 41 | gfp_t gfp_mask); |
1da177e4 LT |
42 | u32 gss_get_mic( |
43 | struct gss_ctx *ctx_id, | |
1da177e4 LT |
44 | struct xdr_buf *message, |
45 | struct xdr_netobj *mic_token); | |
46 | u32 gss_verify_mic( | |
47 | struct gss_ctx *ctx_id, | |
48 | struct xdr_buf *message, | |
00fd6e14 | 49 | struct xdr_netobj *mic_token); |
293f1eb5 BF |
50 | u32 gss_wrap( |
51 | struct gss_ctx *ctx_id, | |
293f1eb5 BF |
52 | int offset, |
53 | struct xdr_buf *outbuf, | |
54 | struct page **inpages); | |
55 | u32 gss_unwrap( | |
56 | struct gss_ctx *ctx_id, | |
293f1eb5 BF |
57 | int offset, |
58 | struct xdr_buf *inbuf); | |
1da177e4 LT |
59 | u32 gss_delete_sec_context( |
60 | struct gss_ctx **ctx_id); | |
61 | ||
c4170583 | 62 | u32 gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 service); |
1da177e4 LT |
63 | u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor); |
64 | char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service); | |
65 | ||
66 | struct pf_desc { | |
67 | u32 pseudoflavor; | |
1da177e4 LT |
68 | u32 service; |
69 | char *name; | |
70 | char *auth_domain_name; | |
71 | }; | |
72 | ||
73 | /* Different mechanisms (e.g., krb5 or spkm3) may implement gss-api, and | |
74 | * mechanisms may be dynamically registered or unregistered by modules. */ | |
75 | ||
76 | /* Each mechanism is described by the following struct: */ | |
77 | struct gss_api_mech { | |
78 | struct list_head gm_list; | |
79 | struct module *gm_owner; | |
80 | struct xdr_netobj gm_oid; | |
81 | char *gm_name; | |
f1c0a861 | 82 | const struct gss_api_ops *gm_ops; |
1da177e4 LT |
83 | /* pseudoflavors supported by this mechanism: */ |
84 | int gm_pf_num; | |
85 | struct pf_desc * gm_pfs; | |
683ac665 TM |
86 | /* Should the following be a callback operation instead? */ |
87 | const char *gm_upcall_enctypes; | |
1da177e4 LT |
88 | }; |
89 | ||
90 | /* and must provide the following operations: */ | |
91 | struct gss_api_ops { | |
92 | int (*gss_import_sec_context)( | |
93 | const void *input_token, | |
94 | size_t bufsize, | |
1f4c86c0 | 95 | struct gss_ctx *ctx_id, |
400f26b5 | 96 | time_t *endtime, |
1f4c86c0 | 97 | gfp_t gfp_mask); |
1da177e4 LT |
98 | u32 (*gss_get_mic)( |
99 | struct gss_ctx *ctx_id, | |
1da177e4 LT |
100 | struct xdr_buf *message, |
101 | struct xdr_netobj *mic_token); | |
102 | u32 (*gss_verify_mic)( | |
103 | struct gss_ctx *ctx_id, | |
104 | struct xdr_buf *message, | |
00fd6e14 | 105 | struct xdr_netobj *mic_token); |
293f1eb5 BF |
106 | u32 (*gss_wrap)( |
107 | struct gss_ctx *ctx_id, | |
293f1eb5 BF |
108 | int offset, |
109 | struct xdr_buf *outbuf, | |
110 | struct page **inpages); | |
111 | u32 (*gss_unwrap)( | |
112 | struct gss_ctx *ctx_id, | |
293f1eb5 BF |
113 | int offset, |
114 | struct xdr_buf *buf); | |
1da177e4 LT |
115 | void (*gss_delete_sec_context)( |
116 | void *internal_ctx_id); | |
117 | }; | |
118 | ||
119 | int gss_mech_register(struct gss_api_mech *); | |
120 | void gss_mech_unregister(struct gss_api_mech *); | |
121 | ||
122 | /* returns a mechanism descriptor given an OID, and increments the mechanism's | |
123 | * reference count. */ | |
124 | struct gss_api_mech * gss_mech_get_by_OID(struct xdr_netobj *); | |
125 | ||
126 | /* Returns a reference to a mechanism, given a name like "krb5" etc. */ | |
127 | struct gss_api_mech *gss_mech_get_by_name(const char *); | |
128 | ||
129 | /* Similar, but get by pseudoflavor. */ | |
130 | struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32); | |
131 | ||
8f70e95f | 132 | /* Fill in an array with a list of supported pseudoflavors */ |
6a1a1e34 | 133 | int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int); |
8f70e95f | 134 | |
1da177e4 LT |
135 | /* Just increments the mechanism's reference count and returns its input: */ |
136 | struct gss_api_mech * gss_mech_get(struct gss_api_mech *); | |
137 | ||
d6e05edc | 138 | /* For every successful gss_mech_get or gss_mech_get_by_* call there must be a |
1da177e4 LT |
139 | * corresponding call to gss_mech_put. */ |
140 | void gss_mech_put(struct gss_api_mech *); | |
141 | ||
142 | #endif /* __KERNEL__ */ | |
143 | #endif /* _LINUX_SUNRPC_GSS_API_H */ | |
144 |