2005-04-17 05:20:36 +07:00
|
|
|
/*
|
2006-10-04 04:01:26 +07:00
|
|
|
* linux/include/linux/sunrpc/gss_api.h
|
2005-04-17 05:20:36 +07:00
|
|
|
*
|
|
|
|
* Somewhat simplified version of the gss api.
|
|
|
|
*
|
|
|
|
* Dug Song <dugsong@monkey.org>
|
|
|
|
* Andy Adamson <andros@umich.edu>
|
|
|
|
* Bruce Fields <bfields@umich.edu>
|
|
|
|
* Copyright (c) 2000 The Regents of the University of Michigan
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LINUX_SUNRPC_GSS_API_H
|
|
|
|
#define _LINUX_SUNRPC_GSS_API_H
|
|
|
|
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
#include <linux/sunrpc/xdr.h>
|
2012-07-12 03:31:08 +07:00
|
|
|
#include <linux/sunrpc/msg_prot.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <linux/uio.h>
|
|
|
|
|
|
|
|
/* The mechanism-independent gss-api context: */
|
|
|
|
struct gss_ctx {
|
|
|
|
struct gss_api_mech *mech_type;
|
|
|
|
void *internal_ctx_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define GSS_C_NO_BUFFER ((struct xdr_netobj) 0)
|
|
|
|
#define GSS_C_NO_CONTEXT ((struct gss_ctx *) 0)
|
2013-03-17 02:55:01 +07:00
|
|
|
#define GSS_C_QOP_DEFAULT (0)
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/*XXX arbitrary length - is this set somewhere? */
|
|
|
|
#define GSS_OID_MAX_LEN 32
|
2013-03-17 02:54:34 +07:00
|
|
|
struct rpcsec_gss_oid {
|
|
|
|
unsigned int len;
|
|
|
|
u8 data[GSS_OID_MAX_LEN];
|
|
|
|
};
|
|
|
|
|
|
|
|
/* From RFC 3530 */
|
|
|
|
struct rpcsec_gss_info {
|
|
|
|
struct rpcsec_gss_oid oid;
|
|
|
|
u32 qop;
|
|
|
|
u32 service;
|
|
|
|
};
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* gss-api prototypes; note that these are somewhat simplified versions of
|
|
|
|
* the prototypes specified in RFC 2744. */
|
|
|
|
int gss_import_sec_context(
|
|
|
|
const void* input_token,
|
|
|
|
size_t bufsize,
|
|
|
|
struct gss_api_mech *mech,
|
2010-05-13 23:51:02 +07:00
|
|
|
struct gss_ctx **ctx_id,
|
2012-05-26 05:09:53 +07:00
|
|
|
time_t *endtime,
|
2010-05-13 23:51:02 +07:00
|
|
|
gfp_t gfp_mask);
|
2005-04-17 05:20:36 +07:00
|
|
|
u32 gss_get_mic(
|
|
|
|
struct gss_ctx *ctx_id,
|
|
|
|
struct xdr_buf *message,
|
|
|
|
struct xdr_netobj *mic_token);
|
|
|
|
u32 gss_verify_mic(
|
|
|
|
struct gss_ctx *ctx_id,
|
|
|
|
struct xdr_buf *message,
|
2005-10-14 03:55:18 +07:00
|
|
|
struct xdr_netobj *mic_token);
|
2005-10-14 03:54:37 +07:00
|
|
|
u32 gss_wrap(
|
|
|
|
struct gss_ctx *ctx_id,
|
|
|
|
int offset,
|
|
|
|
struct xdr_buf *outbuf,
|
|
|
|
struct page **inpages);
|
|
|
|
u32 gss_unwrap(
|
|
|
|
struct gss_ctx *ctx_id,
|
|
|
|
int offset,
|
|
|
|
struct xdr_buf *inbuf);
|
2005-04-17 05:20:36 +07:00
|
|
|
u32 gss_delete_sec_context(
|
|
|
|
struct gss_ctx **ctx_id);
|
|
|
|
|
2013-03-17 02:55:01 +07:00
|
|
|
rpc_authflavor_t gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 qop,
|
|
|
|
u32 service);
|
2005-04-17 05:20:36 +07:00
|
|
|
u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);
|
2016-06-30 00:55:06 +07:00
|
|
|
bool gss_pseudoflavor_to_datatouch(struct gss_api_mech *, u32 pseudoflavor);
|
2005-04-17 05:20:36 +07:00
|
|
|
char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);
|
|
|
|
|
|
|
|
struct pf_desc {
|
|
|
|
u32 pseudoflavor;
|
2013-03-17 02:55:01 +07:00
|
|
|
u32 qop;
|
2005-04-17 05:20:36 +07:00
|
|
|
u32 service;
|
|
|
|
char *name;
|
|
|
|
char *auth_domain_name;
|
2016-06-30 00:55:06 +07:00
|
|
|
bool datatouch;
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Different mechanisms (e.g., krb5 or spkm3) may implement gss-api, and
|
|
|
|
* mechanisms may be dynamically registered or unregistered by modules. */
|
|
|
|
|
|
|
|
/* Each mechanism is described by the following struct: */
|
|
|
|
struct gss_api_mech {
|
|
|
|
struct list_head gm_list;
|
|
|
|
struct module *gm_owner;
|
2013-03-17 02:54:34 +07:00
|
|
|
struct rpcsec_gss_oid gm_oid;
|
2005-04-17 05:20:36 +07:00
|
|
|
char *gm_name;
|
2007-06-24 07:17:58 +07:00
|
|
|
const struct gss_api_ops *gm_ops;
|
2005-04-17 05:20:36 +07:00
|
|
|
/* pseudoflavors supported by this mechanism: */
|
|
|
|
int gm_pf_num;
|
|
|
|
struct pf_desc * gm_pfs;
|
2010-04-09 01:09:58 +07:00
|
|
|
/* Should the following be a callback operation instead? */
|
|
|
|
const char *gm_upcall_enctypes;
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/* and must provide the following operations: */
|
|
|
|
struct gss_api_ops {
|
|
|
|
int (*gss_import_sec_context)(
|
|
|
|
const void *input_token,
|
|
|
|
size_t bufsize,
|
2010-05-13 23:51:02 +07:00
|
|
|
struct gss_ctx *ctx_id,
|
2012-05-26 05:09:53 +07:00
|
|
|
time_t *endtime,
|
2010-05-13 23:51:02 +07:00
|
|
|
gfp_t gfp_mask);
|
2005-04-17 05:20:36 +07:00
|
|
|
u32 (*gss_get_mic)(
|
|
|
|
struct gss_ctx *ctx_id,
|
|
|
|
struct xdr_buf *message,
|
|
|
|
struct xdr_netobj *mic_token);
|
|
|
|
u32 (*gss_verify_mic)(
|
|
|
|
struct gss_ctx *ctx_id,
|
|
|
|
struct xdr_buf *message,
|
2005-10-14 03:55:18 +07:00
|
|
|
struct xdr_netobj *mic_token);
|
2005-10-14 03:54:37 +07:00
|
|
|
u32 (*gss_wrap)(
|
|
|
|
struct gss_ctx *ctx_id,
|
|
|
|
int offset,
|
|
|
|
struct xdr_buf *outbuf,
|
|
|
|
struct page **inpages);
|
|
|
|
u32 (*gss_unwrap)(
|
|
|
|
struct gss_ctx *ctx_id,
|
|
|
|
int offset,
|
|
|
|
struct xdr_buf *buf);
|
2005-04-17 05:20:36 +07:00
|
|
|
void (*gss_delete_sec_context)(
|
|
|
|
void *internal_ctx_id);
|
|
|
|
};
|
|
|
|
|
|
|
|
int gss_mech_register(struct gss_api_mech *);
|
|
|
|
void gss_mech_unregister(struct gss_api_mech *);
|
|
|
|
|
|
|
|
/* returns a mechanism descriptor given an OID, and increments the mechanism's
|
|
|
|
* reference count. */
|
2013-04-30 01:03:30 +07:00
|
|
|
struct gss_api_mech * gss_mech_get_by_OID(struct rpcsec_gss_oid *);
|
|
|
|
|
2013-03-17 02:54:43 +07:00
|
|
|
/* Given a GSS security tuple, look up a pseudoflavor */
|
|
|
|
rpc_authflavor_t gss_mech_info2flavor(struct rpcsec_gss_info *);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2013-03-17 02:55:10 +07:00
|
|
|
/* Given a pseudoflavor, look up a GSS security tuple */
|
|
|
|
int gss_mech_flavor2info(rpc_authflavor_t, struct rpcsec_gss_info *);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Returns a reference to a mechanism, given a name like "krb5" etc. */
|
|
|
|
struct gss_api_mech *gss_mech_get_by_name(const char *);
|
|
|
|
|
|
|
|
/* Similar, but get by pseudoflavor. */
|
|
|
|
struct gss_api_mech *gss_mech_get_by_pseudoflavor(u32);
|
|
|
|
|
2011-03-25 00:12:31 +07:00
|
|
|
/* Fill in an array with a list of supported pseudoflavors */
|
2012-07-12 03:31:08 +07:00
|
|
|
int gss_mech_list_pseudoflavors(rpc_authflavor_t *, int);
|
2011-03-25 00:12:31 +07:00
|
|
|
|
2013-05-15 03:07:13 +07:00
|
|
|
struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
|
|
|
|
|
2006-06-26 23:35:02 +07:00
|
|
|
/* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
|
2005-04-17 05:20:36 +07:00
|
|
|
* corresponding call to gss_mech_put. */
|
|
|
|
void gss_mech_put(struct gss_api_mech *);
|
|
|
|
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
#endif /* _LINUX_SUNRPC_GSS_API_H */
|
|
|
|
|