2 * linux/include/linux/sunrpc/gss_api.h
4 * Somewhat simplified version of the gss api.
9 * Copyright (c) 2000 The Regents of the University of Michigan
12 #ifndef _LINUX_SUNRPC_GSS_API_H
13 #define _LINUX_SUNRPC_GSS_API_H
16 #include <linux/sunrpc/xdr.h>
17 #include <linux/sunrpc/msg_prot.h>
18 #include <linux/uio.h>
20 /* The mechanism-independent gss-api context: */
22 struct gss_api_mech *mech_type;
23 void *internal_ctx_id;
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)
30 /*XXX arbitrary length - is this set somewhere? */
31 #define GSS_OID_MAX_LEN 32
32 struct rpcsec_gss_oid {
34 u8 data[GSS_OID_MAX_LEN];
38 struct rpcsec_gss_info {
39 struct rpcsec_gss_oid oid;
44 /* gss-api prototypes; note that these are somewhat simplified versions of
45 * the prototypes specified in RFC 2744. */
46 int gss_import_sec_context(
47 const void* input_token,
49 struct gss_api_mech *mech,
50 struct gss_ctx **ctx_id,
53 struct gss_ctx *ctx_id,
54 struct xdr_buf *message,
55 struct xdr_netobj *mic_token);
57 struct gss_ctx *ctx_id,
58 struct xdr_buf *message,
59 struct xdr_netobj *mic_token);
61 struct gss_ctx *ctx_id,
63 struct xdr_buf *outbuf,
64 struct page **inpages);
66 struct gss_ctx *ctx_id,
68 struct xdr_buf *inbuf);
69 u32 gss_delete_sec_context(
70 struct gss_ctx **ctx_id);
72 rpc_authflavor_t gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 qop,
74 u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);
75 char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);
82 char *auth_domain_name;
85 /* Different mechanisms (e.g., krb5 or spkm3) may implement gss-api, and
86 * mechanisms may be dynamically registered or unregistered by modules. */
88 /* Each mechanism is described by the following struct: */
90 struct list_head gm_list;
91 struct module *gm_owner;
92 struct rpcsec_gss_oid gm_oid;
94 const struct gss_api_ops *gm_ops;
95 /* pseudoflavors supported by this mechanism: */
97 struct pf_desc * gm_pfs;
98 /* Should the following be a callback operation instead? */
99 const char *gm_upcall_enctypes;
102 /* and must provide the following operations: */
104 int (*gss_import_sec_context)(
105 const void *input_token,
107 struct gss_ctx *ctx_id,
110 struct gss_ctx *ctx_id,
111 struct xdr_buf *message,
112 struct xdr_netobj *mic_token);
113 u32 (*gss_verify_mic)(
114 struct gss_ctx *ctx_id,
115 struct xdr_buf *message,
116 struct xdr_netobj *mic_token);
118 struct gss_ctx *ctx_id,
120 struct xdr_buf *outbuf,
121 struct page **inpages);
123 struct gss_ctx *ctx_id,
125 struct xdr_buf *buf);
126 void (*gss_delete_sec_context)(
127 void *internal_ctx_id);
130 int gss_mech_register(struct gss_api_mech *);
131 void gss_mech_unregister(struct gss_api_mech *);
133 /* Given a GSS security tuple, look up a pseudoflavor */
134 rpc_authflavor_t gss_mech_info2flavor(struct rpcsec_gss_info *);
136 /* Given a pseudoflavor, look up a GSS security tuple */
137 int gss_mech_flavor2info(rpc_authflavor_t, struct rpcsec_gss_info *);
139 /* Returns a reference to a mechanism, given a name like "krb5" etc. */
140 struct gss_api_mech *gss_mech_get_by_name(const char *);
142 /* Similar, but get by pseudoflavor. */
143 struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
145 /* Fill in an array with a list of supported pseudoflavors */
146 int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int);
148 /* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
149 * corresponding call to gss_mech_put. */
150 void gss_mech_put(struct gss_api_mech *);
152 #endif /* __KERNEL__ */
153 #endif /* _LINUX_SUNRPC_GSS_API_H */