2 * linux/include/linux/gss_api.h
4 * Somewhat simplified version of the gss api.
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
14 #ifndef _LINUX_SUNRPC_GSS_API_H
15 #define _LINUX_SUNRPC_GSS_API_H
18 #include <linux/sunrpc/xdr.h>
19 #include <linux/uio.h>
21 /* The mechanism-independent gss-api context: */
23 struct gss_api_mech *mech_type;
24 void *internal_ctx_id;
27 #define GSS_C_NO_BUFFER ((struct xdr_netobj) 0)
28 #define GSS_C_NO_CONTEXT ((struct gss_ctx *) 0)
29 #define GSS_C_NULL_OID ((struct xdr_netobj) 0)
31 /*XXX arbitrary length - is this set somewhere? */
32 #define GSS_OID_MAX_LEN 32
34 /* gss-api prototypes; note that these are somewhat simplified versions of
35 * the prototypes specified in RFC 2744. */
36 u32 gss_import_sec_context(
37 struct xdr_netobj *input_token,
38 struct gss_api_mech *mech,
39 struct gss_ctx **ctx_id);
41 struct gss_ctx *ctx_id,
43 struct xdr_buf *message,
44 struct xdr_netobj *mic_token);
46 struct gss_ctx *ctx_id,
47 struct xdr_buf *message,
48 struct xdr_netobj *mic_token,
50 u32 gss_delete_sec_context(
51 struct gss_ctx **ctx_id);
53 /* We maintain a list of the pseudoflavors (equivalently, mechanism-qop-service
54 * triples) that we currently support: */
56 struct sup_sec_triple {
57 struct list_head triples;
59 struct gss_api_mech *mech;
64 int gss_register_triple(u32 pseudoflavor, struct gss_api_mech *mech, u32 qop,
66 int gss_unregister_triple(u32 pseudoflavor);
67 int gss_pseudoflavor_supported(u32 pseudoflavor);
68 u32 gss_cmp_triples(u32 oid_len, char *oid_data, u32 qop, u32 service);
69 u32 gss_get_pseudoflavor(struct gss_ctx *ctx_id, u32 qop, u32 service);
70 u32 gss_pseudoflavor_to_service(u32 pseudoflavor);
71 /* Both return NULL on failure: */
72 struct gss_api_mech * gss_pseudoflavor_to_mech(u32 pseudoflavor);
73 int gss_pseudoflavor_to_mechOID(u32 pseudoflavor, struct xdr_netobj *mech);
75 /* Different mechanisms (e.g., krb5 or spkm3) may implement gss-api, and
76 * mechanisms may be dynamically registered or unregistered by modules.
77 * Our only built-in mechanism is a trivial debugging mechanism that provides
78 * no actual security; the following function registers that mechanism: */
80 void gss_mech_register_debug(void);
82 /* Each mechanism is described by the following struct: */
84 struct xdr_netobj gm_oid;
85 struct list_head gm_list;
87 struct gss_api_ops *gm_ops;
90 /* and must provide the following operations: */
93 u32 (*gss_import_sec_context)(
94 struct xdr_netobj *input_token,
95 struct gss_ctx *ctx_id);
97 struct gss_ctx *ctx_id,
99 struct xdr_buf *message,
100 struct xdr_netobj *mic_token);
101 u32 (*gss_verify_mic)(
102 struct gss_ctx *ctx_id,
103 struct xdr_buf *message,
104 struct xdr_netobj *mic_token,
106 void (*gss_delete_sec_context)(
107 void *internal_ctx_id);
110 /* Returns nonzero on failure. */
111 int gss_mech_register(struct xdr_netobj *, struct gss_api_ops *);
113 /* Returns nonzero iff someone still has a reference to this mech. */
114 int gss_mech_unregister(struct gss_api_mech *);
116 /* Returns nonzer iff someone still has a reference to some mech. */
117 int gss_mech_unregister_all(void);
119 /* returns a mechanism descriptor given an OID, an increments the mechanism's
120 * reference count. */
121 struct gss_api_mech * gss_mech_get_by_OID(struct xdr_netobj *);
123 /* Similar, but get by name like "krb5", "spkm", etc., instead of OID. */
124 struct gss_api_mech *gss_mech_get_by_name(char *);
126 /* Just increments the mechanism's reference count and returns its input: */
127 struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
129 /* Returns nonzero iff you've released the last reference to this mech.
130 * Note that for every succesful gss_get_mech call there must be exactly
131 * one corresponding call to gss_mech_put.*/
132 int gss_mech_put(struct gss_api_mech *);
134 #endif /* __KERNEL__ */
135 #endif /* _LINUX_SUNRPC_GSS_API_H */