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