~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/sunrpc/gss_api.h

Version: ~ [ linux-5.17-rc1 ] ~ [ linux-5.16.2 ] ~ [ linux-5.15.16 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.93 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.173 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.225 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.262 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.297 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.299 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * linux/include/linux/sunrpc/gss_api.h
  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
 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 /* 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_QOP_DEFAULT       (0)
 29 
 30 /*XXX  arbitrary length - is this set somewhere? */
 31 #define GSS_OID_MAX_LEN 32
 32 struct rpcsec_gss_oid {
 33         unsigned int    len;
 34         u8              data[GSS_OID_MAX_LEN];
 35 };
 36 
 37 /* From RFC 3530 */
 38 struct rpcsec_gss_info {
 39         struct rpcsec_gss_oid   oid;
 40         u32                     qop;
 41         u32                     service;
 42 };
 43 
 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,
 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);
 53 u32 gss_get_mic(
 54                 struct gss_ctx          *ctx_id,
 55                 struct xdr_buf          *message,
 56                 struct xdr_netobj       *mic_token);
 57 u32 gss_verify_mic(
 58                 struct gss_ctx          *ctx_id,
 59                 struct xdr_buf          *message,
 60                 struct xdr_netobj       *mic_token);
 61 u32 gss_wrap(
 62                 struct gss_ctx          *ctx_id,
 63                 int                     offset,
 64                 struct xdr_buf          *outbuf,
 65                 struct page             **inpages);
 66 u32 gss_unwrap(
 67                 struct gss_ctx          *ctx_id,
 68                 int                     offset,
 69                 struct xdr_buf          *inbuf);
 70 u32 gss_delete_sec_context(
 71                 struct gss_ctx          **ctx_id);
 72 
 73 rpc_authflavor_t gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 qop,
 74                                         u32 service);
 75 u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);
 76 bool gss_pseudoflavor_to_datatouch(struct gss_api_mech *, u32 pseudoflavor);
 77 char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);
 78 
 79 struct pf_desc {
 80         u32     pseudoflavor;
 81         u32     qop;
 82         u32     service;
 83         char    *name;
 84         char    *auth_domain_name;
 85         bool    datatouch;
 86 };
 87 
 88 /* Different mechanisms (e.g., krb5 or spkm3) may implement gss-api, and
 89  * mechanisms may be dynamically registered or unregistered by modules. */
 90 
 91 /* Each mechanism is described by the following struct: */
 92 struct gss_api_mech {
 93         struct list_head        gm_list;
 94         struct module           *gm_owner;
 95         struct rpcsec_gss_oid   gm_oid;
 96         char                    *gm_name;
 97         const struct gss_api_ops *gm_ops;
 98         /* pseudoflavors supported by this mechanism: */
 99         int                     gm_pf_num;
100         struct pf_desc *        gm_pfs;
101         /* Should the following be a callback operation instead? */
102         const char              *gm_upcall_enctypes;
103 };
104 
105 /* and must provide the following operations: */
106 struct gss_api_ops {
107         int (*gss_import_sec_context)(
108                         const void              *input_token,
109                         size_t                  bufsize,
110                         struct gss_ctx          *ctx_id,
111                         time_t                  *endtime,
112                         gfp_t                   gfp_mask);
113         u32 (*gss_get_mic)(
114                         struct gss_ctx          *ctx_id,
115                         struct xdr_buf          *message,
116                         struct xdr_netobj       *mic_token);
117         u32 (*gss_verify_mic)(
118                         struct gss_ctx          *ctx_id,
119                         struct xdr_buf          *message,
120                         struct xdr_netobj       *mic_token);
121         u32 (*gss_wrap)(
122                         struct gss_ctx          *ctx_id,
123                         int                     offset,
124                         struct xdr_buf          *outbuf,
125                         struct page             **inpages);
126         u32 (*gss_unwrap)(
127                         struct gss_ctx          *ctx_id,
128                         int                     offset,
129                         struct xdr_buf          *buf);
130         void (*gss_delete_sec_context)(
131                         void                    *internal_ctx_id);
132 };
133 
134 int gss_mech_register(struct gss_api_mech *);
135 void gss_mech_unregister(struct gss_api_mech *);
136 
137 /* returns a mechanism descriptor given an OID, and increments the mechanism's
138  * reference count. */
139 struct gss_api_mech * gss_mech_get_by_OID(struct rpcsec_gss_oid *);
140 
141 /* Given a GSS security tuple, look up a pseudoflavor */
142 rpc_authflavor_t gss_mech_info2flavor(struct rpcsec_gss_info *);
143 
144 /* Given a pseudoflavor, look up a GSS security tuple */
145 int gss_mech_flavor2info(rpc_authflavor_t, struct rpcsec_gss_info *);
146 
147 /* Returns a reference to a mechanism, given a name like "krb5" etc. */
148 struct gss_api_mech *gss_mech_get_by_name(const char *);
149 
150 /* Similar, but get by pseudoflavor. */
151 struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
152 
153 /* Fill in an array with a list of supported pseudoflavors */
154 int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int);
155 
156 struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
157 
158 /* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
159  * corresponding call to gss_mech_put. */
160 void gss_mech_put(struct gss_api_mech *);
161 
162 #endif /* __KERNEL__ */
163 #endif /* _LINUX_SUNRPC_GSS_API_H */
164 
165 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp