15d685d8c08c2d88439f7695f73d15995d7d5dd3
[platform/upstream/krb5.git] / src / lib / gssapi / generic / gssapi.hin
1 /* -*- mode: c; indent-tabs-mode: nil -*- */
2 /*
3  * Copyright 1993 by OpenVision Technologies, Inc.
4  *
5  * Permission to use, copy, modify, distribute, and sell this software
6  * and its documentation for any purpose is hereby granted without fee,
7  * provided that the above copyright notice appears in all copies and
8  * that both that copyright notice and this permission notice appear in
9  * supporting documentation, and that the name of OpenVision not be used
10  * in advertising or publicity pertaining to distribution of the software
11  * without specific, written prior permission. OpenVision makes no
12  * representations about the suitability of this software for any
13  * purpose.  It is provided "as is" without express or implied warranty.
14  *
15  * OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
16  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
17  * EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR
18  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
19  * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
20  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
21  * PERFORMANCE OF THIS SOFTWARE.
22  */
23
24 #ifndef _GSSAPI_H_
25 #define _GSSAPI_H_
26
27 /*
28  * Determine platform-dependent configuration.
29  */
30
31 #if defined(__MACH__) && defined(__APPLE__)
32 #       include <TargetConditionals.h>
33 #       if TARGET_RT_MAC_CFM
34 #               error "Use KfM 4.0 SDK headers for CFM compilation."
35 #       endif
36 #endif
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif /* __cplusplus */
41
42 #if TARGET_OS_MAC
43 #    pragma pack(push,2)
44 #endif
45
46 #if defined(_MSDOS) || defined(_WIN32)
47 #include <win-mac.h>
48 #endif
49
50 #ifndef KRB5_CALLCONV
51 #define KRB5_CALLCONV
52 #define KRB5_CALLCONV_C
53 #endif
54
55 /*
56  * First, include stddef.h to get size_t defined.
57  */
58 #include <stddef.h>
59
60 /*
61  * POSIX says that sys/types.h is where size_t is defined.
62  */
63 #include <sys/types.h>
64
65 /*
66  * $Id$
67  */
68
69 /*
70  * First, define the three platform-dependent pointer types.
71  */
72
73 struct gss_name_struct;
74 typedef struct gss_name_struct * gss_name_t;
75
76 struct gss_cred_id_struct;
77 typedef struct gss_cred_id_struct * gss_cred_id_t;
78
79 struct gss_ctx_id_struct;
80 typedef struct gss_ctx_id_struct * gss_ctx_id_t;
81
82 /*
83  * The following type must be defined as the smallest natural unsigned integer
84  * supported by the platform that has at least 32 bits of precision.
85  */
86 typedef uint32_t gss_uint32;
87 typedef int32_t gss_int32;
88
89 #ifdef  OM_STRING
90 /*
91  * We have included the xom.h header file.  Use the definition for
92  * OM_object identifier.
93  */
94 typedef OM_object_identifier    gss_OID_desc, *gss_OID;
95 #else   /* OM_STRING */
96 /*
97  * We can't use X/Open definitions, so roll our own.
98  */
99 typedef gss_uint32      OM_uint32;
100
101 typedef struct gss_OID_desc_struct {
102     OM_uint32 length;
103     void *elements;
104 } gss_OID_desc, *gss_OID;
105 #endif  /* OM_STRING */
106
107 typedef struct gss_OID_set_desc_struct  {
108     size_t  count;
109     gss_OID elements;
110 } gss_OID_set_desc, *gss_OID_set;
111
112 typedef struct gss_buffer_desc_struct {
113     size_t length;
114     void *value;
115 } gss_buffer_desc, *gss_buffer_t;
116
117 typedef struct gss_channel_bindings_struct {
118     OM_uint32 initiator_addrtype;
119     gss_buffer_desc initiator_address;
120     OM_uint32 acceptor_addrtype;
121     gss_buffer_desc acceptor_address;
122     gss_buffer_desc application_data;
123 } *gss_channel_bindings_t;
124
125 /*
126  * For now, define a QOP-type as an OM_uint32 (pending resolution of ongoing
127  * discussions).
128  */
129 typedef OM_uint32       gss_qop_t;
130 typedef int             gss_cred_usage_t;
131
132 /*
133  * Flag bits for context-level services.
134  */
135 #define GSS_C_DELEG_FLAG        1
136 #define GSS_C_MUTUAL_FLAG       2
137 #define GSS_C_REPLAY_FLAG       4
138 #define GSS_C_SEQUENCE_FLAG     8
139 #define GSS_C_CONF_FLAG         16
140 #define GSS_C_INTEG_FLAG        32
141 #define GSS_C_ANON_FLAG         64
142 #define GSS_C_PROT_READY_FLAG   128
143 #define GSS_C_TRANS_FLAG        256
144 #define GSS_C_DELEG_POLICY_FLAG 32768
145
146 /*
147  * Credential usage options
148  */
149 #define GSS_C_BOTH      0
150 #define GSS_C_INITIATE  1
151 #define GSS_C_ACCEPT    2
152
153 /*
154  * Status code types for gss_display_status
155  */
156 #define GSS_C_GSS_CODE  1
157 #define GSS_C_MECH_CODE 2
158
159 /*
160  * The constant definitions for channel-bindings address families
161  */
162 #define GSS_C_AF_UNSPEC     0
163 #define GSS_C_AF_LOCAL      1
164 #define GSS_C_AF_INET       2
165 #define GSS_C_AF_IMPLINK    3
166 #define GSS_C_AF_PUP        4
167 #define GSS_C_AF_CHAOS      5
168 #define GSS_C_AF_NS         6
169 #define GSS_C_AF_NBS        7
170 #define GSS_C_AF_ECMA       8
171 #define GSS_C_AF_DATAKIT    9
172 #define GSS_C_AF_CCITT      10
173 #define GSS_C_AF_SNA        11
174 #define GSS_C_AF_DECnet     12
175 #define GSS_C_AF_DLI        13
176 #define GSS_C_AF_LAT        14
177 #define GSS_C_AF_HYLINK     15
178 #define GSS_C_AF_APPLETALK  16
179 #define GSS_C_AF_BSC        17
180 #define GSS_C_AF_DSS        18
181 #define GSS_C_AF_OSI        19
182 #define GSS_C_AF_NETBIOS    20
183 #define GSS_C_AF_X25        21
184
185 #define GSS_C_AF_NULLADDR   255
186
187 /*
188  * Various Null values.
189  */
190 #define GSS_C_NO_NAME ((gss_name_t) 0)
191 #define GSS_C_NO_BUFFER ((gss_buffer_t) 0)
192 #define GSS_C_NO_OID ((gss_OID) 0)
193 #define GSS_C_NO_OID_SET ((gss_OID_set) 0)
194 #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
195 #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
196 #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
197 #define GSS_C_EMPTY_BUFFER {0, NULL}
198
199 /*
200  * Some alternate names for a couple of the above values.  These are defined
201  * for V1 compatibility.
202  */
203 #define GSS_C_NULL_OID          GSS_C_NO_OID
204 #define GSS_C_NULL_OID_SET      GSS_C_NO_OID_SET
205
206 /*
207  * Define the default Quality of Protection for per-message services.  Note
208  * that an implementation that offers multiple levels of QOP may either reserve
209  * a value (for example zero, as assumed here) to mean "default protection", or
210  * alternatively may simply equate GSS_C_QOP_DEFAULT to a specific explicit
211  * QOP value.  However a value of 0 should always be interpreted by a GSSAPI
212  * implementation as a request for the default protection level.
213  */
214 #define GSS_C_QOP_DEFAULT 0
215
216 /*
217  * Expiration time of 2^32-1 seconds means infinite lifetime for a
218  * credential or security context
219  */
220 #define GSS_C_INDEFINITE ((OM_uint32) 0xfffffffful)
221
222
223 /* Major status codes */
224
225 #define GSS_S_COMPLETE 0
226
227 /*
228  * Some "helper" definitions to make the status code macros obvious.
229  */
230 #define GSS_C_CALLING_ERROR_OFFSET 24
231 #define GSS_C_ROUTINE_ERROR_OFFSET 16
232 #define GSS_C_SUPPLEMENTARY_OFFSET 0
233 #define GSS_C_CALLING_ERROR_MASK ((OM_uint32) 0377ul)
234 #define GSS_C_ROUTINE_ERROR_MASK ((OM_uint32) 0377ul)
235 #define GSS_C_SUPPLEMENTARY_MASK ((OM_uint32) 0177777ul)
236
237 /*
238  * The macros that test status codes for error conditions.  Note that the
239  * GSS_ERROR() macro has changed slightly from the V1 GSSAPI so that it now
240  * evaluates its argument only once.
241  */
242 #define GSS_CALLING_ERROR(x) \
243   ((x) & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
244 #define GSS_ROUTINE_ERROR(x) \
245   ((x) & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
246 #define GSS_SUPPLEMENTARY_INFO(x) \
247   ((x) & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
248 #define GSS_ERROR(x) \
249   ((x) & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \
250           (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))
251
252 /*
253  * Now the actual status code definitions
254  */
255
256 /*
257  * Calling errors:
258  */
259 #define GSS_S_CALL_INACCESSIBLE_READ \
260                              (((OM_uint32) 1ul) << GSS_C_CALLING_ERROR_OFFSET)
261 #define GSS_S_CALL_INACCESSIBLE_WRITE \
262                              (((OM_uint32) 2ul) << GSS_C_CALLING_ERROR_OFFSET)
263 #define GSS_S_CALL_BAD_STRUCTURE \
264                              (((OM_uint32) 3ul) << GSS_C_CALLING_ERROR_OFFSET)
265
266 /*
267  * Routine errors:
268  */
269 #define GSS_S_BAD_MECH (((OM_uint32) 1ul) << GSS_C_ROUTINE_ERROR_OFFSET)
270 #define GSS_S_BAD_NAME (((OM_uint32) 2ul) << GSS_C_ROUTINE_ERROR_OFFSET)
271 #define GSS_S_BAD_NAMETYPE (((OM_uint32) 3ul) << GSS_C_ROUTINE_ERROR_OFFSET)
272 #define GSS_S_BAD_BINDINGS (((OM_uint32) 4ul) << GSS_C_ROUTINE_ERROR_OFFSET)
273 #define GSS_S_BAD_STATUS (((OM_uint32) 5ul) << GSS_C_ROUTINE_ERROR_OFFSET)
274 #define GSS_S_BAD_SIG (((OM_uint32) 6ul) << GSS_C_ROUTINE_ERROR_OFFSET)
275 #define GSS_S_NO_CRED (((OM_uint32) 7ul) << GSS_C_ROUTINE_ERROR_OFFSET)
276 #define GSS_S_NO_CONTEXT (((OM_uint32) 8ul) << GSS_C_ROUTINE_ERROR_OFFSET)
277 #define GSS_S_DEFECTIVE_TOKEN (((OM_uint32) 9ul) << GSS_C_ROUTINE_ERROR_OFFSET)
278 #define GSS_S_DEFECTIVE_CREDENTIAL \
279      (((OM_uint32) 10ul) << GSS_C_ROUTINE_ERROR_OFFSET)
280 #define GSS_S_CREDENTIALS_EXPIRED \
281      (((OM_uint32) 11ul) << GSS_C_ROUTINE_ERROR_OFFSET)
282 #define GSS_S_CONTEXT_EXPIRED \
283      (((OM_uint32) 12ul) << GSS_C_ROUTINE_ERROR_OFFSET)
284 #define GSS_S_FAILURE (((OM_uint32) 13ul) << GSS_C_ROUTINE_ERROR_OFFSET)
285 #define GSS_S_BAD_QOP (((OM_uint32) 14ul) << GSS_C_ROUTINE_ERROR_OFFSET)
286 #define GSS_S_UNAUTHORIZED (((OM_uint32) 15ul) << GSS_C_ROUTINE_ERROR_OFFSET)
287 #define GSS_S_UNAVAILABLE (((OM_uint32) 16ul) << GSS_C_ROUTINE_ERROR_OFFSET)
288 #define GSS_S_DUPLICATE_ELEMENT \
289      (((OM_uint32) 17ul) << GSS_C_ROUTINE_ERROR_OFFSET)
290 #define GSS_S_NAME_NOT_MN \
291      (((OM_uint32) 18ul) << GSS_C_ROUTINE_ERROR_OFFSET)
292 #define GSS_S_BAD_MECH_ATTR \
293      (((OM_uint32) 19ul) << GSS_C_ROUTINE_ERROR_OFFSET)
294
295 /*
296  * Supplementary info bits:
297  */
298 #define GSS_S_CONTINUE_NEEDED (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
299 #define GSS_S_DUPLICATE_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
300 #define GSS_S_OLD_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
301 #define GSS_S_UNSEQ_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 3))
302 #define GSS_S_GAP_TOKEN (1 << (GSS_C_SUPPLEMENTARY_OFFSET + 4))
303
304
305 /*
306  * Finally, function prototypes for the GSSAPI routines.
307  */
308
309 #if defined (_WIN32) && defined (_MSC_VER)
310 # ifdef GSS_DLL_FILE
311 #  define GSS_DLLIMP __declspec(dllexport)
312 # else
313 #  define GSS_DLLIMP __declspec(dllimport)
314 # endif
315 #else
316 # define GSS_DLLIMP
317 #endif
318
319 /* Reserved static storage for GSS_oids.  Comments are quotes from RFC 2744.
320  *
321  * The implementation must reserve static storage for a
322  * gss_OID_desc object containing the value
323  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x01"},
324  * corresponding to an object-identifier value of
325  * {iso(1) member-body(2) United States(840) mit(113554)
326  * infosys(1) gssapi(2) generic(1) user_name(1)}.  The constant
327  * GSS_C_NT_USER_NAME should be initialized to point
328  * to that gss_OID_desc.
329  */
330 GSS_DLLIMP extern gss_OID GSS_C_NT_USER_NAME;
331
332 /*
333  * The implementation must reserve static storage for a
334  * gss_OID_desc object containing the value
335  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x02"},
336  * corresponding to an object-identifier value of
337  * {iso(1) member-body(2) United States(840) mit(113554)
338  * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.
339  * The constant GSS_C_NT_MACHINE_UID_NAME should be
340  * initialized to point to that gss_OID_desc.
341  */
342 GSS_DLLIMP extern gss_OID GSS_C_NT_MACHINE_UID_NAME;
343
344 /*
345  * The implementation must reserve static storage for a
346  * gss_OID_desc object containing the value
347  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x01\x03"},
348  * corresponding to an object-identifier value of
349  * {iso(1) member-body(2) United States(840) mit(113554)
350  * infosys(1) gssapi(2) generic(1) string_uid_name(3)}.
351  * The constant GSS_C_NT_STRING_UID_NAME should be
352  * initialized to point to that gss_OID_desc.
353  */
354 GSS_DLLIMP extern gss_OID GSS_C_NT_STRING_UID_NAME;
355
356 /*
357  * The implementation must reserve static storage for a
358  * gss_OID_desc object containing the value
359  * {6, (void *)"\x2b\x06\x01\x05\x06\x02"},
360  * corresponding to an object-identifier value of
361  * {iso(1) org(3) dod(6) internet(1) security(5)
362  * nametypes(6) gss-host-based-services(2)).  The constant
363  * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point
364  * to that gss_OID_desc.  This is a deprecated OID value, and
365  * implementations wishing to support hostbased-service names
366  * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,
367  * defined below, to identify such names;
368  * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym
369  * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input
370  * parameter, but should not be emitted by GSS-API
371  * implementations
372  */
373 GSS_DLLIMP extern gss_OID GSS_C_NT_HOSTBASED_SERVICE_X;
374
375 /*
376  * The implementation must reserve static storage for a
377  * gss_OID_desc object containing the value
378  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
379  *              "\x01\x02\x01\x04"}, corresponding to an
380  * object-identifier value of {iso(1) member-body(2)
381  * Unites States(840) mit(113554) infosys(1) gssapi(2)
382  * generic(1) service_name(4)}.  The constant
383  * GSS_C_NT_HOSTBASED_SERVICE should be initialized
384  * to point to that gss_OID_desc.
385  */
386 GSS_DLLIMP extern gss_OID GSS_C_NT_HOSTBASED_SERVICE;
387
388 /*
389  * The implementation must reserve static storage for a
390  * gss_OID_desc object containing the value
391  * {6, (void *)"\x2b\x06\01\x05\x06\x03"},
392  * corresponding to an object identifier value of
393  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
394  * 6(nametypes), 3(gss-anonymous-name)}.  The constant
395  * and GSS_C_NT_ANONYMOUS should be initialized to point
396  * to that gss_OID_desc.
397  */
398 GSS_DLLIMP extern gss_OID GSS_C_NT_ANONYMOUS;
399
400
401 /*
402  * The implementation must reserve static storage for a
403  * gss_OID_desc object containing the value
404  * {6, (void *)"\x2b\x06\x01\x05\x06\x04"},
405  * corresponding to an object-identifier value of
406  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
407  * 6(nametypes), 4(gss-api-exported-name)}.  The constant
408  * GSS_C_NT_EXPORT_NAME should be initialized to point
409  * to that gss_OID_desc.
410  */
411 GSS_DLLIMP extern gss_OID GSS_C_NT_EXPORT_NAME;
412
413 /* Function Prototypes */
414
415 OM_uint32 KRB5_CALLCONV
416 gss_acquire_cred(
417     OM_uint32 *,        /* minor_status */
418     gss_name_t,         /* desired_name */
419     OM_uint32,          /* time_req */
420     gss_OID_set,        /* desired_mechs */
421     gss_cred_usage_t,   /* cred_usage */
422     gss_cred_id_t *,    /* output_cred_handle */
423     gss_OID_set *,      /* actual_mechs */
424     OM_uint32 *);       /* time_rec */
425
426 OM_uint32 KRB5_CALLCONV
427 gss_release_cred(
428     OM_uint32 *,        /* minor_status */
429     gss_cred_id_t *);   /* cred_handle */
430
431 OM_uint32 KRB5_CALLCONV
432 gss_init_sec_context(
433     OM_uint32 *,        /* minor_status */
434     gss_cred_id_t,      /* claimant_cred_handle */
435     gss_ctx_id_t *,     /* context_handle */
436     gss_name_t,         /* target_name */
437     gss_OID,            /* mech_type (used to be const) */
438     OM_uint32,          /* req_flags */
439     OM_uint32,          /* time_req */
440     gss_channel_bindings_t,     /* input_chan_bindings */
441     gss_buffer_t,       /* input_token */
442     gss_OID *,          /* actual_mech_type */
443     gss_buffer_t,       /* output_token */
444     OM_uint32 *,        /* ret_flags */
445     OM_uint32 *);       /* time_rec */
446
447 OM_uint32 KRB5_CALLCONV
448 gss_accept_sec_context(
449     OM_uint32 *,                /* minor_status */
450     gss_ctx_id_t *,             /* context_handle */
451     gss_cred_id_t,              /* acceptor_cred_handle */
452     gss_buffer_t,               /* input_token_buffer */
453     gss_channel_bindings_t,     /* input_chan_bindings */
454     gss_name_t *,               /* src_name */
455     gss_OID *,                  /* mech_type */
456     gss_buffer_t,               /* output_token */
457     OM_uint32 *,                /* ret_flags */
458     OM_uint32 *,                /* time_rec */
459     gss_cred_id_t *);           /* delegated_cred_handle */
460
461 OM_uint32 KRB5_CALLCONV
462 gss_process_context_token(
463     OM_uint32 *,        /* minor_status */
464     gss_ctx_id_t,       /* context_handle */
465     gss_buffer_t);      /* token_buffer */
466
467
468 OM_uint32 KRB5_CALLCONV
469 gss_delete_sec_context(
470     OM_uint32 *,        /* minor_status */
471     gss_ctx_id_t *,     /* context_handle */
472     gss_buffer_t);      /* output_token */
473
474
475 OM_uint32 KRB5_CALLCONV
476 gss_context_time(
477     OM_uint32 *,        /* minor_status */
478     gss_ctx_id_t,       /* context_handle */
479     OM_uint32 *);       /* time_rec */
480
481
482 /* New for V2 */
483 OM_uint32 KRB5_CALLCONV
484 gss_get_mic(
485     OM_uint32 *,        /* minor_status */
486     gss_ctx_id_t,       /* context_handle */
487     gss_qop_t,          /* qop_req */
488     gss_buffer_t,       /* message_buffer */
489     gss_buffer_t);      /* message_token */
490
491
492 /* New for V2 */
493 OM_uint32 KRB5_CALLCONV
494 gss_verify_mic(OM_uint32 *,     /* minor_status */
495                gss_ctx_id_t,    /* context_handle */
496                gss_buffer_t,    /* message_buffer */
497                gss_buffer_t,    /* message_token */
498                gss_qop_t *      /* qop_state */
499 );
500
501 /* New for V2 */
502 OM_uint32 KRB5_CALLCONV
503 gss_wrap(
504     OM_uint32 *,        /* minor_status */
505     gss_ctx_id_t,       /* context_handle */
506     int,                /* conf_req_flag */
507     gss_qop_t,          /* qop_req */
508     gss_buffer_t,       /* input_message_buffer */
509     int *,              /* conf_state */
510     gss_buffer_t);      /* output_message_buffer */
511
512
513 /* New for V2 */
514 OM_uint32 KRB5_CALLCONV
515 gss_unwrap(
516     OM_uint32 *,        /* minor_status */
517     gss_ctx_id_t,       /* context_handle */
518     gss_buffer_t,       /* input_message_buffer */
519     gss_buffer_t,       /* output_message_buffer */
520     int *,              /* conf_state */
521     gss_qop_t *);       /* qop_state */
522
523
524 OM_uint32 KRB5_CALLCONV
525 gss_display_status(
526     OM_uint32 *,        /* minor_status */
527     OM_uint32,          /* status_value */
528     int,                /* status_type */
529     gss_OID,            /* mech_type (used to be const) */
530     OM_uint32 *,        /* message_context */
531     gss_buffer_t);      /* status_string */
532
533
534 OM_uint32 KRB5_CALLCONV
535 gss_indicate_mechs(
536     OM_uint32 *,        /* minor_status */
537     gss_OID_set *);     /* mech_set */
538
539
540 OM_uint32 KRB5_CALLCONV
541 gss_compare_name(
542     OM_uint32 *,        /* minor_status */
543     gss_name_t,         /* name1 */
544     gss_name_t,         /* name2 */
545     int *);             /* name_equal */
546
547
548 OM_uint32 KRB5_CALLCONV
549 gss_display_name(
550     OM_uint32 *,        /* minor_status */
551     gss_name_t,         /* input_name */
552     gss_buffer_t,       /* output_name_buffer */
553     gss_OID *);         /* output_name_type */
554
555
556 OM_uint32 KRB5_CALLCONV
557 gss_import_name(
558     OM_uint32 *,        /* minor_status */
559     gss_buffer_t,       /* input_name_buffer */
560     gss_OID,            /* input_name_type(used to be const) */
561     gss_name_t *);      /* output_name */
562
563 OM_uint32 KRB5_CALLCONV
564 gss_release_name(
565     OM_uint32 *,        /* minor_status */
566     gss_name_t *);      /* input_name */
567
568 OM_uint32 KRB5_CALLCONV
569 gss_release_buffer(
570     OM_uint32 *,        /* minor_status */
571     gss_buffer_t);      /* buffer */
572
573 OM_uint32 KRB5_CALLCONV
574 gss_release_oid_set(
575     OM_uint32 *,        /* minor_status */
576     gss_OID_set *);     /* set */
577
578 OM_uint32 KRB5_CALLCONV
579 gss_inquire_cred(
580     OM_uint32 *,        /* minor_status */
581     gss_cred_id_t,      /* cred_handle */
582     gss_name_t *,       /* name */
583     OM_uint32 *,        /* lifetime */
584     gss_cred_usage_t *, /* cred_usage */
585     gss_OID_set *);     /* mechanisms */
586
587 /* Last argument new for V2 */
588 OM_uint32 KRB5_CALLCONV
589 gss_inquire_context(
590     OM_uint32 *,        /* minor_status */
591     gss_ctx_id_t,       /* context_handle */
592     gss_name_t *,       /* src_name */
593     gss_name_t *,       /* targ_name */
594     OM_uint32 *,        /* lifetime_rec */
595     gss_OID *,          /* mech_type */
596     OM_uint32 *,        /* ctx_flags */
597     int *,              /* locally_initiated */
598     int *);             /* open */
599
600 /* New for V2 */
601 OM_uint32 KRB5_CALLCONV
602 gss_wrap_size_limit(
603     OM_uint32 *,        /* minor_status */
604     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 /* New for V2 */
611 OM_uint32 KRB5_CALLCONV
612 gss_import_name_object(
613     OM_uint32 *,        /* minor_status */
614     void *,             /* input_name */
615     gss_OID,            /* input_name_type */
616     gss_name_t *);      /* output_name */
617
618 /* New for V2 */
619 OM_uint32 KRB5_CALLCONV
620 gss_export_name_object(
621     OM_uint32 *,        /* minor_status */
622     gss_name_t,         /* input_name */
623     gss_OID,            /* desired_name_type */
624     void **);           /* output_name */
625
626 /* New for V2 */
627 OM_uint32 KRB5_CALLCONV
628 gss_add_cred(
629     OM_uint32 *,        /* minor_status */
630     gss_cred_id_t,      /* input_cred_handle */
631     gss_name_t,         /* desired_name */
632     gss_OID,            /* desired_mech */
633     gss_cred_usage_t,   /* cred_usage */
634     OM_uint32,          /* initiator_time_req */
635     OM_uint32,          /* acceptor_time_req */
636     gss_cred_id_t *,    /* output_cred_handle */
637     gss_OID_set *,      /* actual_mechs */
638     OM_uint32 *,        /* initiator_time_rec */
639     OM_uint32 *);       /* acceptor_time_rec */
640
641 /* New for V2 */
642 OM_uint32 KRB5_CALLCONV
643 gss_inquire_cred_by_mech(
644     OM_uint32 *,                /* minor_status */
645     gss_cred_id_t,              /* cred_handle */
646     gss_OID,                    /* mech_type */
647     gss_name_t *,               /* name */
648     OM_uint32 *,                /* initiator_lifetime */
649     OM_uint32 *,                /* acceptor_lifetime */
650     gss_cred_usage_t *);        /* cred_usage */
651
652 /* New for V2 */
653 OM_uint32 KRB5_CALLCONV
654 gss_export_sec_context(
655     OM_uint32 *,        /* minor_status */
656     gss_ctx_id_t *,     /* context_handle */
657     gss_buffer_t);      /* interprocess_token */
658
659 /* New for V2 */
660 OM_uint32 KRB5_CALLCONV
661 gss_import_sec_context(
662     OM_uint32 *,        /* minor_status */
663     gss_buffer_t,       /* interprocess_token */
664     gss_ctx_id_t *);    /* context_handle */
665
666 /* New for V2 */
667 OM_uint32 KRB5_CALLCONV
668 gss_release_oid(
669     OM_uint32 *,        /* minor_status */
670     gss_OID *);         /* oid */
671
672 /* New for V2 */
673 OM_uint32 KRB5_CALLCONV
674 gss_create_empty_oid_set(
675     OM_uint32 *,        /* minor_status */
676     gss_OID_set *);     /* oid_set */
677
678 /* New for V2 */
679 OM_uint32 KRB5_CALLCONV
680 gss_add_oid_set_member(
681     OM_uint32 *,        /* minor_status */
682     gss_OID,            /* member_oid */
683     gss_OID_set *);     /* oid_set */
684
685 /* New for V2 */
686 OM_uint32 KRB5_CALLCONV
687 gss_test_oid_set_member(
688     OM_uint32 *,        /* minor_status */
689     gss_OID,            /* member */
690     gss_OID_set,        /* set */
691     int *);             /* present */
692
693 /* New for V2 */
694 OM_uint32 KRB5_CALLCONV
695 gss_str_to_oid(
696     OM_uint32 *,        /* minor_status */
697     gss_buffer_t,       /* oid_str */
698     gss_OID *);         /* oid */
699
700 /* New for V2 */
701 OM_uint32 KRB5_CALLCONV
702 gss_oid_to_str(
703     OM_uint32 *,        /* minor_status */
704     gss_OID,            /* oid */
705     gss_buffer_t);      /* oid_str */
706
707 /* New for V2 */
708 OM_uint32 KRB5_CALLCONV
709 gss_inquire_names_for_mech(
710     OM_uint32 *,        /* minor_status */
711     gss_OID,            /* mechanism */
712     gss_OID_set *);     /* name_types */
713
714 /* New for V2 */
715 OM_uint32 KRB5_CALLCONV
716 gss_inquire_mechs_for_name(
717     OM_uint32 *,        /* minor_status */
718     const gss_name_t,   /* input_name */
719     gss_OID_set *);     /* mech_types */
720
721 /*
722  * The following routines are obsolete variants of gss_get_mic, gss_wrap,
723  * gss_verify_mic and gss_unwrap.  They should be provided by GSSAPI V2
724  * implementations for backwards compatibility with V1 applications.  Distinct
725  * entrypoints (as opposed to #defines) should be provided, to allow GSSAPI
726  * V1 applications to link against GSSAPI V2 implementations.
727  */
728 OM_uint32 KRB5_CALLCONV
729 gss_sign(
730     OM_uint32 *,        /* minor_status */
731     gss_ctx_id_t,       /* context_handle */
732     int,                /* qop_req */
733     gss_buffer_t,       /* message_buffer */
734     gss_buffer_t);      /* message_token */
735
736 OM_uint32 KRB5_CALLCONV
737 gss_verify(
738     OM_uint32 *,        /* minor_status */
739     gss_ctx_id_t,       /* context_handle */
740     gss_buffer_t,       /* message_buffer */
741     gss_buffer_t,       /* token_buffer */
742     int *);             /* qop_state */
743
744 OM_uint32 KRB5_CALLCONV
745 gss_seal(
746     OM_uint32 *,        /* minor_status */
747     gss_ctx_id_t,       /* context_handle */
748     int,                /* conf_req_flag */
749     int,                /* qop_req */
750     gss_buffer_t,       /* input_message_buffer */
751     int *,              /* conf_state */
752     gss_buffer_t);      /* output_message_buffer */
753
754 OM_uint32 KRB5_CALLCONV
755 gss_unseal(
756     OM_uint32 *,        /* minor_status */
757     gss_ctx_id_t,       /* context_handle */
758     gss_buffer_t,       /* input_message_buffer */
759     gss_buffer_t,       /* output_message_buffer */
760     int *,              /* conf_state */
761     int *);             /* qop_state */
762
763 /* New for V2 */
764 OM_uint32 KRB5_CALLCONV
765 gss_export_name(
766     OM_uint32  *,       /* minor_status */
767     const gss_name_t,   /* input_name */
768     gss_buffer_t);      /* exported_name */
769
770 /* New for V2 */
771 OM_uint32 KRB5_CALLCONV
772 gss_duplicate_name(
773     OM_uint32  *,       /* minor_status */
774     const gss_name_t,   /* input_name */
775     gss_name_t *);      /* dest_name */
776
777 /* New for V2 */
778 OM_uint32 KRB5_CALLCONV
779 gss_canonicalize_name(
780     OM_uint32  *,       /* minor_status */
781     const gss_name_t,   /* input_name */
782     const gss_OID,      /* mech_type */
783     gss_name_t *);      /* output_name */
784
785 /* RFC 4401 */
786
787 #define GSS_C_PRF_KEY_FULL      0
788 #define GSS_C_PRF_KEY_PARTIAL   1
789
790 OM_uint32 KRB5_CALLCONV
791 gss_pseudo_random(
792     OM_uint32 *,        /* minor_status */
793     gss_ctx_id_t,       /* context */
794     int,                /* prf_key */
795     const gss_buffer_t, /* prf_in */
796     ssize_t,            /* desired_output_len */
797     gss_buffer_t);      /* prf_out */
798
799 OM_uint32 KRB5_CALLCONV
800 gss_store_cred(
801     OM_uint32 *,        /* minor_status */
802     const gss_cred_id_t,/* input_cred_handle */
803     gss_cred_usage_t,   /* input_usage */
804     const gss_OID,      /* desired_mech */
805     OM_uint32,          /* overwrite_cred */
806     OM_uint32,          /* default_cred */
807     gss_OID_set *,      /* elements_stored */
808     gss_cred_usage_t *);/* cred_usage_stored */
809
810 OM_uint32 KRB5_CALLCONV
811 gss_set_neg_mechs(
812     OM_uint32 *,        /* minor_status */
813     gss_cred_id_t,      /* cred_handle */
814     const gss_OID_set); /* mech_set */
815
816 #if TARGET_OS_MAC
817 #    pragma pack(pop)
818 #endif
819
820 #ifdef __cplusplus
821 }
822 #endif
823
824 /* XXXX these are not part of the GSSAPI C bindings!  (but should be) */
825
826 #define GSS_CALLING_ERROR_FIELD(x) \
827    (((x) >> GSS_C_CALLING_ERROR_OFFSET) & GSS_C_CALLING_ERROR_MASK)
828 #define GSS_ROUTINE_ERROR_FIELD(x) \
829    (((x) >> GSS_C_ROUTINE_ERROR_OFFSET) & GSS_C_ROUTINE_ERROR_MASK)
830 #define GSS_SUPPLEMENTARY_INFO_FIELD(x) \
831    (((x) >> GSS_C_SUPPLEMENTARY_OFFSET) & GSS_C_SUPPLEMENTARY_MASK)
832
833 /* XXXX This is a necessary evil until the spec is fixed */
834 #define GSS_S_CRED_UNAVAIL GSS_S_FAILURE
835
836 /*
837  * RFC 5587
838  */
839 typedef const gss_buffer_desc *gss_const_buffer_t;
840 typedef const struct gss_channel_bindings_struct *gss_const_channel_bindings_t;
841 typedef const struct gss_ctx_id_struct gss_const_ctx_id_t;
842 typedef const struct gss_cred_id_struct gss_const_cred_id_t;
843 typedef const struct gss_name_struct gss_const_name_t;
844 typedef const gss_OID_desc *gss_const_OID;
845 typedef const gss_OID_set_desc *gss_const_OID_set;
846
847 OM_uint32 KRB5_CALLCONV
848 gss_indicate_mechs_by_attrs(
849     OM_uint32 *,        /* minor_status */
850     gss_const_OID_set,  /* desired_mech_attrs */
851     gss_const_OID_set,  /* except_mech_attrs */
852     gss_const_OID_set,  /* critical_mech_attrs */
853     gss_OID_set *);     /* mechs */
854
855 OM_uint32 KRB5_CALLCONV
856 gss_inquire_attrs_for_mech(
857     OM_uint32 *,        /* minor_status */
858     gss_const_OID,      /* mech */
859     gss_OID_set *,      /* mech_attrs */
860     gss_OID_set *);     /* known_mech_attrs */
861
862 OM_uint32 KRB5_CALLCONV
863 gss_display_mech_attr(
864     OM_uint32 *,        /* minor_status */
865     gss_const_OID,      /* mech_attr */
866     gss_buffer_t,       /* name */
867     gss_buffer_t,       /* short_desc */
868     gss_buffer_t);      /* long_desc */
869
870 GSS_DLLIMP extern gss_const_OID GSS_C_MA_MECH_CONCRETE;
871 GSS_DLLIMP extern gss_const_OID GSS_C_MA_MECH_PSEUDO;
872 GSS_DLLIMP extern gss_const_OID GSS_C_MA_MECH_COMPOSITE;
873 GSS_DLLIMP extern gss_const_OID GSS_C_MA_MECH_NEGO;
874 GSS_DLLIMP extern gss_const_OID GSS_C_MA_MECH_GLUE;
875 GSS_DLLIMP extern gss_const_OID GSS_C_MA_NOT_MECH;
876 GSS_DLLIMP extern gss_const_OID GSS_C_MA_DEPRECATED;
877 GSS_DLLIMP extern gss_const_OID GSS_C_MA_NOT_DFLT_MECH;
878 GSS_DLLIMP extern gss_const_OID GSS_C_MA_ITOK_FRAMED;
879 GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_INIT;
880 GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_TARG;
881 GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_INIT_INIT;
882 GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_TARG_INIT;
883 GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_INIT_ANON;
884 GSS_DLLIMP extern gss_const_OID GSS_C_MA_AUTH_TARG_ANON;
885 GSS_DLLIMP extern gss_const_OID GSS_C_MA_DELEG_CRED;
886 GSS_DLLIMP extern gss_const_OID GSS_C_MA_INTEG_PROT;
887 GSS_DLLIMP extern gss_const_OID GSS_C_MA_CONF_PROT;
888 GSS_DLLIMP extern gss_const_OID GSS_C_MA_MIC;
889 GSS_DLLIMP extern gss_const_OID GSS_C_MA_WRAP;
890 GSS_DLLIMP extern gss_const_OID GSS_C_MA_PROT_READY;
891 GSS_DLLIMP extern gss_const_OID GSS_C_MA_REPLAY_DET;
892 GSS_DLLIMP extern gss_const_OID GSS_C_MA_OOS_DET;
893 GSS_DLLIMP extern gss_const_OID GSS_C_MA_CBINDINGS;
894 GSS_DLLIMP extern gss_const_OID GSS_C_MA_PFS;
895 GSS_DLLIMP extern gss_const_OID GSS_C_MA_COMPRESS;
896 GSS_DLLIMP extern gss_const_OID GSS_C_MA_CTX_TRANS;
897
898 /*
899  * RFC 5801
900  */
901 OM_uint32 KRB5_CALLCONV
902 gss_inquire_saslname_for_mech(
903     OM_uint32 *,        /* minor_status */
904     const gss_OID,      /* desired_mech */
905     gss_buffer_t,       /* sasl_mech_name */
906     gss_buffer_t,       /* mech_name */
907     gss_buffer_t        /* mech_description */
908 );
909
910 OM_uint32 KRB5_CALLCONV
911 gss_inquire_mech_for_saslname(
912     OM_uint32 *,        /* minor_status */
913     const gss_buffer_t, /* sasl_mech_name */
914     gss_OID *           /* mech_type */
915 );
916
917 #endif /* _GSSAPI_H_ */