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