Blame view

include/linux/sunrpc/gss_api.h 3.93 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
f30c22695   Uwe Zeisberger   fix file specific...
2
   * linux/include/linux/sunrpc/gss_api.h
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
3
4
5
6
7
8
9
   *
   * 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
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
   */
  
  #ifndef _LINUX_SUNRPC_GSS_API_H
  #define _LINUX_SUNRPC_GSS_API_H
  
  #ifdef __KERNEL__
  #include <linux/sunrpc/xdr.h>
  #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)
  #define GSS_C_NULL_OID		((struct xdr_netobj) 0)
  
  /*XXX  arbitrary length - is this set somewhere? */
  #define GSS_OID_MAX_LEN 32
  
  /* 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,
1f4c86c0b   Trond Myklebust   NFS: Don't use GF...
38
39
  		struct gss_ctx		**ctx_id,
  		gfp_t			gfp_mask);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
40
41
  u32 gss_get_mic(
  		struct gss_ctx		*ctx_id,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
42
43
44
45
46
  		struct xdr_buf		*message,
  		struct xdr_netobj	*mic_token);
  u32 gss_verify_mic(
  		struct gss_ctx		*ctx_id,
  		struct xdr_buf		*message,
00fd6e142   J. Bruce Fields   RPCSEC_GSS remove...
47
  		struct xdr_netobj	*mic_token);
293f1eb55   J. Bruce Fields   SUNRPC: Add suppo...
48
49
  u32 gss_wrap(
  		struct gss_ctx		*ctx_id,
293f1eb55   J. Bruce Fields   SUNRPC: Add suppo...
50
51
52
53
54
  		int			offset,
  		struct xdr_buf		*outbuf,
  		struct page		**inpages);
  u32 gss_unwrap(
  		struct gss_ctx		*ctx_id,
293f1eb55   J. Bruce Fields   SUNRPC: Add suppo...
55
56
  		int			offset,
  		struct xdr_buf		*inbuf);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
57
58
  u32 gss_delete_sec_context(
  		struct gss_ctx		**ctx_id);
c4170583f   Andy Adamson   knfsd: nfsd4: sto...
59
  u32 gss_svc_to_pseudoflavor(struct gss_api_mech *, u32 service);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
61
62
63
64
  u32 gss_pseudoflavor_to_service(struct gss_api_mech *, u32 pseudoflavor);
  char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service);
  
  struct pf_desc {
  	u32	pseudoflavor;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
65
66
67
68
69
70
71
72
73
74
75
76
77
78
  	u32	service;
  	char	*name;
  	char	*auth_domain_name;
  };
  
  /* 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;
  	struct xdr_netobj	gm_oid;
  	char			*gm_name;
f1c0a8615   Trond Myklebust   SUNRPC: Mark auth...
79
  	const struct gss_api_ops *gm_ops;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
80
81
82
  	/* pseudoflavors supported by this mechanism: */
  	int			gm_pf_num;
  	struct pf_desc *	gm_pfs;
683ac6656   Trond Myklebust   gss_krb5: Add upc...
83
84
  	/* Should the following be a callback operation instead? */
  	const char		*gm_upcall_enctypes;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
85
86
87
88
89
90
91
  };
  
  /* and must provide the following operations: */
  struct gss_api_ops {
  	int (*gss_import_sec_context)(
  			const void		*input_token,
  			size_t			bufsize,
1f4c86c0b   Trond Myklebust   NFS: Don't use GF...
92
93
  			struct gss_ctx		*ctx_id,
  			gfp_t			gfp_mask);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
94
95
  	u32 (*gss_get_mic)(
  			struct gss_ctx		*ctx_id,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
96
97
98
99
100
  			struct xdr_buf		*message,
  			struct xdr_netobj	*mic_token);
  	u32 (*gss_verify_mic)(
  			struct gss_ctx		*ctx_id,
  			struct xdr_buf		*message,
00fd6e142   J. Bruce Fields   RPCSEC_GSS remove...
101
  			struct xdr_netobj	*mic_token);
293f1eb55   J. Bruce Fields   SUNRPC: Add suppo...
102
103
  	u32 (*gss_wrap)(
  			struct gss_ctx		*ctx_id,
293f1eb55   J. Bruce Fields   SUNRPC: Add suppo...
104
105
106
107
108
  			int			offset,
  			struct xdr_buf		*outbuf,
  			struct page		**inpages);
  	u32 (*gss_unwrap)(
  			struct gss_ctx		*ctx_id,
293f1eb55   J. Bruce Fields   SUNRPC: Add suppo...
109
110
  			int			offset,
  			struct xdr_buf		*buf);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
  	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. */
  struct gss_api_mech * gss_mech_get_by_OID(struct xdr_netobj *);
  
  /* 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);
8f70e95f9   Bryan Schumaker   NFS: Determine in...
127
128
  /* Fill in an array with a list of supported pseudoflavors */
  int gss_mech_list_pseudoflavors(u32 *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
129
130
  /* Just increments the mechanism's reference count and returns its input: */
  struct gss_api_mech * gss_mech_get(struct gss_api_mech *);
d6e05edc5   Andreas Mohr   spelling fixes
131
  /* For every successful gss_mech_get or gss_mech_get_by_* call there must be a
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
132
133
134
135
136
   * corresponding call to gss_mech_put. */
  void gss_mech_put(struct gss_api_mech *);
  
  #endif /* __KERNEL__ */
  #endif /* _LINUX_SUNRPC_GSS_API_H */