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