07c4b36325d307f93054fdae5a8eb9cd8e028725
[ira/wip.git] / source4 / heimdal / lib / gssapi / gssapi / gssapi.h
1 /*
2  * Copyright (c) 1997 - 2007 Kungliga Tekniska Högskolan
3  * (Royal Institute of Technology, Stockholm, Sweden).
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the Institute nor the names of its contributors
18  *    may be used to endorse or promote products derived from this software
19  *    without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33
34 /* $Id$ */
35
36 #ifndef GSSAPI_GSSAPI_H_
37 #define GSSAPI_GSSAPI_H_
38
39 /*
40  * First, include stddef.h to get size_t defined.
41  */
42 #include <stddef.h>
43
44 #include <krb5-types.h>
45
46 #ifndef BUILD_GSSAPI_LIB
47 #if defined(_WIN32)
48 #define GSSAPI_LIB_FUNCTION _stdcall __declspec(dllimport)
49 #define GSSAPI_LIB_VARIABLE __declspec(dllimport)
50 #else
51 #define GSSAPI_LIB_FUNCTION
52 #define GSSAPI_LIB_VARIABLE
53 #endif
54 #endif
55
56 #ifndef GSSAPI_DEPRECATED
57 #define GSSAPI_DEPRECATED __attribute__((deprecated))
58 #endif
59
60 /*
61  * Now define the three implementation-dependent types.
62  */
63
64 typedef uint32_t OM_uint32;
65 typedef uint64_t OM_uint64;
66
67 typedef uint32_t gss_uint32;
68
69 struct gss_name_t_desc_struct;
70 typedef struct gss_name_t_desc_struct *gss_name_t;
71
72 struct gss_ctx_id_t_desc_struct;
73 typedef struct gss_ctx_id_t_desc_struct *gss_ctx_id_t;
74
75 typedef struct gss_OID_desc_struct {
76       OM_uint32 length;
77       void      *elements;
78 } gss_OID_desc, *gss_OID;
79
80 typedef struct gss_OID_set_desc_struct  {
81       size_t     count;
82       gss_OID    elements;
83 } gss_OID_set_desc, *gss_OID_set;
84
85 typedef int gss_cred_usage_t;
86
87 struct gss_cred_id_t_desc_struct;
88 typedef struct gss_cred_id_t_desc_struct *gss_cred_id_t;
89
90 typedef struct gss_buffer_desc_struct {
91       size_t length;
92       void *value;
93 } gss_buffer_desc, *gss_buffer_t;
94
95 typedef struct gss_channel_bindings_struct {
96       OM_uint32 initiator_addrtype;
97       gss_buffer_desc initiator_address;
98       OM_uint32 acceptor_addrtype;
99       gss_buffer_desc acceptor_address;
100       gss_buffer_desc application_data;
101 } *gss_channel_bindings_t;
102
103 /* GGF extension data types */
104 typedef struct gss_buffer_set_desc_struct {
105       size_t count;
106       gss_buffer_desc *elements;
107 } gss_buffer_set_desc, *gss_buffer_set_t;
108
109 typedef struct gss_iov_buffer_desc_struct {
110     OM_uint32 type;
111     gss_buffer_desc buffer;
112 } gss_iov_buffer_desc, *gss_iov_buffer_t;
113
114 /*
115  * For now, define a QOP-type as an OM_uint32
116  */
117 typedef OM_uint32 gss_qop_t;
118
119 /*
120  * Flag bits for context-level services.
121  */
122 #define GSS_C_DELEG_FLAG 1
123 #define GSS_C_MUTUAL_FLAG 2
124 #define GSS_C_REPLAY_FLAG 4
125 #define GSS_C_SEQUENCE_FLAG 8
126 #define GSS_C_CONF_FLAG 16
127 #define GSS_C_INTEG_FLAG 32
128 #define GSS_C_ANON_FLAG 64
129 #define GSS_C_PROT_READY_FLAG 128
130 #define GSS_C_TRANS_FLAG 256
131
132 #define GSS_C_DCE_STYLE 4096
133 #define GSS_C_IDENTIFY_FLAG 8192
134 #define GSS_C_EXTENDED_ERROR_FLAG 16384
135 #define GSS_C_DELEG_POLICY_FLAG 32768
136
137 /*
138  * Credential usage options
139  */
140 #define GSS_C_BOTH 0
141 #define GSS_C_INITIATE 1
142 #define GSS_C_ACCEPT 2
143
144 /*
145  * Status code types for gss_display_status
146  */
147 #define GSS_C_GSS_CODE 1
148 #define GSS_C_MECH_CODE 2
149
150 /*
151  * The constant definitions for channel-bindings address families
152  */
153 #define GSS_C_AF_UNSPEC     0
154 #define GSS_C_AF_LOCAL      1
155 #define GSS_C_AF_INET       2
156 #define GSS_C_AF_IMPLINK    3
157 #define GSS_C_AF_PUP        4
158 #define GSS_C_AF_CHAOS      5
159 #define GSS_C_AF_NS         6
160 #define GSS_C_AF_NBS        7
161 #define GSS_C_AF_ECMA       8
162 #define GSS_C_AF_DATAKIT    9
163 #define GSS_C_AF_CCITT      10
164 #define GSS_C_AF_SNA        11
165 #define GSS_C_AF_DECnet     12
166 #define GSS_C_AF_DLI        13
167 #define GSS_C_AF_LAT        14
168 #define GSS_C_AF_HYLINK     15
169 #define GSS_C_AF_APPLETALK  16
170 #define GSS_C_AF_BSC        17
171 #define GSS_C_AF_DSS        18
172 #define GSS_C_AF_OSI        19
173 #define GSS_C_AF_X25        21
174 #define GSS_C_AF_INET6      24
175
176 #define GSS_C_AF_NULLADDR   255
177
178 /*
179  * Various Null values
180  */
181 #define GSS_C_NO_NAME ((gss_name_t) 0)
182 #define GSS_C_NO_BUFFER ((gss_buffer_t) 0)
183 #define GSS_C_NO_BUFFER_SET ((gss_buffer_set_t) 0)
184 #define GSS_C_NO_OID ((gss_OID) 0)
185 #define GSS_C_NO_OID_SET ((gss_OID_set) 0)
186 #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
187 #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
188 #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
189 #define GSS_C_EMPTY_BUFFER {0, NULL}
190 #define GSS_C_NO_IOV_BUFFER ((gss_iov_buffer_t)0)
191
192 /*
193  * Some alternate names for a couple of the above
194  * values.  These are defined for V1 compatibility.
195  */
196 #define GSS_C_NULL_OID GSS_C_NO_OID
197 #define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET
198
199 /*
200  * Define the default Quality of Protection for per-message
201  * services.  Note that an implementation that offers multiple
202  * levels of QOP may define GSS_C_QOP_DEFAULT to be either zero
203  * (as done here) to mean "default protection", or to a specific
204  * explicit QOP value.  However, a value of 0 should always be
205  * interpreted by a GSSAPI implementation as a request for the
206  * default protection level.
207  */
208 #define GSS_C_QOP_DEFAULT 0
209
210 #define GSS_KRB5_CONF_C_QOP_DES         0x0100
211 #define GSS_KRB5_CONF_C_QOP_DES3_KD     0x0200
212
213 /*
214  * Expiration time of 2^32-1 seconds means infinite lifetime for a
215  * credential or security context
216  */
217 #define GSS_C_INDEFINITE 0xfffffffful
218
219 /*
220  * Type of gss_wrap_iov()/gss_unwrap_iov().
221  */
222
223 #define GSS_IOV_BUFFER_TYPE_EMPTY 0
224 #define GSS_IOV_BUFFER_TYPE_DATA 1
225 #define GSS_IOV_BUFFER_TYPE_HEADER 2
226 #define GSS_IOV_BUFFER_TYPE_MECH_PARAMS 3
227
228 #define GSS_IOV_BUFFER_TYPE_TRAILER 7
229 #define GSS_IOV_BUFFER_TYPE_PADDING 9
230 #define GSS_IOV_BUFFER_TYPE_STREAM 10
231 #define GSS_IOV_BUFFER_TYPE_SIGN_ONLY 11
232
233 #define GSS_IOV_BUFFER_TYPE_FLAG_MASK 0xffff0000
234 #define GSS_IOV_BUFFER_TYPE_FLAG_ALLOCATE 0x00010000
235 #define GSS_IOV_BUFFER_TYPE_FLAG_ALLOCATED 0x00020000
236
237 #define GSS_IOV_BUFFER_TYPE(_t) ((_t) & ~GSS_IOV_BUFFER_TYPE_FLAG_MASK)
238 #define GSS_IOV_BUFFER_FLAGS(_t) ((_t) & GSS_IOV_BUFFER_TYPE_FLAG_MASK)
239
240 #ifdef __cplusplus
241 extern "C" {
242 #endif
243
244 /*
245  * The implementation must reserve static storage for a
246  * gss_OID_desc object containing the value
247  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
248  *              "\x01\x02\x01\x01"},
249  * corresponding to an object-identifier value of
250  * {iso(1) member-body(2) United States(840) mit(113554)
251  *  infosys(1) gssapi(2) generic(1) user_name(1)}.  The constant
252  * GSS_C_NT_USER_NAME should be initialized to point
253  * to that gss_OID_desc.
254  */
255 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_USER_NAME;
256
257 /*
258  * The implementation must reserve static storage for a
259  * gss_OID_desc object containing the value
260  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
261  *              "\x01\x02\x01\x02"},
262  * corresponding to an object-identifier value of
263  * {iso(1) member-body(2) United States(840) mit(113554)
264  *  infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.
265  * The constant GSS_C_NT_MACHINE_UID_NAME should be
266  * initialized to point to that gss_OID_desc.
267  */
268 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_MACHINE_UID_NAME;
269
270 /*
271  * The implementation must reserve static storage for a
272  * gss_OID_desc object containing the value
273  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
274  *              "\x01\x02\x01\x03"},
275  * corresponding to an object-identifier value of
276  * {iso(1) member-body(2) United States(840) mit(113554)
277  *  infosys(1) gssapi(2) generic(1) string_uid_name(3)}.
278  * The constant GSS_C_NT_STRING_UID_NAME should be
279  * initialized to point to that gss_OID_desc.
280  */
281 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_STRING_UID_NAME;
282
283 /*
284  * The implementation must reserve static storage for a
285  * gss_OID_desc object containing the value
286  * {6, (void *)"\x2b\x06\x01\x05\x06\x02"},
287  * corresponding to an object-identifier value of
288  * {iso(1) org(3) dod(6) internet(1) security(5)
289  * nametypes(6) gss-host-based-services(2)).  The constant
290  * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point
291  * to that gss_OID_desc.  This is a deprecated OID value, and
292  * implementations wishing to support hostbased-service names
293  * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,
294  * defined below, to identify such names;
295  * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym
296  * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input
297  * parameter, but should not be emitted by GSS-API
298  * implementations
299  */
300 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_HOSTBASED_SERVICE_X;
301
302 /*
303  * The implementation must reserve static storage for a
304  * gss_OID_desc object containing the value
305  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
306  *              "\x01\x02\x01\x04"}, corresponding to an
307  * object-identifier value of {iso(1) member-body(2)
308  * Unites States(840) mit(113554) infosys(1) gssapi(2)
309  * generic(1) service_name(4)}.  The constant
310  * GSS_C_NT_HOSTBASED_SERVICE should be initialized
311  * to point to that gss_OID_desc.
312  */
313 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_HOSTBASED_SERVICE;
314
315 /*
316  * The implementation must reserve static storage for a
317  * gss_OID_desc object containing the value
318  * {6, (void *)"\x2b\x06\01\x05\x06\x03"},
319  * corresponding to an object identifier value of
320  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
321  * 6(nametypes), 3(gss-anonymous-name)}.  The constant
322  * and GSS_C_NT_ANONYMOUS should be initialized to point
323  * to that gss_OID_desc.
324  */
325 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_ANONYMOUS;
326
327 /*
328  * The implementation must reserve static storage for a
329  * gss_OID_desc object containing the value
330  * {6, (void *)"\x2b\x06\x01\x05\x06\x04"},
331  * corresponding to an object-identifier value of
332  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
333  * 6(nametypes), 4(gss-api-exported-name)}.  The constant
334  * GSS_C_NT_EXPORT_NAME should be initialized to point
335  * to that gss_OID_desc.
336  */
337 extern GSSAPI_LIB_VARIABLE gss_OID GSS_C_NT_EXPORT_NAME;
338
339 /*
340  * Digest mechanism
341  */
342
343 extern GSSAPI_LIB_VARIABLE gss_OID GSS_SASL_DIGEST_MD5_MECHANISM;
344
345 /* Major status codes */
346
347 #define GSS_S_COMPLETE 0
348
349 /*
350  * Some "helper" definitions to make the status code macros obvious.
351  */
352 #define GSS_C_CALLING_ERROR_OFFSET 24
353 #define GSS_C_ROUTINE_ERROR_OFFSET 16
354 #define GSS_C_SUPPLEMENTARY_OFFSET 0
355 #define GSS_C_CALLING_ERROR_MASK 0377ul
356 #define GSS_C_ROUTINE_ERROR_MASK 0377ul
357 #define GSS_C_SUPPLEMENTARY_MASK 0177777ul
358
359 /*
360  * The macros that test status codes for error conditions.
361  * Note that the GSS_ERROR() macro has changed slightly from
362  * the V1 GSSAPI so that it now evaluates its argument
363  * only once.
364  */
365 #define GSS_CALLING_ERROR(x) \
366   (x & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
367 #define GSS_ROUTINE_ERROR(x) \
368   (x & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
369 #define GSS_SUPPLEMENTARY_INFO(x) \
370   (x & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
371 #define GSS_ERROR(x) \
372   (x & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \
373         (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))
374
375 /*
376  * Now the actual status code definitions
377  */
378
379 /*
380  * Calling errors:
381  */
382 #define GSS_S_CALL_INACCESSIBLE_READ \
383                              (1ul << GSS_C_CALLING_ERROR_OFFSET)
384 #define GSS_S_CALL_INACCESSIBLE_WRITE \
385                              (2ul << GSS_C_CALLING_ERROR_OFFSET)
386 #define GSS_S_CALL_BAD_STRUCTURE \
387                              (3ul << GSS_C_CALLING_ERROR_OFFSET)
388
389 /*
390  * Routine errors:
391  */
392 #define GSS_S_BAD_MECH (1ul << GSS_C_ROUTINE_ERROR_OFFSET)
393 #define GSS_S_BAD_NAME (2ul << GSS_C_ROUTINE_ERROR_OFFSET)
394 #define GSS_S_BAD_NAMETYPE (3ul << GSS_C_ROUTINE_ERROR_OFFSET)
395
396 #define GSS_S_BAD_BINDINGS (4ul << GSS_C_ROUTINE_ERROR_OFFSET)
397 #define GSS_S_BAD_STATUS (5ul << GSS_C_ROUTINE_ERROR_OFFSET)
398 #define GSS_S_BAD_SIG (6ul << GSS_C_ROUTINE_ERROR_OFFSET)
399 #define GSS_S_BAD_MIC GSS_S_BAD_SIG
400 #define GSS_S_NO_CRED (7ul << GSS_C_ROUTINE_ERROR_OFFSET)
401 #define GSS_S_NO_CONTEXT (8ul << GSS_C_ROUTINE_ERROR_OFFSET)
402 #define GSS_S_DEFECTIVE_TOKEN (9ul << GSS_C_ROUTINE_ERROR_OFFSET)
403 #define GSS_S_DEFECTIVE_CREDENTIAL (10ul << GSS_C_ROUTINE_ERROR_OFFSET)
404 #define GSS_S_CREDENTIALS_EXPIRED (11ul << GSS_C_ROUTINE_ERROR_OFFSET)
405 #define GSS_S_CONTEXT_EXPIRED (12ul << GSS_C_ROUTINE_ERROR_OFFSET)
406 #define GSS_S_FAILURE (13ul << GSS_C_ROUTINE_ERROR_OFFSET)
407 #define GSS_S_BAD_QOP (14ul << GSS_C_ROUTINE_ERROR_OFFSET)
408 #define GSS_S_UNAUTHORIZED (15ul << GSS_C_ROUTINE_ERROR_OFFSET)
409 #define GSS_S_UNAVAILABLE (16ul << GSS_C_ROUTINE_ERROR_OFFSET)
410 #define GSS_S_DUPLICATE_ELEMENT (17ul << GSS_C_ROUTINE_ERROR_OFFSET)
411 #define GSS_S_NAME_NOT_MN (18ul << GSS_C_ROUTINE_ERROR_OFFSET)
412
413 /*
414  * Supplementary info bits:
415  */
416 #define GSS_S_CONTINUE_NEEDED (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
417 #define GSS_S_DUPLICATE_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
418 #define GSS_S_OLD_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
419 #define GSS_S_UNSEQ_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 3))
420 #define GSS_S_GAP_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 4))
421
422 /*
423  * Finally, function prototypes for the GSS-API routines.
424  */
425
426 OM_uint32 GSSAPI_LIB_FUNCTION gss_acquire_cred
427            (OM_uint32 * /*minor_status*/,
428             const gss_name_t /*desired_name*/,
429             OM_uint32 /*time_req*/,
430             const gss_OID_set /*desired_mechs*/,
431             gss_cred_usage_t /*cred_usage*/,
432             gss_cred_id_t * /*output_cred_handle*/,
433             gss_OID_set * /*actual_mechs*/,
434             OM_uint32 * /*time_rec*/
435            );
436
437 OM_uint32 GSSAPI_LIB_FUNCTION gss_release_cred
438            (OM_uint32 * /*minor_status*/,
439             gss_cred_id_t * /*cred_handle*/
440            );
441
442 OM_uint32 GSSAPI_LIB_FUNCTION gss_init_sec_context
443            (OM_uint32 * /*minor_status*/,
444             const gss_cred_id_t /*initiator_cred_handle*/,
445             gss_ctx_id_t * /*context_handle*/,
446             const gss_name_t /*target_name*/,
447             const gss_OID /*mech_type*/,
448             OM_uint32 /*req_flags*/,
449             OM_uint32 /*time_req*/,
450             const gss_channel_bindings_t /*input_chan_bindings*/,
451             const gss_buffer_t /*input_token*/,
452             gss_OID * /*actual_mech_type*/,
453             gss_buffer_t /*output_token*/,
454             OM_uint32 * /*ret_flags*/,
455             OM_uint32 * /*time_rec*/
456            );
457
458 OM_uint32 GSSAPI_LIB_FUNCTION gss_accept_sec_context
459            (OM_uint32 * /*minor_status*/,
460             gss_ctx_id_t * /*context_handle*/,
461             const gss_cred_id_t /*acceptor_cred_handle*/,
462             const gss_buffer_t /*input_token_buffer*/,
463             const gss_channel_bindings_t /*input_chan_bindings*/,
464             gss_name_t * /*src_name*/,
465             gss_OID * /*mech_type*/,
466             gss_buffer_t /*output_token*/,
467             OM_uint32 * /*ret_flags*/,
468             OM_uint32 * /*time_rec*/,
469             gss_cred_id_t * /*delegated_cred_handle*/
470            );
471
472 OM_uint32 GSSAPI_LIB_FUNCTION gss_process_context_token
473            (OM_uint32 * /*minor_status*/,
474             const gss_ctx_id_t /*context_handle*/,
475             const gss_buffer_t /*token_buffer*/
476            );
477
478 OM_uint32 GSSAPI_LIB_FUNCTION gss_delete_sec_context
479            (OM_uint32 * /*minor_status*/,
480             gss_ctx_id_t * /*context_handle*/,
481             gss_buffer_t /*output_token*/
482            );
483
484 OM_uint32 GSSAPI_LIB_FUNCTION gss_context_time
485            (OM_uint32 * /*minor_status*/,
486             const gss_ctx_id_t /*context_handle*/,
487             OM_uint32 * /*time_rec*/
488            );
489
490 OM_uint32 GSSAPI_LIB_FUNCTION gss_get_mic
491            (OM_uint32 * /*minor_status*/,
492             const gss_ctx_id_t /*context_handle*/,
493             gss_qop_t /*qop_req*/,
494             const gss_buffer_t /*message_buffer*/,
495             gss_buffer_t /*message_token*/
496            );
497
498 OM_uint32 GSSAPI_LIB_FUNCTION gss_verify_mic
499            (OM_uint32 * /*minor_status*/,
500             const gss_ctx_id_t /*context_handle*/,
501             const gss_buffer_t /*message_buffer*/,
502             const gss_buffer_t /*token_buffer*/,
503             gss_qop_t * /*qop_state*/
504            );
505
506 OM_uint32 GSSAPI_LIB_FUNCTION gss_wrap
507            (OM_uint32 * /*minor_status*/,
508             const gss_ctx_id_t /*context_handle*/,
509             int /*conf_req_flag*/,
510             gss_qop_t /*qop_req*/,
511             const gss_buffer_t /*input_message_buffer*/,
512             int * /*conf_state*/,
513             gss_buffer_t /*output_message_buffer*/
514            );
515
516 OM_uint32 GSSAPI_LIB_FUNCTION gss_unwrap
517            (OM_uint32 * /*minor_status*/,
518             const gss_ctx_id_t /*context_handle*/,
519             const gss_buffer_t /*input_message_buffer*/,
520             gss_buffer_t /*output_message_buffer*/,
521             int * /*conf_state*/,
522             gss_qop_t * /*qop_state*/
523            );
524
525 OM_uint32 GSSAPI_LIB_FUNCTION gss_display_status
526            (OM_uint32 * /*minor_status*/,
527             OM_uint32 /*status_value*/,
528             int /*status_type*/,
529             const gss_OID /*mech_type*/,
530             OM_uint32 * /*message_context*/,
531             gss_buffer_t /*status_string*/
532            );
533
534 OM_uint32 GSSAPI_LIB_FUNCTION gss_indicate_mechs
535            (OM_uint32 * /*minor_status*/,
536             gss_OID_set * /*mech_set*/
537            );
538
539 OM_uint32 GSSAPI_LIB_FUNCTION gss_compare_name
540            (OM_uint32 * /*minor_status*/,
541             const gss_name_t /*name1*/,
542             const gss_name_t /*name2*/,
543             int * /*name_equal*/
544            );
545
546 OM_uint32 GSSAPI_LIB_FUNCTION gss_display_name
547            (OM_uint32 * /*minor_status*/,
548             const gss_name_t /*input_name*/,
549             gss_buffer_t /*output_name_buffer*/,
550             gss_OID * /*output_name_type*/
551            );
552
553 OM_uint32 GSSAPI_LIB_FUNCTION gss_import_name
554            (OM_uint32 * /*minor_status*/,
555             const gss_buffer_t /*input_name_buffer*/,
556             const gss_OID /*input_name_type*/,
557             gss_name_t * /*output_name*/
558            );
559
560 OM_uint32 GSSAPI_LIB_FUNCTION gss_export_name
561            (OM_uint32  * /*minor_status*/,
562             const gss_name_t /*input_name*/,
563             gss_buffer_t /*exported_name*/
564            );
565
566 OM_uint32 GSSAPI_LIB_FUNCTION gss_release_name
567            (OM_uint32 * /*minor_status*/,
568             gss_name_t * /*input_name*/
569            );
570
571 OM_uint32 GSSAPI_LIB_FUNCTION gss_release_buffer
572            (OM_uint32 * /*minor_status*/,
573             gss_buffer_t /*buffer*/
574            );
575
576 OM_uint32 GSSAPI_LIB_FUNCTION gss_release_oid_set
577            (OM_uint32 * /*minor_status*/,
578             gss_OID_set * /*set*/
579            );
580
581 OM_uint32 GSSAPI_LIB_FUNCTION gss_inquire_cred
582            (OM_uint32 * /*minor_status*/,
583             const gss_cred_id_t /*cred_handle*/,
584             gss_name_t * /*name*/,
585             OM_uint32 * /*lifetime*/,
586             gss_cred_usage_t * /*cred_usage*/,
587             gss_OID_set * /*mechanisms*/
588            );
589
590 OM_uint32 GSSAPI_LIB_FUNCTION gss_inquire_context (
591             OM_uint32 * /*minor_status*/,
592             const gss_ctx_id_t /*context_handle*/,
593             gss_name_t * /*src_name*/,
594             gss_name_t * /*targ_name*/,
595             OM_uint32 * /*lifetime_rec*/,
596             gss_OID * /*mech_type*/,
597             OM_uint32 * /*ctx_flags*/,
598             int * /*locally_initiated*/,
599             int * /*open_context*/
600            );
601
602 OM_uint32 GSSAPI_LIB_FUNCTION gss_wrap_size_limit (
603             OM_uint32 * /*minor_status*/,
604             const gss_ctx_id_t /*context_handle*/,
605             int /*conf_req_flag*/,
606             gss_qop_t /*qop_req*/,
607             OM_uint32 /*req_output_size*/,
608             OM_uint32 * /*max_input_size*/
609            );
610
611 OM_uint32 GSSAPI_LIB_FUNCTION gss_add_cred (
612             OM_uint32 * /*minor_status*/,
613             const gss_cred_id_t /*input_cred_handle*/,
614             const gss_name_t /*desired_name*/,
615             const gss_OID /*desired_mech*/,
616             gss_cred_usage_t /*cred_usage*/,
617             OM_uint32 /*initiator_time_req*/,
618             OM_uint32 /*acceptor_time_req*/,
619             gss_cred_id_t * /*output_cred_handle*/,
620             gss_OID_set * /*actual_mechs*/,
621             OM_uint32 * /*initiator_time_rec*/,
622             OM_uint32 * /*acceptor_time_rec*/
623            );
624
625 OM_uint32 GSSAPI_LIB_FUNCTION gss_inquire_cred_by_mech (
626             OM_uint32 * /*minor_status*/,
627             const gss_cred_id_t /*cred_handle*/,
628             const gss_OID /*mech_type*/,
629             gss_name_t * /*name*/,
630             OM_uint32 * /*initiator_lifetime*/,
631             OM_uint32 * /*acceptor_lifetime*/,
632             gss_cred_usage_t * /*cred_usage*/
633            );
634
635 OM_uint32 GSSAPI_LIB_FUNCTION gss_export_sec_context (
636             OM_uint32 * /*minor_status*/,
637             gss_ctx_id_t * /*context_handle*/,
638             gss_buffer_t /*interprocess_token*/
639            );
640
641 OM_uint32 GSSAPI_LIB_FUNCTION gss_import_sec_context (
642             OM_uint32 * /*minor_status*/,
643             const gss_buffer_t /*interprocess_token*/,
644             gss_ctx_id_t * /*context_handle*/
645            );
646
647 OM_uint32 GSSAPI_LIB_FUNCTION gss_create_empty_oid_set (
648             OM_uint32 * /*minor_status*/,
649             gss_OID_set * /*oid_set*/
650            );
651
652 OM_uint32 GSSAPI_LIB_FUNCTION gss_add_oid_set_member (
653             OM_uint32 * /*minor_status*/,
654             const gss_OID /*member_oid*/,
655             gss_OID_set * /*oid_set*/
656            );
657
658 OM_uint32 GSSAPI_LIB_FUNCTION gss_test_oid_set_member (
659             OM_uint32 * /*minor_status*/,
660             const gss_OID /*member*/,
661             const gss_OID_set /*set*/,
662             int * /*present*/
663            );
664
665 OM_uint32 GSSAPI_LIB_FUNCTION gss_inquire_names_for_mech (
666             OM_uint32 * /*minor_status*/,
667             const gss_OID /*mechanism*/,
668             gss_OID_set * /*name_types*/
669            );
670
671 OM_uint32 GSSAPI_LIB_FUNCTION gss_inquire_mechs_for_name (
672             OM_uint32 * /*minor_status*/,
673             const gss_name_t /*input_name*/,
674             gss_OID_set * /*mech_types*/
675            );
676
677 OM_uint32 GSSAPI_LIB_FUNCTION gss_canonicalize_name (
678             OM_uint32 * /*minor_status*/,
679             const gss_name_t /*input_name*/,
680             const gss_OID /*mech_type*/,
681             gss_name_t * /*output_name*/
682            );
683
684 OM_uint32 GSSAPI_LIB_FUNCTION gss_duplicate_name (
685             OM_uint32 * /*minor_status*/,
686             const gss_name_t /*src_name*/,
687             gss_name_t * /*dest_name*/
688            );
689
690 OM_uint32 GSSAPI_LIB_FUNCTION gss_duplicate_oid (
691             OM_uint32 * /* minor_status */,
692             gss_OID /* src_oid */,
693             gss_OID * /* dest_oid */
694            );
695
696 OM_uint32 GSSAPI_LIB_FUNCTION
697 gss_release_oid
698         (OM_uint32 * /*minor_status*/,
699          gss_OID * /* oid */
700         );
701
702 OM_uint32 GSSAPI_LIB_FUNCTION
703 gss_oid_to_str(
704             OM_uint32 * /*minor_status*/,
705             gss_OID /* oid */,
706             gss_buffer_t /* str */
707            );
708
709 OM_uint32 GSSAPI_LIB_FUNCTION
710 gss_inquire_sec_context_by_oid(
711             OM_uint32 * minor_status,
712             const gss_ctx_id_t context_handle,
713             const gss_OID desired_object,
714             gss_buffer_set_t *data_set
715            );
716
717 OM_uint32 GSSAPI_LIB_FUNCTION
718 gss_set_sec_context_option (OM_uint32 *minor_status,
719                             gss_ctx_id_t *context_handle,
720                             const gss_OID desired_object,
721                             const gss_buffer_t value);
722
723 OM_uint32 GSSAPI_LIB_FUNCTION
724 gss_set_cred_option (OM_uint32 *minor_status,
725                      gss_cred_id_t *cred_handle,
726                      const gss_OID object,
727                      const gss_buffer_t value);
728
729 int GSSAPI_LIB_FUNCTION
730 gss_oid_equal(const gss_OID a, const gss_OID b);
731
732 OM_uint32 GSSAPI_LIB_FUNCTION
733 gss_create_empty_buffer_set
734            (OM_uint32 * minor_status,
735             gss_buffer_set_t *buffer_set);
736
737 OM_uint32 GSSAPI_LIB_FUNCTION
738 gss_add_buffer_set_member
739            (OM_uint32 * minor_status,
740             const gss_buffer_t member_buffer,
741             gss_buffer_set_t *buffer_set);
742
743 OM_uint32 GSSAPI_LIB_FUNCTION
744 gss_release_buffer_set
745            (OM_uint32 * minor_status,
746             gss_buffer_set_t *buffer_set);
747
748 OM_uint32 GSSAPI_LIB_FUNCTION
749 gss_inquire_cred_by_oid(OM_uint32 *minor_status,
750                         const gss_cred_id_t cred_handle,
751                         const gss_OID desired_object,
752                         gss_buffer_set_t *data_set);
753
754 /*
755  * RFC 4401
756  */
757
758 #define GSS_C_PRF_KEY_FULL 0
759 #define GSS_C_PRF_KEY_PARTIAL 1
760
761 OM_uint32 GSSAPI_LIB_FUNCTION
762 gss_pseudo_random
763         (OM_uint32 *minor_status,
764          gss_ctx_id_t context,
765          int prf_key,
766          const gss_buffer_t prf_in,
767          ssize_t desired_output_len,
768          gss_buffer_t prf_out
769         );
770
771 OM_uint32
772 gss_store_cred(OM_uint32         * /* minor_status */,
773                gss_cred_id_t     /* input_cred_handle */,
774                gss_cred_usage_t  /* cred_usage */,
775                const gss_OID     /* desired_mech */,
776                OM_uint32         /* overwrite_cred */,
777                OM_uint32         /* default_cred */,
778                gss_OID_set       * /* elements_stored */,
779                gss_cred_usage_t  * /* cred_usage_stored */);
780
781
782 /*
783  * Query functions
784  */
785
786 typedef struct {
787     size_t header; /**< size of header */
788     size_t trailer; /**< size of trailer */
789     size_t max_msg_size; /**< maximum message size */
790     size_t buffers; /**< extra GSS_IOV_BUFFER_TYPE_EMPTY buffer to pass */
791     size_t blocksize; /**< Specificed optimal size of messages, also
792                          is the maximum padding size
793                          (GSS_IOV_BUFFER_TYPE_PADDING) */
794 } gss_context_stream_sizes; 
795
796 extern gss_OID GSSAPI_LIB_VARIABLE GSS_C_ATTR_STREAM_SIZES;
797
798
799 OM_uint32 GSSAPI_LIB_FUNCTION
800 gss_context_query_attributes(OM_uint32 * /* minor_status */,
801                              gss_OID /* attribute */,
802                              void * /*data*/,
803                              size_t /* len */);
804 /*
805  * The following routines are obsolete variants of gss_get_mic,
806  * gss_verify_mic, gss_wrap and gss_unwrap.  They should be
807  * provided by GSSAPI V2 implementations for backwards
808  * compatibility with V1 applications.  Distinct entrypoints
809  * (as opposed to #defines) should be provided, both to allow
810  * GSSAPI V1 applications to link against GSSAPI V2 implementations,
811  * and to retain the slight parameter type differences between the
812  * obsolete versions of these routines and their current forms.
813  */
814
815 OM_uint32 GSSAPI_LIB_FUNCTION GSSAPI_DEPRECATED gss_sign
816            (OM_uint32 * /*minor_status*/,
817             gss_ctx_id_t /*context_handle*/,
818             int /*qop_req*/,
819             gss_buffer_t /*message_buffer*/,
820             gss_buffer_t /*message_token*/
821            );
822
823 OM_uint32 GSSAPI_LIB_FUNCTION GSSAPI_DEPRECATED gss_verify
824            (OM_uint32 * /*minor_status*/,
825             gss_ctx_id_t /*context_handle*/,
826             gss_buffer_t /*message_buffer*/,
827             gss_buffer_t /*token_buffer*/,
828             int * /*qop_state*/
829            );
830
831 OM_uint32 GSSAPI_LIB_FUNCTION GSSAPI_DEPRECATED gss_seal
832            (OM_uint32 * /*minor_status*/,
833             gss_ctx_id_t /*context_handle*/,
834             int /*conf_req_flag*/,
835             int /*qop_req*/,
836             gss_buffer_t /*input_message_buffer*/,
837             int * /*conf_state*/,
838             gss_buffer_t /*output_message_buffer*/
839            );
840
841 OM_uint32 GSSAPI_LIB_FUNCTION GSSAPI_DEPRECATED gss_unseal
842            (OM_uint32 * /*minor_status*/,
843             gss_ctx_id_t /*context_handle*/,
844             gss_buffer_t /*input_message_buffer*/,
845             gss_buffer_t /*output_message_buffer*/,
846             int * /*conf_state*/,
847             int * /*qop_state*/
848            );
849
850 /*
851  *
852  */
853
854 OM_uint32 GSSAPI_LIB_FUNCTION
855 gss_encapsulate_token(gss_buffer_t /* input_token */,
856                       gss_OID /* oid */,
857                       gss_buffer_t /* output_token */);
858
859 OM_uint32 GSSAPI_LIB_FUNCTION
860 gss_decapsulate_token(gss_buffer_t /* input_token */,
861                       gss_OID /* oid */,
862                       gss_buffer_t /* output_token */);
863
864
865
866 /*
867  * AEAD support
868  */
869
870 /*
871  * GSS_IOV
872  */
873
874 OM_uint32 GSSAPI_LIB_FUNCTION
875 gss_wrap_iov(OM_uint32 *, gss_ctx_id_t, int, gss_qop_t, int *,
876              gss_iov_buffer_desc *, int);
877
878
879 OM_uint32 GSSAPI_LIB_FUNCTION
880 gss_unwrap_iov(OM_uint32 *, gss_ctx_id_t, int *, gss_qop_t *,
881                gss_iov_buffer_desc *, int);
882
883 OM_uint32 GSSAPI_LIB_FUNCTION
884 gss_wrap_iov_length(OM_uint32 *, gss_ctx_id_t, int, gss_qop_t, int *,
885                     gss_iov_buffer_desc *, int);
886
887 OM_uint32 GSSAPI_LIB_FUNCTION
888 gss_release_iov_buffer(OM_uint32 *, gss_iov_buffer_desc *, int);
889
890
891 #ifdef __cplusplus
892 }
893 #endif
894
895 #endif /* GSSAPI_GSSAPI_H_ */