xref: /freebsd/include/gssapi/gssapi.h (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1 /*
2  * Copyright (C) The Internet Society (2000).  All Rights Reserved.
3  *
4  * This document and translations of it may be copied and furnished to
5  * others, and derivative works that comment on or otherwise explain it
6  * or assist in its implementation may be prepared, copied, published
7  * and distributed, in whole or in part, without restriction of any
8  * kind, provided that the above copyright notice and this paragraph are
9  * included on all such copies and derivative works.  However, this
10  * document itself may not be modified in any way, such as by removing
11  * the copyright notice or references to the Internet Society or other
12  * Internet organizations, except as needed for the purpose of
13  * developing Internet standards in which case the procedures for
14  * copyrights defined in the Internet Standards process must be
15  * followed, or as required to translate it into languages other than
16  * English.
17  *
18  * The limited permissions granted above are perpetual and will not be
19  * revoked by the Internet Society or its successors or assigns.
20  *
21  * This document and the information contained herein is provided on an
22  * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
23  * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
24  * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
25  * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
26  * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
27  */
28 
29 #ifndef _GSSAPI_GSSAPI_H_
30 #define _GSSAPI_GSSAPI_H_
31 
32 #include <sys/cdefs.h>
33 #include <sys/_types.h>
34 
35 #ifndef _SIZE_T_DECLARED
36 typedef	__size_t	size_t;
37 #define	_SIZE_T_DECLARED
38 #endif
39 
40 #ifndef _SSIZE_T_DECLARED
41 typedef	__ssize_t	ssize_t;
42 #define	_SSIZE_T_DECLARED
43 #endif
44 
45 /* Compatibility with Heimdal 1.5.1 */
46 #ifndef GSSAPI_CPP_START
47 #ifdef __cplusplus
48 #define GSSAPI_CPP_START	extern "C" {
49 #define GSSAPI_CPP_END		}
50 #else
51 #define GSSAPI_CPP_START
52 #define GSSAPI_CPP_END
53 #endif
54 #endif
55 
56 /* Compatibility with Heimdal 1.5.1 */
57 #ifndef BUILD_GSSAPI_LIB
58 #define GSSAPI_LIB_FUNCTION
59 #define GSSAPI_LIB_CALL
60 #define GSSAPI_LIB_VARIABLE
61 #endif
62 
63 /* Compatibility with Heimdal 1.5.1 */
64 #ifndef GSSAPI_DEPRECATED_FUNCTION
65 #if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1 )))
66 #define GSSAPI_DEPRECATED_FUNCTION(X) __attribute__((deprecated))
67 #else
68 #define GSSAPI_DEPRECATED_FUNCTION(X)
69 #endif
70 #endif
71 
72 #if 0
73 /*
74  * If the platform supports the xom.h header file, it should be
75  * included here.
76  */
77 #include <xom.h>
78 #endif
79 
80 
81 /*
82  * Now define the three implementation-dependent types.
83  */
84 typedef struct _gss_ctx_id_t *gss_ctx_id_t;
85 typedef struct _gss_cred_id_t *gss_cred_id_t;
86 typedef struct _gss_name_t *gss_name_t;
87 
88 /*
89  * The following type must be defined as the smallest natural
90  * unsigned integer supported by the platform that has at least
91  * 32 bits of precision.
92  */
93 typedef __uint32_t gss_uint32;
94 
95 
96 #ifdef OM_STRING
97 /*
98  * We have included the xom.h header file.  Verify that OM_uint32
99  * is defined correctly.
100  */
101 
102 #if sizeof(gss_uint32) != sizeof(OM_uint32)
103 #error Incompatible definition of OM_uint32 from xom.h
104 #endif
105 
106 typedef OM_object_identifier gss_OID_desc, *gss_OID;
107 
108 #else
109 
110 /*
111  * We can't use X/Open definitions, so roll our own.
112  */
113 
114 typedef gss_uint32 OM_uint32;
115 typedef __uint64_t OM_uint64;
116 
117 typedef struct gss_OID_desc_struct {
118   OM_uint32 length;
119   void      *elements;
120 } gss_OID_desc, *gss_OID;
121 
122 #endif
123 
124 typedef struct gss_OID_set_desc_struct  {
125   size_t     count;
126   gss_OID    elements;
127 } gss_OID_set_desc, *gss_OID_set;
128 
129 typedef struct gss_buffer_desc_struct {
130   size_t length;
131   void *value;
132 } gss_buffer_desc, *gss_buffer_t;
133 
134 typedef struct gss_channel_bindings_struct {
135   OM_uint32 initiator_addrtype;
136   gss_buffer_desc initiator_address;
137   OM_uint32 acceptor_addrtype;
138   gss_buffer_desc acceptor_address;
139   gss_buffer_desc application_data;
140 } *gss_channel_bindings_t;
141 
142 /*
143  * For now, define a QOP-type as an OM_uint32
144  */
145 typedef OM_uint32 gss_qop_t;
146 
147 typedef int gss_cred_usage_t;
148 
149 /*
150  * Flag bits for context-level services.
151  */
152 #define GSS_C_DELEG_FLAG      1
153 #define GSS_C_MUTUAL_FLAG     2
154 #define GSS_C_REPLAY_FLAG     4
155 #define GSS_C_SEQUENCE_FLAG   8
156 #define GSS_C_CONF_FLAG       16
157 #define GSS_C_INTEG_FLAG      32
158 #define GSS_C_ANON_FLAG       64
159 #define GSS_C_PROT_READY_FLAG 128
160 #define GSS_C_TRANS_FLAG      256
161 
162 /*
163  * Credential usage options
164  */
165 #define GSS_C_BOTH     0
166 #define GSS_C_INITIATE 1
167 #define GSS_C_ACCEPT   2
168 
169 /*
170  * Status code types for gss_display_status
171  */
172 #define GSS_C_GSS_CODE  1
173 #define GSS_C_MECH_CODE 2
174 
175 /*
176  * The constant definitions for channel-bindings address families
177  */
178 #define GSS_C_AF_UNSPEC     0
179 #define GSS_C_AF_LOCAL      1
180 #define GSS_C_AF_INET       2
181 #define GSS_C_AF_IMPLINK    3
182 #define GSS_C_AF_PUP        4
183 #define GSS_C_AF_CHAOS      5
184 #define GSS_C_AF_NS         6
185 #define GSS_C_AF_NBS        7
186 #define GSS_C_AF_ECMA       8
187 #define GSS_C_AF_DATAKIT    9
188 #define GSS_C_AF_CCITT      10
189 #define GSS_C_AF_SNA        11
190 #define GSS_C_AF_DECnet     12
191 #define GSS_C_AF_DLI        13
192 #define GSS_C_AF_LAT        14
193 #define GSS_C_AF_HYLINK     15
194 #define GSS_C_AF_APPLETALK  16
195 #define GSS_C_AF_BSC        17
196 #define GSS_C_AF_DSS        18
197 #define GSS_C_AF_OSI        19
198 #define GSS_C_AF_X25        21
199 #define GSS_C_AF_NULLADDR   255
200 
201 /*
202  * Various Null values
203  */
204 #define GSS_C_NO_NAME ((gss_name_t) 0)
205 #define GSS_C_NO_BUFFER ((gss_buffer_t) 0)
206 #define GSS_C_NO_OID ((gss_OID) 0)
207 #define GSS_C_NO_OID_SET ((gss_OID_set) 0)
208 #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
209 #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
210 #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
211 #define GSS_C_EMPTY_BUFFER {0, NULL}
212 
213 /*
214  * Some alternate names for a couple of the above
215  * values.  These are defined for V1 compatibility.
216  */
217 #define GSS_C_NULL_OID GSS_C_NO_OID
218 #define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET
219 
220 /*
221  * Define the default Quality of Protection for per-message
222  * services.  Note that an implementation that offers multiple
223  * levels of QOP may define GSS_C_QOP_DEFAULT to be either zero
224  * (as done here) to mean "default protection", or to a specific
225  * explicit QOP value.  However, a value of 0 should always be
226  * interpreted by a GSS-API implementation as a request for the
227  * default protection level.
228  */
229 #define GSS_C_QOP_DEFAULT 0
230 
231 /*
232  * Expiration time of 2^32-1 seconds means infinite lifetime for a
233  * credential or security context
234  */
235 #define GSS_C_INDEFINITE 0xfffffffful
236 
237 /*
238  * The implementation must reserve static storage for a
239  * gss_OID_desc object containing the value
240  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
241  * "\x01\x02\x01\x01"},
242  * corresponding to an object-identifier value of
243  * {iso(1) member-body(2) United States(840) mit(113554)
244  * infosys(1) gssapi(2) generic(1) user_name(1)}.  The constant
245  * GSS_C_NT_USER_NAME should be initialized to point
246  * to that gss_OID_desc.
247  */
248 extern gss_OID GSS_C_NT_USER_NAME;
249 
250 /*
251  * The implementation must reserve static storage for a
252  * gss_OID_desc object containing the value
253  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
254  *              "\x01\x02\x01\x02"},
255  * corresponding to an object-identifier value of
256  * {iso(1) member-body(2) United States(840) mit(113554)
257  * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.
258  * The constant GSS_C_NT_MACHINE_UID_NAME should be
259  * initialized to point to that gss_OID_desc.
260  */
261 extern gss_OID GSS_C_NT_MACHINE_UID_NAME;
262 
263 /*
264  * The implementation must reserve static storage for a
265  * gss_OID_desc object containing the value
266  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
267  *              "\x01\x02\x01\x03"},
268  * corresponding to an object-identifier value of
269  * {iso(1) member-body(2) United States(840) mit(113554)
270  * infosys(1) gssapi(2) generic(1) string_uid_name(3)}.
271  * The constant GSS_C_NT_STRING_UID_NAME should be
272  * initialized to point to that gss_OID_desc.
273  */
274 extern gss_OID GSS_C_NT_STRING_UID_NAME;
275 
276 /*
277  * The implementation must reserve static storage for a
278  * gss_OID_desc object containing the value
279  * {6, (void *)"\x2b\x06\x01\x05\x06\x02"},
280  * corresponding to an object-identifier value of
281  * {iso(1) org(3) dod(6) internet(1) security(5)
282  * nametypes(6) gss-host-based-services(2)).  The constant
283  * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point
284  * to that gss_OID_desc.  This is a deprecated OID value, and
285  * implementations wishing to support hostbased-service names
286  * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID,
287  * defined below, to identify such names;
288  * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym
289  * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input
290  * parameter, but should not be emitted by GSS-API
291  * implementations
292  */
293 extern gss_OID GSS_C_NT_HOSTBASED_SERVICE_X;
294 
295 /*
296  * The implementation must reserve static storage for a
297  * gss_OID_desc object containing the value
298  * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
299  *              "\x01\x02\x01\x04"}, corresponding to an
300  * object-identifier value of {iso(1) member-body(2)
301  * Unites States(840) mit(113554) infosys(1) gssapi(2)
302  * generic(1) service_name(4)}.  The constant
303  * GSS_C_NT_HOSTBASED_SERVICE should be initialized
304  * to point to that gss_OID_desc.
305  */
306 extern gss_OID GSS_C_NT_HOSTBASED_SERVICE;
307 
308 /*
309  * The implementation must reserve static storage for a
310  * gss_OID_desc object containing the value
311  * {6, (void *)"\x2b\x06\01\x05\x06\x03"},
312  * corresponding to an object identifier value of
313  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
314  * 6(nametypes), 3(gss-anonymous-name)}.  The constant
315  * and GSS_C_NT_ANONYMOUS should be initialized to point
316  * to that gss_OID_desc.
317  */
318 extern gss_OID GSS_C_NT_ANONYMOUS;
319 
320 
321 /*
322  * The implementation must reserve static storage for a
323  * gss_OID_desc object containing the value
324  * {6, (void *)"\x2b\x06\x01\x05\x06\x04"},
325  * corresponding to an object-identifier value of
326  * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
327  * 6(nametypes), 4(gss-api-exported-name)}.  The constant
328  * GSS_C_NT_EXPORT_NAME should be initialized to point
329  * to that gss_OID_desc.
330  */
331 extern gss_OID GSS_C_NT_EXPORT_NAME;
332 
333 /*
334  *   This name form shall be represented by the Object Identifier {iso(1)
335  *   member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
336  *   krb5(2) krb5_name(1)}.  The recommended symbolic name for this type
337  *   is "GSS_KRB5_NT_PRINCIPAL_NAME".
338  */
339 extern gss_OID GSS_KRB5_NT_PRINCIPAL_NAME;
340 
341 /*
342  * This name form shall be represented by the Object Identifier {iso(1)
343  * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
344  * generic(1) user_name(1)}.  The recommended symbolic name for this
345  * type is "GSS_KRB5_NT_USER_NAME".
346  */
347 extern gss_OID GSS_KRB5_NT_USER_NAME;
348 
349 /*
350  * This name form shall be represented by the Object Identifier {iso(1)
351  * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
352  * generic(1) machine_uid_name(2)}.  The recommended symbolic name for
353  * this type is "GSS_KRB5_NT_MACHINE_UID_NAME".
354  */
355 extern gss_OID GSS_KRB5_NT_MACHINE_UID_NAME;
356 
357 /*
358  * This name form shall be represented by the Object Identifier {iso(1)
359  * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2)
360  * generic(1) string_uid_name(3)}.  The recommended symbolic name for
361  * this type is "GSS_KRB5_NT_STRING_UID_NAME".
362  */
363 extern gss_OID GSS_KRB5_NT_STRING_UID_NAME;
364 
365 /* Major status codes */
366 
367 #define GSS_S_COMPLETE 0
368 
369 /*
370  * Some "helper" definitions to make the status code macros obvious.
371  */
372 #define GSS_C_CALLING_ERROR_OFFSET 24
373 #define GSS_C_ROUTINE_ERROR_OFFSET 16
374 #define GSS_C_SUPPLEMENTARY_OFFSET 0
375 #define GSS_C_CALLING_ERROR_MASK 0377ul
376 #define GSS_C_ROUTINE_ERROR_MASK 0377ul
377 #define GSS_C_SUPPLEMENTARY_MASK 0177777ul
378 
379 /*
380  * The macros that test status codes for error conditions.
381  * Note that the GSS_ERROR() macro has changed slightly from
382  * the V1 GSS-API so that it now evaluates its argument
383  * only once.
384  */
385 #define GSS_CALLING_ERROR(x) \
386  (x & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
387 #define GSS_ROUTINE_ERROR(x) \
388  (x & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
389 #define GSS_SUPPLEMENTARY_INFO(x) \
390  (x & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
391 #define GSS_ERROR(x) \
392  (x & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \
393        (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))
394 
395 /*
396  * Now the actual status code definitions
397  */
398 
399 /*
400  * Calling errors:
401  */
402 #define GSS_S_CALL_INACCESSIBLE_READ \
403 (1ul << GSS_C_CALLING_ERROR_OFFSET)
404 #define GSS_S_CALL_INACCESSIBLE_WRITE \
405 (2ul << GSS_C_CALLING_ERROR_OFFSET)
406 #define GSS_S_CALL_BAD_STRUCTURE \
407 (3ul << GSS_C_CALLING_ERROR_OFFSET)
408 
409 /*
410  * Routine errors:
411  */
412 #define GSS_S_BAD_MECH             (1ul << GSS_C_ROUTINE_ERROR_OFFSET)
413 #define GSS_S_BAD_NAME             (2ul << GSS_C_ROUTINE_ERROR_OFFSET)
414 #define GSS_S_BAD_NAMETYPE         (3ul << GSS_C_ROUTINE_ERROR_OFFSET)
415 #define GSS_S_BAD_BINDINGS         (4ul << GSS_C_ROUTINE_ERROR_OFFSET)
416 #define GSS_S_BAD_STATUS           (5ul << GSS_C_ROUTINE_ERROR_OFFSET)
417 #define GSS_S_BAD_SIG              (6ul << GSS_C_ROUTINE_ERROR_OFFSET)
418 #define GSS_S_BAD_MIC		   GSS_S_BAD_SIG
419 #define GSS_S_NO_CRED              (7ul << GSS_C_ROUTINE_ERROR_OFFSET)
420 #define GSS_S_NO_CONTEXT           (8ul << GSS_C_ROUTINE_ERROR_OFFSET)
421 #define GSS_S_DEFECTIVE_TOKEN      (9ul << GSS_C_ROUTINE_ERROR_OFFSET)
422 #define GSS_S_DEFECTIVE_CREDENTIAL (10ul << GSS_C_ROUTINE_ERROR_OFFSET)
423 #define GSS_S_CREDENTIALS_EXPIRED  (11ul << GSS_C_ROUTINE_ERROR_OFFSET)
424 #define GSS_S_CONTEXT_EXPIRED      (12ul << GSS_C_ROUTINE_ERROR_OFFSET)
425 #define GSS_S_FAILURE              (13ul << GSS_C_ROUTINE_ERROR_OFFSET)
426 #define GSS_S_BAD_QOP              (14ul << GSS_C_ROUTINE_ERROR_OFFSET)
427 #define GSS_S_UNAUTHORIZED         (15ul << GSS_C_ROUTINE_ERROR_OFFSET)
428 #define GSS_S_UNAVAILABLE          (16ul << GSS_C_ROUTINE_ERROR_OFFSET)
429 #define GSS_S_DUPLICATE_ELEMENT    (17ul << GSS_C_ROUTINE_ERROR_OFFSET)
430 #define GSS_S_NAME_NOT_MN          (18ul << GSS_C_ROUTINE_ERROR_OFFSET)
431 
432 /*
433  * Supplementary info bits:
434  */
435 #define GSS_S_CONTINUE_NEEDED \
436 	 (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
437 #define GSS_S_DUPLICATE_TOKEN \
438 	 (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
439 #define GSS_S_OLD_TOKEN \
440 	 (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
441 #define GSS_S_UNSEQ_TOKEN \
442 	 (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 3))
443 #define GSS_S_GAP_TOKEN \
444 	 (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 4))
445 
446 __BEGIN_DECLS
447 
448 /*
449  * Finally, function prototypes for the GSS-API routines.
450  */
451 OM_uint32 gss_acquire_cred
452 	      (OM_uint32 *,            /* minor_status */
453 	       const gss_name_t,       /* desired_name */
454 	       OM_uint32,              /* time_req */
455 	       const gss_OID_set,      /* desired_mechs */
456 	       gss_cred_usage_t,       /* cred_usage */
457 	       gss_cred_id_t *,        /* output_cred_handle */
458 	       gss_OID_set *,          /* actual_mechs */
459 	       OM_uint32 *             /* time_rec */
460 	      );
461 
462 OM_uint32 gss_release_cred
463 	      (OM_uint32 *,            /* minor_status */
464 	       gss_cred_id_t *         /* cred_handle */
465 	      );
466 
467 OM_uint32 gss_init_sec_context
468 	      (OM_uint32 *,            /* minor_status */
469 	       const gss_cred_id_t,    /* initiator_cred_handle */
470 	       gss_ctx_id_t *,         /* context_handle */
471 	       const gss_name_t,       /* target_name */
472 	       const gss_OID,          /* mech_type */
473 	       OM_uint32,              /* req_flags */
474 	       OM_uint32,              /* time_req */
475 	       const gss_channel_bindings_t,
476 				       /* input_chan_bindings */
477 	       const gss_buffer_t,     /* input_token */
478 	       gss_OID *,              /* actual_mech_type */
479 	       gss_buffer_t,           /* output_token */
480 	       OM_uint32 *,            /* ret_flags */
481 	       OM_uint32 *             /* time_rec */
482 	      );
483 
484 OM_uint32 gss_accept_sec_context
485 	      (OM_uint32 *,            /* minor_status */
486 	       gss_ctx_id_t *,         /* context_handle */
487 	       const gss_cred_id_t,    /* acceptor_cred_handle */
488 	       const gss_buffer_t,     /* input_token_buffer */
489 	       const gss_channel_bindings_t,
490 				       /* input_chan_bindings */
491 	       gss_name_t *,           /* src_name */
492 	       gss_OID *,              /* mech_type */
493 	       gss_buffer_t,           /* output_token */
494 	       OM_uint32 *,            /* ret_flags */
495 	       OM_uint32 *,            /* time_rec */
496 	       gss_cred_id_t *         /* delegated_cred_handle */
497 	      );
498 
499 OM_uint32 gss_process_context_token
500 	      (OM_uint32 *,            /* minor_status */
501 	       const gss_ctx_id_t,     /* context_handle */
502 	       const gss_buffer_t      /* token_buffer */
503 	      );
504 
505 OM_uint32 gss_delete_sec_context
506 	      (OM_uint32 *,            /* minor_status */
507 	       gss_ctx_id_t *,         /* context_handle */
508 	       gss_buffer_t            /* output_token */
509 	      );
510 
511 OM_uint32 gss_context_time
512 	      (OM_uint32 *,            /* minor_status */
513 	       const gss_ctx_id_t,     /* context_handle */
514 	       OM_uint32 *             /* time_rec */
515 	      );
516 
517 OM_uint32 gss_get_mic
518 	      (OM_uint32 *,            /* minor_status */
519 	       const gss_ctx_id_t,     /* context_handle */
520 	       gss_qop_t,              /* qop_req */
521 	       const gss_buffer_t,     /* message_buffer */
522 	       gss_buffer_t            /* message_token */
523 	      );
524 
525 OM_uint32 gss_verify_mic
526 	      (OM_uint32 *,            /* minor_status */
527 	       const gss_ctx_id_t,     /* context_handle */
528 	       const gss_buffer_t,     /* message_buffer */
529 	       const gss_buffer_t,     /* token_buffer */
530 	       gss_qop_t *             /* qop_state */
531 	      );
532 
533 OM_uint32 gss_wrap
534 	      (OM_uint32 *,            /* minor_status */
535 	       const gss_ctx_id_t,     /* context_handle */
536 	       int,                    /* conf_req_flag */
537 	       gss_qop_t,              /* qop_req */
538 	       const gss_buffer_t,     /* input_message_buffer */
539 	       int *,                  /* conf_state */
540 	       gss_buffer_t            /* output_message_buffer */
541 	      );
542 
543 OM_uint32 gss_unwrap
544 	      (OM_uint32 *,            /* minor_status */
545 	       const gss_ctx_id_t,     /* context_handle */
546 	       const gss_buffer_t,     /* input_message_buffer */
547 	       gss_buffer_t,           /* output_message_buffer */
548 	       int *,                  /* conf_state */
549 	       gss_qop_t *             /* qop_state */
550 	      );
551 
552 OM_uint32 gss_display_status
553 	      (OM_uint32 *,            /* minor_status */
554 	       OM_uint32,              /* status_value */
555 	       int,                    /* status_type */
556 	       const gss_OID,          /* mech_type */
557 	       OM_uint32 *,            /* message_context */
558 	       gss_buffer_t            /* status_string */
559 	      );
560 
561 OM_uint32 gss_indicate_mechs
562 	      (OM_uint32 *,            /* minor_status */
563 	       gss_OID_set *           /* mech_set */
564 	      );
565 
566 OM_uint32 gss_compare_name
567 	      (OM_uint32 *,            /* minor_status */
568 	       const gss_name_t,       /* name1 */
569 	       const gss_name_t,       /* name2 */
570 	       int *                   /* name_equal */
571 	      );
572 
573 OM_uint32 gss_display_name
574 	      (OM_uint32 *,            /* minor_status */
575 	       const gss_name_t,       /* input_name */
576 	       gss_buffer_t,           /* output_name_buffer */
577 	       gss_OID *               /* output_name_type */
578 	      );
579 
580 OM_uint32 gss_import_name
581 	      (OM_uint32 *,            /* minor_status */
582 	       const gss_buffer_t,     /* input_name_buffer */
583 	       const gss_OID,          /* input_name_type */
584 	       gss_name_t *            /* output_name */
585 	      );
586 
587 OM_uint32 gss_export_name
588 	      (OM_uint32 *,            /* minor_status */
589 	       const gss_name_t,       /* input_name */
590 	       gss_buffer_t            /* exported_name */
591 	      );
592 
593 OM_uint32 gss_release_name
594 	      (OM_uint32 *,            /* minor_status */
595 	       gss_name_t *            /* input_name */
596 	      );
597 
598 OM_uint32 gss_release_buffer
599 	      (OM_uint32 *,            /* minor_status */
600 	       gss_buffer_t            /* buffer */
601 	      );
602 
603 OM_uint32 gss_release_oid_set
604 	      (OM_uint32 *,            /* minor_status */
605 	       gss_OID_set *           /* set */
606 	      );
607 
608 OM_uint32 gss_inquire_cred
609 	      (OM_uint32 *,            /* minor_status */
610 	       const gss_cred_id_t,    /* cred_handle */
611 	       gss_name_t *,           /* name */
612 	       OM_uint32 *,            /* lifetime */
613 	       gss_cred_usage_t *,     /* cred_usage */
614 	       gss_OID_set *           /* mechanisms */
615 	      );
616 
617 OM_uint32 gss_inquire_context (
618 	       OM_uint32 *,            /* minor_status */
619 	       const gss_ctx_id_t,     /* context_handle */
620 	       gss_name_t *,           /* src_name */
621 	       gss_name_t *,           /* targ_name */
622 	       OM_uint32 *,            /* lifetime_rec */
623 	       gss_OID *,              /* mech_type */
624 	       OM_uint32 *,            /* ctx_flags */
625 	       int *,                  /* locally_initiated */
626 	       int *                   /* open */
627 	      );
628 
629 OM_uint32 gss_wrap_size_limit (
630 	       OM_uint32 *,            /* minor_status */
631 	       const gss_ctx_id_t,     /* context_handle */
632 	       int,                    /* conf_req_flag */
633 	       gss_qop_t,              /* qop_req */
634 	       OM_uint32,              /* req_output_size */
635 	       OM_uint32 *             /* max_input_size */
636 	      );
637 
638 OM_uint32 gss_add_cred (
639 	       OM_uint32 *,            /* minor_status */
640 	       const gss_cred_id_t,    /* input_cred_handle */
641 	       const gss_name_t,       /* desired_name */
642 	       const gss_OID,          /* desired_mech */
643 	       gss_cred_usage_t,       /* cred_usage */
644 	       OM_uint32,              /* initiator_time_req */
645 	       OM_uint32,              /* acceptor_time_req */
646 	       gss_cred_id_t *,        /* output_cred_handle */
647 	       gss_OID_set *,          /* actual_mechs */
648 	       OM_uint32 *,            /* initiator_time_rec */
649 	       OM_uint32 *             /* acceptor_time_rec */
650 	      );
651 
652 OM_uint32 gss_inquire_cred_by_mech (
653 	       OM_uint32 *,            /* minor_status */
654 	       const gss_cred_id_t,    /* cred_handle */
655 	       const gss_OID,          /* mech_type */
656 	       gss_name_t *,           /* name */
657 	       OM_uint32 *,            /* initiator_lifetime */
658 	       OM_uint32 *,            /* acceptor_lifetime */
659 	       gss_cred_usage_t *      /* cred_usage */
660 	      );
661 
662 OM_uint32 gss_export_sec_context (
663 	       OM_uint32 *,            /* minor_status */
664 	       gss_ctx_id_t *,         /* context_handle */
665 	       gss_buffer_t            /* interprocess_token */
666 	      );
667 
668 OM_uint32 gss_import_sec_context (
669 	       OM_uint32 *,            /* minor_status */
670 	       const gss_buffer_t,     /* interprocess_token */
671 	       gss_ctx_id_t *          /* context_handle */
672 	      );
673 
674 OM_uint32 gss_create_empty_oid_set (
675 	       OM_uint32 *,            /* minor_status */
676 	       gss_OID_set *           /* oid_set */
677 	      );
678 
679 OM_uint32 gss_add_oid_set_member (
680 	       OM_uint32 *,            /* minor_status */
681 	       const gss_OID,          /* member_oid */
682 	       gss_OID_set *           /* oid_set */
683 	      );
684 
685 OM_uint32 gss_test_oid_set_member (
686 	       OM_uint32 *,            /* minor_status */
687 	       const gss_OID,          /* member */
688 	       const gss_OID_set,      /* set */
689 	       int *                   /* present */
690 	      );
691 
692 OM_uint32 gss_inquire_names_for_mech (
693 	       OM_uint32 *,            /* minor_status */
694 	       const gss_OID,          /* mechanism */
695 	       gss_OID_set *           /* name_types */
696 	      );
697 
698 OM_uint32 gss_inquire_mechs_for_name (
699 	       OM_uint32 *,            /* minor_status */
700 	       const gss_name_t,       /* input_name */
701 	       gss_OID_set *           /* mech_types */
702 	      );
703 
704 OM_uint32 gss_canonicalize_name (
705 	       OM_uint32 *,            /* minor_status */
706 	       const gss_name_t,       /* input_name */
707 	       const gss_OID,          /* mech_type */
708 	       gss_name_t *            /* output_name */
709 	      );
710 
711 OM_uint32 gss_duplicate_name (
712 	       OM_uint32 *,            /* minor_status */
713 	       const gss_name_t,       /* src_name */
714 	       gss_name_t *            /* dest_name */
715 	      );
716 
717 /*
718  * The following routines are obsolete variants of gss_get_mic,
719  * gss_verify_mic, gss_wrap and gss_unwrap.  They should be
720  * provided by GSS-API V2 implementations for backwards
721  * compatibility with V1 applications.  Distinct entrypoints
722  * (as opposed to #defines) should be provided, both to allow
723  * GSS-API V1 applications to link against GSS-API V2 implementations,
724  * and to retain the slight parameter type differences between the
725  * obsolete versions of these routines and their current forms.
726  */
727 
728 OM_uint32 gss_sign
729 	      (OM_uint32 *,       /* minor_status */
730 	       gss_ctx_id_t,      /* context_handle */
731 	       int,               /* qop_req */
732 	       gss_buffer_t,      /* message_buffer */
733 	       gss_buffer_t       /* message_token */
734 	      );
735 
736 
737 OM_uint32 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 
745 OM_uint32 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 
755 
756 OM_uint32 gss_unseal
757 	      (OM_uint32 *,       /* minor_status */
758 	       gss_ctx_id_t,      /* context_handle */
759 	       gss_buffer_t,      /* input_message_buffer */
760 	       gss_buffer_t,      /* output_message_buffer */
761 	       int *,             /* conf_state */
762 	       int *              /* qop_state */
763 	      );
764 
765 /*
766  * Other extensions and helper functions.
767  */
768 
769 int gss_oid_equal
770 	      (const gss_OID,	  /* first OID to compare */
771 	       const gss_OID	  /* second OID to compare */
772 	      );
773 
774 OM_uint32 gss_release_oid
775 	      (OM_uint32 *,	  /* minor status */
776 	       gss_OID *	  /* oid to free */
777 	      );
778 
779 OM_uint32 gss_decapsulate_token
780 	      (const gss_buffer_t,  /* mechanism independent token */
781 	       gss_OID,		 /* desired mechanism */
782 	       gss_buffer_t	 /* decapsulated mechanism dependent token */
783 	      );
784 
785 OM_uint32 gss_encapsulate_token
786 	      (const gss_buffer_t,  /* mechanism dependent token */
787 	       gss_OID,		 /* desired mechanism */
788 	       gss_buffer_t	 /* encapsulated mechanism independent token */
789 	      );
790 
791 OM_uint32 gss_duplicate_oid
792               (OM_uint32 *,	/* minor status */
793 	       const gss_OID,	/* oid to copy */
794 	       gss_OID *	/* result */
795 	      );
796 
797 OM_uint32 gss_oid_to_str
798 	      (OM_uint32 *,	/* minor status */
799 	       gss_OID,		/* oid to convert */
800 	       gss_buffer_t	/* buffer to contain string */
801 	      );
802 
803 typedef struct gss_buffer_set_desc_struct  {
804   size_t	count;
805   gss_buffer_desc *elements;
806 } gss_buffer_set_desc, *gss_buffer_set_t;
807 
808 #define GSS_C_NO_BUFFER_SET ((gss_buffer_set_t) 0)
809 
810 OM_uint32 gss_create_empty_buffer_set
811 	      (OM_uint32 *,		/* minor status */
812 	       gss_buffer_set_t *	/* location for new buffer set */
813 	      );
814 
815 OM_uint32 gss_add_buffer_set_member
816 	      (OM_uint32 *,		/* minor status */
817 	       gss_buffer_t,		/* buffer to add */
818 	       gss_buffer_set_t *	/* set to add to */
819 	      );
820 
821 OM_uint32 gss_release_buffer_set
822 	      (OM_uint32 *,		/* minor status */
823 	       gss_buffer_set_t *	/* set to release */
824 	      );
825 
826 OM_uint32 gss_inquire_sec_context_by_oid
827 	      (OM_uint32 *,		/* minor_status */
828 	       const gss_ctx_id_t,	/* context_handle */
829 	       const gss_OID,		/* desired_object */
830 	       gss_buffer_set_t *	/* result */
831 	      );
832 
833 OM_uint32 gss_inquire_cred_by_oid
834 	      (OM_uint32 *,		/* minor_status */
835 	       const gss_cred_id_t,	/* cred_handle */
836 	       const gss_OID,		/* desired_object */
837 	       gss_buffer_set_t *	/* result */
838 	      );
839 
840 OM_uint32 gss_set_sec_context_option
841 	      (OM_uint32 *,		/* minor status */
842 	       gss_ctx_id_t *,		/* context */
843 	       const gss_OID,		/* option to set */
844 	       const gss_buffer_t	/* option value */
845 	      );
846 
847 OM_uint32 gss_set_cred_option
848 	      (OM_uint32 *,		/* minor status */
849 	       gss_cred_id_t *,		/* cred */
850 	       const gss_OID,		/* option to set */
851 	       const gss_buffer_t	/* option value */
852 	      );
853 
854 OM_uint32 gss_pseudo_random
855 	      (OM_uint32 *,		/* minor status */
856 	       gss_ctx_id_t,		/* context handle */
857 	       int prf_key,		/* XXX */
858 	       const gss_buffer_t,	/* data to seed generator */
859 	       ssize_t,			/* amount of data required */
860 	       gss_buffer_t		/* buffer for result */
861 	      );
862 
863 #ifdef _UID_T_DECLARED
864 OM_uint32 gss_pname_to_uid
865 	      (OM_uint32 *,		/* minor status */
866 	       const gss_name_t pname,	/* principal name */
867 	       const gss_OID mech,	/* mechanism to query */
868 	       uid_t *uidp		/* pointer to UID for result */
869 	      );
870 #endif
871 
872 __END_DECLS
873 
874 #endif /* _GSSAPI_GSSAPI_H_ */
875