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

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

Version: ~ [ linux-5.16 ] ~ [ linux-5.15.13 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.90 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.170 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.224 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.261 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.296 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.298 ] ~ [ 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 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*
  3  * linux/include/linux/sunrpc/gss_api.h
  4  *
  5  * Somewhat simplified version of the gss api.
  6  *
  7  * Dug Song <dugsong@monkey.org>
  8  * Andy Adamson <andros@umich.edu>
  9  * Bruce Fields <bfields@umich.edu>
 10  * Copyright (c) 2000 The Regents of the University of Michigan
 11  */
 12 
 13 #ifndef _LINUX_SUNRPC_GSS_API_H
 14 #define _LINUX_SUNRPC_GSS_API_H
 15 
 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         unsigned int            slack, align;
 25 };
 26 
 27 #define GSS_C_NO_BUFFER         ((struct xdr_netobj) 0)
 28 #define GSS_C_NO_CONTEXT        ((struct gss_ctx *) 0)
 29 #define GSS_C_QOP_DEFAULT       (0)
 30 
 31 /*XXX  arbitrary length - is this set somewhere? */
 32 #define GSS_OID_MAX_LEN 32
 33 struct rpcsec_gss_oid {
 34         unsigned int    len;
 35         u8              data[GSS_OID_MAX_LEN];
 36 };
 37 
 38 /* From RFC 3530 */
 39 struct rpcsec_gss_info {
 40         struct rpcsec_gss_oid   oid;
 41         u32                     qop;
 42         u32                     service;
 43 };
 44 
 45 /* gss-api prototypes; note that these are somewhat simplified versions of
 46  * the prototypes specified in RFC 2744. */
 47 int gss_import_sec_context(
 48                 const void*             input_token,
 49                 size_t                  bufsize,
 50                 struct gss_api_mech     *mech,
 51                 struct gss_ctx          **ctx_id,
 52                 time64_t                *endtime,
 53                 gfp_t                   gfp_mask);
 54 u32 gss_get_mic(
 55                 struct gss_ctx          *ctx_id,
 56                 struct xdr_buf          *message,
 57                 struct xdr_netobj       *mic_token);
 58 u32 gss_verify_mic(
 59                 struct gss_ctx          *ctx_id,
 60                 struct xdr_buf          *message,
 61                 struct xdr_netobj       *mic_token);
 62 u32 gss_wrap(
 63                 struct gss_ctx          *ctx_id,
 64                 int                     offset,
 65                 struct xdr_buf          *outbuf,
 66                 struct page             **inpages);
 67 u32 gss_unwrap(
 68                 struct gss_ctx          *ctx_id,
 69                 int                     offset,
 70                 int                     len,
 71                 struct xdr_buf          *inbuf);
 72 u32 gss_delete_sec_context(
 73                 struct gss_ctx          **ctx_id);
 74 
 75 rpc_authflavor_t gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 qop,
 76                                         u32 service);
 77 u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);
 78 bool gss_pseudoflavor_to_datatouch(struct gss_api_mech *, u32 pseudoflavor);
 79 char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);
 80 
 81 struct pf_desc {
 82         u32     pseudoflavor;
 83         u32     qop;
 84         u32     service;
 85         char    *name;
 86         char    *auth_domain_name;
 87         bool    datatouch;
 88 };
 89 
 90 /* Different mechanisms (e.g., krb5 or spkm3) may implement gss-api, and
 91  * mechanisms may be dynamically registered or unregistered by modules. */
 92 
 93 /* Each mechanism is described by the following struct: */
 94 struct gss_api_mech {
 95         struct list_head        gm_list;
 96         struct module           *gm_owner;
 97         struct rpcsec_gss_oid   gm_oid;
 98         char                    *gm_name;
 99         const struct gss_api_ops *gm_ops;
100         /* pseudoflavors supported by this mechanism: */
101         int                     gm_pf_num;
102         struct pf_desc *        gm_pfs;
103         /* Should the following be a callback operation instead? */
104         const char              *gm_upcall_enctypes;
105 };
106 
107 /* and must provide the following operations: */
108 struct gss_api_ops {
109         int (*gss_import_sec_context)(
110                         const void              *input_token,
111                         size_t                  bufsize,
112                         struct gss_ctx          *ctx_id,
113                         time64_t                *endtime,
114                         gfp_t                   gfp_mask);
115         u32 (*gss_get_mic)(
116                         struct gss_ctx          *ctx_id,
117                         struct xdr_buf          *message,
118                         struct xdr_netobj       *mic_token);
119         u32 (*gss_verify_mic)(
120                         struct gss_ctx          *ctx_id,
121                         struct xdr_buf          *message,
122                         struct xdr_netobj       *mic_token);
123         u32 (*gss_wrap)(
124                         struct gss_ctx          *ctx_id,
125                         int                     offset,
126                         struct xdr_buf          *outbuf,
127                         struct page             **inpages);
128         u32 (*gss_unwrap)(
129                         struct gss_ctx          *ctx_id,
130                         int                     offset,
131                         int                     len,
132                         struct xdr_buf          *buf);
133         void (*gss_delete_sec_context)(
134                         void                    *internal_ctx_id);
135 };
136 
137 int gss_mech_register(struct gss_api_mech *);
138 void gss_mech_unregister(struct gss_api_mech *);
139 
140 /* returns a mechanism descriptor given an OID, and increments the mechanism's
141  * reference count. */
142 struct gss_api_mech * gss_mech_get_by_OID(struct rpcsec_gss_oid *);
143 
144 /* Given a GSS security tuple, look up a pseudoflavor */
145 rpc_authflavor_t gss_mech_info2flavor(struct rpcsec_gss_info *);
146 
147 /* Given a pseudoflavor, look up a GSS security tuple */
148 int gss_mech_flavor2info(rpc_authflavor_t, struct rpcsec_gss_info *);
149 
150 /* Returns a reference to a mechanism, given a name like "krb5" etc. */
151 struct gss_api_mech *gss_mech_get_by_name(const char *);
152 
153 /* Similar, but get by pseudoflavor. */
154 struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
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 /* _LINUX_SUNRPC_GSS_API_H */
163 
164 

~ [ 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