1
2
3
4
5
6
7Network Working Group                                            J. Wray
8Request for Comments: 1509                 Digital Equipment Corporation
9                                                          September 1993
10
11
12               Generic Security Service API : C-bindings
13
14Status of this Memo
15
16   This RFC specifies an Internet standards track protocol for the
17   Internet community, and requests discussion and suggestions for
18   improvements.  Please refer to the current edition of the "Internet
19   Official Protocol Standards" for the standardization state and status
20   of this protocol.  Distribution of this memo is unlimited.
21
22Abstract
23
24   This document specifies C language bindings for the Generic Security
25   Service Application Program Interface (GSS-API), which is described
26   at a language-independent conceptual level in other documents.
27
28   The Generic Security Service Application Programming Interface (GSS-
29   API) provides security services to its callers, and is intended for
30   implementation atop alternative underlying cryptographic mechanisms.
31   Typically, GSS-API callers will be application protocols into which
32   security enhancements are integrated through invocation of services
33   provided by the GSS-API. The GSS-API allows a caller application to
34   authenticate a principal identity associated with a peer application,
35   to delegate rights to a peer, and to apply security services such as
36   confidentiality and integrity on a per-message basis.
37
381. INTRODUCTION
39
40   The Generic Security Service Application Programming Interface [1]
41   provides security services to calling applications.  It allows a
42   communicating application to authenticate the user associated with
43   another application, to delegate rights to another application, and
44   to apply security services such as confidentiality and integrity on a
45   per-message basis.
46
47   There are four stages to using the GSSAPI:
48
49   (a) The application acquires a set of credentials with which it may
50       prove its identity to other processes.  The application's
51       credentials vouch for its global identity, which may or may not
52       be related to the local username under which it is running.
53
54
55
56
57
58Wray                                                            [Page 1]
59
60RFC 1509            GSSAPI - Overview and C bindings      September 1993
61
62
63   (b) A pair of communicating applications establish a joint security
64       context using their credentials.  The security context is a
65       pair of GSSAPI data structures that contain shared state
66       information, which is required in order that per-message
67       security services may be provided.  As part of the
68       establishment of a security context, the context initiator is
69       authenticated to the responder, and may require that the
70       responder is authenticated in turn.  The initiator may
71       optionally give the responder the right to initiate further
72       security contexts.  This transfer of rights is termed
73       delegation, and is achieved by creating a set of credentials,
74       similar to those used by the originating application, but which
75       may be used by the responder.  To establish and maintain the
76       shared information that makes up the security context, certain
77       GSSAPI calls will return a token data structure, which is a
78       cryptographically protected opaque data type.  The caller of
79       such a GSSAPI routine is responsible for transferring the token
80       to the peer application, which should then pass it to a
81       corresponding GSSAPI routine which will decode it and extract
82       the information.
83
84   (c) Per-message services are invoked to apply either:
85
86       (i) integrity and data origin authentication, or
87
88       (ii) confidentiality, integrity and data origin authentication
89            to application data, which are treated by GSSAPI as
90            arbitrary octet-strings.  The application transmitting a
91            message that it wishes to protect will call the appropriate
92            GSSAPI routine (sign or seal) to apply protection, specifying
93            the appropriate security context, and send the result to the
94            receiving application.  The receiver will pass the received
95            data to the corresponding decoding routine (verify or unseal)
96            to remove the protection and validate the data.
97
98   (d) At the completion of a communications session (which may extend
99       across several connections), the peer applications call GSSAPI
100       routines to delete the security context.  Multiple contexts may
101       also be used (either successively or simultaneously) within a
102       single communications association.
103
1042. GSSAPI Routines
105
106   This section lists the functions performed by each of the GSSAPI
107   routines and discusses their major parameters, describing how they
108   are to be passed to the routines.  The routines are listed in figure
109   4-1.
110
111
112
113
114Wray                                                            [Page 2]
115
116RFC 1509            GSSAPI - Overview and C bindings      September 1993
117
118
119                      Figure 4-1  GSSAPI Routines
120
121
122            Routine                               Function
123
124            gss_acquire_cred               Assume a global identity
125
126            gss_release_cred               Discard credentials
127
128            gss_init_sec_context           Initiate a security context
129                                           with a peer application
130
131            gss_accept_sec_context         Accept a security context
132                                           initiated by a peer
133                                           application
134
135            gss_process_context_token      Process a token on a security
136                                           context from a peer
137                                           application
138
139            gss_delete_sec_context         Discard a security context
140
141            gss_context_time               Determine for how long a
142                                           context will remain valid
143
144            gss_sign                       Sign a message; integrity
145                                           service
146
147            gss_verify                     Check signature on a message
148
149            gss_seal                       Sign (optionally encrypt) a
150                                           message; confidentiality
151                                           service
152
153            gss_unseal                     Verify (optionally decrypt)
154                                           message
155
156            gss_display_status             Convert an API status code
157                                           to text
158
159            gss_indicate_mechs             Determine underlying
160                                           authentication mechanism
161
162            gss_compare_name               Compare two internal-form
163                                           names
164
165            gss_display_name               Convert opaque name to text
166
167
168
169
170Wray                                                            [Page 3]
171
172RFC 1509            GSSAPI - Overview and C bindings      September 1993
173
174
175            gss_import_name                Convert a textual name to
176                                           internal-form
177
178            gss_release_name               Discard an internal-form
179                                           name
180
181            gss_release_buffer             Discard a buffer
182
183            gss_release_oid_set            Discard a set of object
184                                           identifiers
185
186            gss_inquire_cred               Determine information about
187                                           a credential
188
189   Individual GSSAPI implementations may augment these routines by
190   providing additional mechanism-specific routines if required
191   functionality is not available from the generic forms.  Applications
192   are encouraged to use the generic routines wherever possible on
193   portability grounds.
194
1952.1. Data Types and Calling Conventions
196
197   The following conventions are used by the GSSAPI:
198
1992.1.1. Structured data types
200
201   Wherever these GSSAPI C-bindings describe structured data, only
202   fields that must be provided by all GSSAPI implementation are
203   documented.  Individual implementations may provide additional
204   fields, either for internal use within GSSAPI routines, or for use by
205   non-portable applications.
206
2072.1.2. Integer types
208
209   GSSAPI defines the following integer data type:
210
211                 OM_uint32      32-bit unsigned integer
212
213   Where guaranteed minimum bit-count is important, this portable data
214   type is used by the GSSAPI routine definitions. Individual GSSAPI
215   implementations will include appropriate typedef definitions to map
216   this type onto a built-in data type.
217
2182.1.3. String and similar data
219
220   Many of the GSSAPI routines take arguments and return values that
221   describe contiguous multiple-byte data.  All such data is passed
222   between the GSSAPI and the caller using the gss_buffer_t data type.
223
224
225
226Wray                                                            [Page 4]
227
228RFC 1509            GSSAPI - Overview and C bindings      September 1993
229
230
231   This data type is a pointer to a buffer descriptor, which consists of
232   a length field that contains the total number of bytes in the datum,
233   and a value field which contains a pointer to the actual datum:
234
235                 typedef struct gss_buffer_desc_struct {
236                    size_t  length;
237                    void    *value;
238                 } gss_buffer_desc, *gss_buffer_t;
239
240   Storage for data passed to the application by a GSSAPI routine using
241   the gss_buffer_t conventions is allocated by the GSSAPI routine.  The
242   application may free this storage by invoking the gss_release_buffer
243   routine.  Allocation of the gss_buffer_desc object is always the
244   responsibility of the application;  Unused gss_buffer_desc objects
245   may be initialized to the value GSS_C_EMPTY_BUFFER.
246
2472.1.3.1. Opaque data types
248
249   Certain multiple-word data items are considered opaque data types at
250   the GSSAPI, because their internal structure has no significance
251   either to the GSSAPI or to the caller.  Examples of such opaque data
252   types are the input_token parameter to gss_init_sec_context (which is
253   opaque to the caller), and the input_message parameter to gss_seal
254   (which is opaque to the GSSAPI).  Opaque data is passed between the
255   GSSAPI and the application using the gss_buffer_t datatype.
256
2572.1.3.2. Character strings
258
259   Certain multiple-word data items may be regarded as simple ISO
260   Latin-1 character strings.  An example of this is the
261   input_name_buffer parameter to gss_import_name.  Some GSSAPI routines
262   also return character strings.  Character strings are passed between
263   the application and the GSSAPI using the gss_buffer_t datatype,
264   defined earlier.
265
2662.1.4. Object Identifiers
267
268   Certain GSSAPI procedures take parameters of the type gss_OID, or
269   Object identifier.  This is a type containing ISO-defined tree-
270   structured values, and is used by the GSSAPI caller to select an
271   underlying security mechanism.  A value of type gss_OID has the
272   following structure:
273
274                 typedef struct gss_OID_desc_struct {
275                    OM_uint32 length;
276                    void      *elements;
277                 } gss_OID_desc, *gss_OID;
278
279
280
281
282Wray                                                            [Page 5]
283
284RFC 1509            GSSAPI - Overview and C bindings      September 1993
285
286
287   The elements field of this structure points to the first byte of an
288   octet string containing the ASN.1 BER encoding of the value of the
289   gss_OID.  The length field contains the number of bytes in this
290   value.  For example, the  gss_OID value corresponding to {iso(1)
291   identified- oganization(3) icd-ecma(12) member-company(2) dec(1011)
292   cryptoAlgorithms(7) SPX(5)} meaning SPX (Digital's X.509
293   authentication mechanism) has a length field of 7 and an elements
294   field pointing to seven octets containing the following octal values:
295   53,14,2,207,163,7,5. GSSAPI implementations should provide constant
296   gss_OID values to allow callers to request any supported mechanism,
297   although applications are encouraged on portability grounds to accept
298   the default mechanism.   gss_OID values should also be provided to
299   allow applications to specify particular name types (see section
300   2.1.10).  Applications should treat gss_OID_desc values returned by
301   GSSAPI routines as read-only.  In particular, the application should
302   not attempt to deallocate them.  The gss_OID_desc datatype is
303   equivalent to the X/Open OM_object_identifier datatype [2].
304
3052.1.5. Object Identifier Sets
306
307   Certain GSSAPI procedures take parameters of the type gss_OID_set.
308   This type represents one or more object identifiers (section 2.1.4).
309   A gss_OID_set object has the following structure:
310
311                 typedef struct gss_OID_set_desc_struct {
312                    int       count;
313                    gss_OID   elements;
314                 } gss_OID_set_desc, *gss_OID_set;
315
316   The count field contains the number of OIDs within the set.  The
317   elements field is a pointer to an array of gss_OID_desc objects, each
318   of which describes a single OID. gss_OID_set values are used to name
319   the available mechanisms supported by the GSSAPI, to request the use
320   of specific mechanisms, and to indicate which mechanisms a given
321   credential supports.  Storage associated with gss_OID_set values
322   returned to the application by the GSSAPI may be deallocated by the
323   gss_release_oid_set routine.
324
3252.1.6. Credentials
326
327   A credential handle is a caller-opaque atomic datum that identifies a
328   GSSAPI credential data structure.  It is represented by the caller-
329   opaque type gss_cred_id_t, which may be implemented as either an
330   arithmetic or a pointer type.  Credentials describe a principal, and
331   they give their holder the ability to act as that principal.  The
332   GSSAPI does not make the actual credentials available to
333   applications; instead the credential handle is used to identify a
334   particular credential, held internally by GSSAPI or underlying
335
336
337
338Wray                                                            [Page 6]
339
340RFC 1509            GSSAPI - Overview and C bindings      September 1993
341
342
343   mechanism.  Thus the credential handle contains no security-relavent
344   information, and requires no special protection by the application.
345   Depending on the implementation, a given credential handle may refer
346   to different credentials when presented to the GSSAPI by different
347   callers.  Individual GSSAPI implementations should define both the
348   scope of a credential handle and the scope of a credential itself
349   (which must be at least as wide as that of a handle).  Possibilities
350   for credential handle scope include the process that acquired the
351   handle, the acquiring process and its children, or all processes
352   sharing some local identification information (e.g., UID).  If no
353   handles exist by which a given credential may be reached, the GSSAPI
354   may delete the credential.
355
356   Certain routines allow credential handle parameters to be omitted to
357   indicate the use of a default credential.  The mechanism by which a
358   default credential is established and its scope should be defined by
359   the individual GSSAPI implementation.
360
3612.1.7. Contexts
362
363   The gss_ctx_id_t data type contains a caller-opaque atomic value that
364   identifies one end of a GSSAPI security context.  It may be
365   implemented as either an arithmetic or a pointer type. Depending on
366   the implementation, a given gss_ctx_id_t value may refer to different
367   GSSAPI security contexts when presented to the GSSAPI by different
368   callers.  The security context holds state information about each end
369   of a peer communication, including cryptographic state information.
370   Individual GSSAPI implementations should define the scope of a
371   context.  Since no way is provided by which a new gss_ctx_id_t value
372   may be obtained for an existing context, the scope of a context
373   should be the same as the scope of a gss_ctx_id_t.
374
3752.1.8. Authentication tokens
376
377   A token is a caller-opaque type that GSSAPI uses to maintain
378   synchronization between the context data structures at each end of a
379   GSSAPI security context.  The token is a cryptographically protected
380   bit-string, generated by the underlying mechanism at one end of a
381   GSSAPI security context for use by the peer mechanism at the other
382   end.  Encapsulation (if required) and transfer of the token are the
383   responsibility of the peer applications.  A token is passed between
384   the GSSAPI and the application using the gss_buffer_t conventions.
385
3862.1.9. Status values
387
388   One or more status codes are returned by each GSSAPI routine.  Two
389   distinct sorts of status codes are returned.  These are termed GSS
390   status codes and Mechanism status codes.
391
392
393
394Wray                                                            [Page 7]
395
396RFC 1509            GSSAPI - Overview and C bindings      September 1993
397
398
3992.1.9.1. GSS status codes
400
401   GSSAPI routines return GSS status codes as their OM_uint32 function
402   value.  These codes indicate errors that are independent of the
403   underlying mechanism used to provide the security service.  The
404   errors that can be indicated via a GSS status code are either generic
405   API routine errors (errors that are defined in the GSSAPI
406   specification) or calling errors (errors that are specific to these
407   bindings).
408
409   A GSS status code can indicate a single fatal generic API error from
410   the routine and a single calling error.  In addition, supplementary
411   status information may be indicated via the setting of bits in the
412   supplementary info field of a GSS status code.
413
414   These errors are encoded into the 32-bit GSS status code as follows:
415
416      MSB                                                        LSB
417      |------------------------------------------------------------|
418      | Calling Error | Routine Error  |    Supplementary Info     |
419      |------------------------------------------------------------|
420   Bit 31           24 23            16 15                        0
421
422   Hence if a GSSAPI routine returns a GSS status code whose upper 16
423   bits contain a non-zero value, the call failed.  If the calling error
424   field is non-zero, the invoking application's call of the routine was
425   erroneous.  Calling errors are defined in table 5-1.  If the routine
426   error field is non-zero, the routine failed for one of the routine-
427   specific reasons listed below in table 5-2.  Whether or not the upper
428   16 bits indicate a failure or a success, the routine may indicate
429   additional information by setting bits in the supplementary info
430   field of the status code.  The meaning of individual bits is listed
431   below in table 5-3.
432
433                     Table 5-1  Calling Errors
434
435              Name                    Value in        Meaning
436                                        Field
437         GSS_S_CALL_INACCESSIBLE_READ     1           A required input
438                                                      parameter could
439                                                      not be read.
440         GSS_S_CALL_INACCESSIBLE_WRITE    2           A required output
441                                                      parameter could
442                                                      not be written.
443         GSS_S_CALL_BAD_STRUCTURE         3           A parameter was
444                                                      malformed
445
446
447
448
449
450Wray                                                            [Page 8]
451
452RFC 1509            GSSAPI - Overview and C bindings      September 1993
453
454
455                     Table 5-2  Routine Errors
456
457               Name             Value in       Meaning
458                                 Field
459
460         GSS_S_BAD_MECH             1      An unsupported mechanism was
461                                           requested
462         GSS_S_BAD_NAME             2      An invalid name was supplied
463         GSS_S_BAD_NAMETYPE         3      A supplied name was of an
464                                           unsupported type
465         GSS_S_BAD_BINDINGS         4      Incorrect channel bindings
466                                           were supplied
467         GSS_S_BAD_STATUS           5      An invalid status code was
468                                           supplied
469
470         GSS_S_BAD_SIG              6      A token had an invalid
471                                           signature
472         GSS_S_NO_CRED              7      No credentials were supplied
473         GSS_S_NO_CONTEXT           8      No context has been
474                                           established
475         GSS_S_DEFECTIVE_TOKEN      9      A token was invalid
476         GSS_S_DEFECTIVE_CREDENTIAL 10     A credential was invalid
477         GSS_S_CREDENTIALS_EXPIRED  11     The referenced credentials
478                                           have expired
479         GSS_S_CONTEXT_EXPIRED      12     The context has expired
480         GSS_S_FAILURE              13     Miscellaneous failure
481                                           (see text)
482
483                     Table 5-3  Supplementary Status Bits
484
485         Name                Bit Number         Meaning
486         GSS_S_CONTINUE_NEEDED   0 (LSB)  The routine must be called
487                                          again to complete its
488                                          function.
489                                          See routine documentation for
490                                          detailed description.
491         GSS_S_DUPLICATE_TOKEN   1        The token was a duplicate of
492                                          an earlier token
493         GSS_S_OLD_TOKEN         2        The token's validity period
494                                          has expired
495         GSS_S_UNSEQ_TOKEN       3        A later token has already been
496                                          processed
497
498   The routine documentation also uses the name GSS_S_COMPLETE, which is
499   a zero value, to indicate an absence of any API errors or
500   supplementary information bits.
501
502
503
504
505
506Wray                                                            [Page 9]
507
508RFC 1509            GSSAPI - Overview and C bindings      September 1993
509
510
511   All GSS_S_xxx symbols equate to complete OM_uint32 status codes,
512   rather than to bitfield values.  For example, the actual value of the
513   symbol GSS_S_BAD_NAMETYPE (value 3 in the routine error field) is 3
514   << 16.
515
516   The macros GSS_CALLING_ERROR(), GSS_ROUTINE_ERROR() and
517   GSS_SUPPLEMENTARY_INFO() are provided, each of which takes a GSS
518   status code and removes all but the relevant field.  For example, the
519   value obtained by applying GSS_ROUTINE_ERROR to a status code removes
520   the calling errors and supplementary info fields, leaving only the
521   routine errors field.  The values delivered by these macros may be
522   directly compared with a GSS_S_xxx symbol of the appropriate type.
523   The macro GSS_ERROR() is also provided, which when applied to a GSS
524   status code returns a non-zero value if the status code indicated a
525   calling or routine error, and a zero value otherwise.
526
527   A GSSAPI implementation may choose to signal calling errors in a
528   platform-specific manner instead of, or in addition to the routine
529   value; routine errors and supplementary info should be returned via
530   routine status values only.
531
5322.1.9.2. Mechanism-specific status codes
533
534   GSSAPI routines return a minor_status parameter, which is used to
535   indicate specialized errors from the underlying security mechanism.
536   This parameter may contain a single mechanism-specific error,
537   indicated by a OM_uint32 value.
538
539   The minor_status parameter will always be set by a GSSAPI routine,
540   even if it returns a calling error or one of the generic API errors
541   indicated above as fatal, although other output parameters may remain
542   unset in such cases.  However, output parameters that are expected to
543   return pointers to storage allocated by a routine must always set set
544   by the routine, even in the event of an error, although in such cases
545   the GSSAPI routine may elect to set the returned parameter value to
546   NULL to indicate that no storage was actually allocated.  Any length
547   field associated with such pointers (as in a gss_buffer_desc
548   structure) should also be set to zero in such cases.
549
550   The GSS status code GSS_S_FAILURE is used to indicate that the
551   underlying mechanism detected an error for which no specific GSS
552   status code is defined.  The mechanism status code will provide more
553   details about the error.
554
5552.1.10. Names
556
557   A name is used to identify a person or entity.  GSSAPI authenticates
558   the relationship between a name and the entity claiming the name.
559
560
561
562Wray                                                           [Page 10]
563
564RFC 1509            GSSAPI - Overview and C bindings      September 1993
565
566
567   Two distinct representations are defined for names:
568
569        (a) A printable form, for presentation to a user
570
571        (b) An internal form, for presentation at the API
572
573   The syntax of a printable name is defined by the GSSAPI
574   implementation, and may be dependent on local system configuration,
575   or on individual user preference.  The internal form provides a
576   canonical representation of the name that is independent of
577   configuration.
578
579   A given GSSAPI implementation may support names drawn from multiple
580   namespaces.  In such an implementation, the internal form of the name
581   must include fields that identify the namespace from which the name
582   is drawn.  The namespace from which a printable name is drawn is
583   specified by an accompanying object identifier.
584
585   Routines (gss_import_name and  gss_display_name) are provided to
586   convert names between their printable representations and the
587   gss_name_t type.  gss_import_name may support multiple syntaxes for
588   each supported namespace, allowing users the freedom to choose a
589   preferred name representation.  gss_display_name should use an
590   implementation-chosen preferred syntax for each supported name-type.
591
592   Comparison of internal-form names is accomplished via the
593   gss_compare_names routine.  This removes the need for the application
594   program to understand the syntaxes of the various printable names
595   that a given GSSAPI implementation may support.
596
597   Storage is allocated by routines that return gss_name_t values.  A
598   procedure, gss_release_name, is provided to free storage associated
599   with a name.
600
6012.1.11. Channel Bindings
602
603   GSSAPI supports the use of user-specified tags to identify a given
604   context to the peer application.  These tags are used to identify the
605   particular communications channel that carries the context.  Channel
606   bindings are communicated to the GSSAPI using the following
607   structure:
608
609
610
611
612
613
614
615
616
617
618Wray                                                           [Page 11]
619
620RFC 1509            GSSAPI - Overview and C bindings      September 1993
621
622
623                 typedef struct gss_channel_bindings_struct {
624                    OM_uint32       initiator_addrtype;
625                    gss_buffer_desc initiator_address;
626                    OM_uint32       acceptor_addrtype;
627                    gss_buffer_desc acceptor_address;
628                    gss_buffer_desc application_data;
629                 } *gss_channel_bindings_t;
630
631   The initiator_addrtype and acceptor_addrtype fields denote the type
632   of addresses contained in the initiator_address and acceptor_address
633   buffers.  The address type should be one of the following:
634
635          GSS_C_AF_UNSPEC      Unspecified address type
636          GSS_C_AF_LOCAL       Host-local address type
637          GSS_C_AF_INET        DARPA Internet address type
638          GSS_C_AF_IMPLINK     ARPAnet IMP address type (eg IP)
639          GSS_C_AF_PUP         pup protocols (eg BSP) address type
640          GSS_C_AF_CHAOS       MIT CHAOS protocol address type
641          GSS_C_AF_NS          XEROX NS address type
642          GSS_C_AF_NBS         nbs address type
643          GSS_C_AF_ECMA        ECMA address type
644          GSS_C_AF_DATAKIT     datakit protocols address type
645          GSS_C_AF_CCITT       CCITT protocols (eg X.25)
646          GSS_C_AF_SNA         IBM SNA address type
647          GSS_C_AF_DECnet      DECnet address type
648          GSS_C_AF_DLI         Direct data link interface address type
649          GSS_C_AF_LAT         LAT address type
650          GSS_C_AF_HYLINK      NSC Hyperchannel address type
651          GSS_C_AF_APPLETALK   AppleTalk address type
652          GSS_C_AF_BSC         BISYNC 2780/3780 address type
653          GSS_C_AF_DSS         Distributed system services address type
654          GSS_C_AF_OSI         OSI TP4 address type
655          GSS_C_AF_X25         X25
656          GSS_C_AF_NULLADDR    No address specified
657
658   Note that these name address families rather than specific addressing
659   formats.  For address families that contain several alternative
660   address forms, the initiator_address and acceptor_address fields must
661   contain sufficient information to determine which address form is
662   used.  When not otherwise specified, addresses should be specified in
663   network byte-order.
664
665   Conceptually, the GSSAPI concatenates the initiator_addrtype,
666   initiator_address, acceptor_addrtype, acceptor_address and
667   application_data to form an octet string.  The mechanism signs this
668   octet string, and binds the signature to the context establishment
669   token emitted by gss_init_sec_context.  The same bindings are
670   presented by the context acceptor to gss_accept_sec_context, and a
671
672
673
674Wray                                                           [Page 12]
675
676RFC 1509            GSSAPI - Overview and C bindings      September 1993
677
678
679   signature is calculated in the same way.  The calculated signature is
680   compared with that found in the token, and if the signatures differ,
681   gss_accept_sec_context will return a GSS_S_BAD_BINDINGS error, and
682   the context will not be established.  Some mechanisms may include the
683   actual channel binding data in the token (rather than just a
684   signature); applications should therefore not use confidential data
685   as channel-binding components.  Individual mechanisms may impose
686   additional constraints on addresses and address types that may appear
687   in channel bindings.  For example, a mechanism may verify that the
688   initiator_address field of the channel bindings presented to
689   gss_init_sec_context contains the correct network address of the host
690   system.
691
6922.1.12. Optional parameters
693
694   Various parameters are described as optional.  This means that they
695   follow a convention whereby a default value may be requested.  The
696   following conventions are used for omitted parameters.  These
697   conventions apply only to those parameters that are explicitly
698   documented as optional.
699
7002.1.12.1. gss_buffer_t types
701
702   Specify GSS_C_NO_BUFFER as a value.  For an input parameter this
703   signifies that default behavior is requested, while for an output
704   parameter it indicates that the information that would be returned
705   via the parameter is not required by the application.
706
7072.1.12.2. Integer types (input)
708
709   Individual parameter documentation lists values to be used to
710   indicate default actions.
711
7122.1.12.3. Integer types (output)
713
714   Specify NULL as the value for the pointer.
715
7162.1.12.4. Pointer types
717
718   Specify NULL as the value.
719
7202.1.12.5. Object IDs
721
722   Specify GSS_C_NULL_OID as the value.
723
7242.1.12.6. Object ID Sets
725
726   Specify GSS_C_NULL_OID_SET as the value.
727
728
729
730Wray                                                           [Page 13]
731
732RFC 1509            GSSAPI - Overview and C bindings      September 1993
733
734
7352.1.12.7. Credentials
736
737   Specify GSS_C_NO_CREDENTIAL to use the default credential handle.
738
7392.1.12.8. Channel Bindings
740
741   Specify GSS_C_NO_CHANNEL_BINDINGS to indicate that channel bindings
742   are not to be used.
743
7443. GSSAPI routine descriptions
745
7462.1. gss_acquire_cred
747
748      OM_uint32  gss_acquire_cred (
749                     OM_uint32 *     minor_status,
750                     gss_name_t      desired_name,
751                     OM_uint32       time_req,
752                     gss_OID_set     desired_mechs,
753                     int             cred_usage,
754                     gss_cred_id_t * output_cred_handle,
755                     gss_OID_set *   actual_mechs,
756                      OM_int32 *      time_rec)
757   Purpose:
758
759   Allows an application to acquire a handle for a pre-existing
760   credential by name.  GSSAPI implementations must impose a local
761   access-control policy on callers of this routine to prevent
762   unauthorized callers from acquiring credentials to which they are not
763   entitled.  This routine is not intended to provide a "login to the
764   network" function, as such a function would result in the creation of
765   new credentials rather than merely acquiring a handle to existing
766   credentials.  Such functions, if required, should be defined in
767   implementation-specific extensions to the API.
768
769   If credential acquisition is time-consuming for a mechanism, the
770   mechanism may chooses to delay the actual acquisition until the
771   credential is required (e.g., by gss_init_sec_context or
772   gss_accept_sec_context).  Such mechanism-specific implementation
773   decisions should be invisible to the calling application; thus a call
774   of gss_inquire_cred immediately following the call of
775   gss_acquire_cred must return valid credential data, and may therefore
776   incur the overhead of a deferred credential acquisition.
777
778   Parameters:
779
780      desired_name      gss_name_t, read
781                        Name of principal whose credential
782                        should be acquired
783
784
785
786Wray                                                           [Page 14]
787
788RFC 1509            GSSAPI - Overview and C bindings      September 1993
789
790
791      time_req          integer, read
792                        number of seconds that credentials
793                        should remain valid
794
795      desired_mechs     Set of Object IDs, read
796                        set of underlying security mechanisms that
797                        may be used.  GSS_C_NULL_OID_SET may be used
798                        to obtain an implementation-specific default.
799
800      cred_usage        integer, read
801                        GSS_C_BOTH - Credentials may be used
802                                     either to initiate or accept
803                                     security contexts.
804                        GSS_C_INITIATE - Credentials will only be
805                                         used to initiate security
806                                         contexts.
807                        GSS_C_ACCEPT - Credentials will only be used to
808                                       accept security contexts.
809
810      output_cred_handle   gss_cred_id_t, modify
811                           The returned credential handle.
812
813      actual_mechs      Set of Object IDs, modify, optional
814                        The set of mechanisms for which the
815                        credential is valid.  Specify NULL
816                        if not required.
817
818      time_rec          Integer, modify, optional
819                        Actual number of seconds for which the
820                        returned credentials will remain valid.  If the
821                        implementation does not support expiration of
822                        credentials, the value GSS_C_INDEFINITE will
823                        be returned. Specify NULL if not required
824
825      minor_status      Integer, modify
826                        Mechanism specific status code.
827   Function value:
828
829      GSS status code:
830
831      GSS_S_COMPLETE    Successful completion
832
833      GSS_S_BAD_MECH    Unavailable mechanism requested
834
835      GSS_S_BAD_NAMETYPE Type contained within desired_name parameter is
836                        not supported
837
838      GSS_S_BAD_NAME    Value supplied for desired_name parameter is
839
840
841
842Wray                                                           [Page 15]
843
844RFC 1509            GSSAPI - Overview and C bindings      September 1993
845
846
847                        ill-formed.
848
849      GSS_S_FAILURE     Unspecified failure.  The minor_status parameter
850                        contains more detailed information
851
8523.2. gss_release_cred
853
854      OM_uint32  gss_release_cred (
855                     OM_uint32 *     minor_status,
856                     gss_cred_id_t * cred_handle)
857
858   Purpose:
859
860   Informs GSSAPI that the specified credential handle is no longer
861   required by the process.  When all processes have released a
862   credential, it will be deleted.
863
864   Parameters:
865
866      cred_handle       gss_cred_id_t, modify, optional
867                        buffer containing opaque credential
868                        handle.  If  GSS_C_NO_CREDENTIAL  is supplied,
869                        the default credential will be released
870
871      minor_status      integer, modify
872                        Mechanism specific status code.
873
874   Function value:
875
876      GSS status code:
877
878      GSS_S_COMPLETE    Successful completion
879
880      GSS_S_NO_CRED     Credentials could not be accessed.
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898Wray                                                           [Page 16]
899
900RFC 1509            GSSAPI - Overview and C bindings      September 1993
901
902
9033.3. gss_init_sec_context
904
905      OM_uint32  gss_init_sec_context (
906                     OM_uint32 *     minor_status,
907                     gss_cred_id_t   claimant_cred_handle,
908                     gss_ctx_id_t *  context_handle,
909                     gss_name_t      target_name,
910                     gss_OID         mech_type,
911                     int             req_flags,
912                     int             time_req,
913                     gss_channel_bindings_t
914                                     input_chan_bindings,
915                     gss_buffer_t    input_token
916                     gss_OID *       actual_mech_type,
917                     gss_buffer_t    output_token,
918                     int *           ret_flags,
919                     OM_uint32 *     time_rec )
920
921   Purpose:
922
923   Initiates the establishment of a security context between the
924   application and a remote peer.  Initially, the input_token parameter
925   should be specified as GSS_C_NO_BUFFER.  The routine may return a
926   output_token which should be transferred to the peer application,
927   where the peer application will present it to gss_accept_sec_context.
928   If no token need be sent, gss_init_sec_context will indicate this by
929   setting the length field of the output_token argument to zero.  To
930   complete the context establishment, one or more reply tokens may be
931   required from the peer application; if so, gss_init_sec_context will
932   return a status indicating GSS_S_CONTINUE_NEEDED in which case it
933   should be called again when the reply token is received from the peer
934   application, passing the token to gss_init_sec_context via the
935   input_token parameters.
936
937   The values returned via the ret_flags and time_rec parameters are not
938   defined unless the routine returns GSS_S_COMPLETE.
939
940   Parameters:
941
942      claimant_cred_handle  gss_cred_id_t, read, optional
943                            handle for credentials claimed.  Supply
944                            GSS_C_NO_CREDENTIAL to use default
945                            credentials.
946
947      context_handle    gss_ctx_id_t, read/modify
948                        context handle for new context.  Supply
949                        GSS_C_NO_CONTEXT for first call; use value
950                        returned by first call in continuation calls.
951
952
953
954Wray                                                           [Page 17]
955
956RFC 1509            GSSAPI - Overview and C bindings      September 1993
957
958
959      target_name       gss_name_t, read
960                        Name of target
961
962      mech_type         OID, read, optional
963                        Object ID of desired mechanism. Supply
964                        GSS_C_NULL_OID to obtain an implementation
965                        specific default
966
967      req_flags         bit-mask, read
968                        Contains four independent flags, each of
969                        which requests that the context support a
970                        specific service option.  Symbolic
971                        names are provided for each flag, and the
972                        symbolic names corresponding to the required
973                        flags should be logically-ORed
974                        together to form the bit-mask value.  The
975                        flags are:
976
977                        GSS_C_DELEG_FLAG
978                              True - Delegate credentials to remote peer
979                              False - Don't delegate
980                        GSS_C_MUTUAL_FLAG
981                              True - Request that remote peer
982                                     authenticate itself
983                              False - Authenticate self to remote peer
984                                      only
985                        GSS_C_REPLAY_FLAG
986                              True - Enable replay detection for signed
987                                     or sealed messages
988                              False - Don't attempt to detect
989                                      replayed messages
990                        GSS_C_SEQUENCE_FLAG
991                              True - Enable detection of out-of-sequence
992                                     signed or sealed messages
993                              False - Don't attempt to detect
994                                      out-of-sequence messages
995
996      time_req          integer, read
997                        Desired number of seconds for which context
998                        should remain valid.  Supply 0 to request a
999                        default validity period.
1000
1001      input_chan_bindings     channel bindings, read
1002                              Application-specified bindings.  Allows
1003                              application to securely bind channel
1004                              identification information to the security
1005                              context.
1006
1007
1008
1009
1010Wray                                                           [Page 18]
1011
1012RFC 1509            GSSAPI - Overview and C bindings      September 1993
1013
1014
1015      input_token       buffer, opaque, read, optional (see text)
1016                        Token received from peer application.
1017                        Supply GSS_C_NO_BUFFER on initial call.
1018
1019      actual_mech_type  OID, modify
1020                        actual mechanism used.
1021
1022      output_token      buffer, opaque, modify
1023                        token to be sent to peer application.  If
1024                        the length field of the returned buffer is
1025                        zero, no token need be sent to the peer
1026                        application.
1027
1028      ret_flags         bit-mask, modify
1029                        Contains six independent flags, each of which
1030                        indicates that the context supports a specific
1031                        service option.  Symbolic names are provided
1032                        for each flag, and the symbolic names
1033                        corresponding to the required flags should be
1034                        logically-ANDed with the ret_flags value to test
1035                        whether a given option is supported by the
1036                        context.  The flags are:
1037
1038                        GSS_C_DELEG_FLAG
1039                              True - Credentials were delegated to
1040                                     the remote peer
1041                              False - No credentials were delegated
1042                        GSS_C_MUTUAL_FLAG
1043                              True - Remote peer has been asked to
1044                                     authenticated itself
1045                              False - Remote peer has not been asked to
1046                                      authenticate itself
1047                        GSS_C_REPLAY_FLAG
1048                              True - replay of signed or sealed messages
1049                                     will be detected
1050                              False - replayed messages will not be
1051                                      detected
1052                        GSS_C_SEQUENCE_FLAG
1053                              True - out-of-sequence signed or sealed
1054                                     messages will be detected
1055                              False - out-of-sequence messages will not
1056                                      be detected
1057                        GSS_C_CONF_FLAG
1058                              True - Confidentiality service may be
1059                                     invoked by calling seal routine
1060                              False - No confidentiality service (via
1061                                      seal) available. seal will provide
1062                                      message encapsulation, data-origin
1063
1064
1065
1066Wray                                                           [Page 19]
1067
1068RFC 1509            GSSAPI - Overview and C bindings      September 1993
1069
1070
1071                                      authentication and integrity
1072                                      services only.
1073                        GSS_C_INTEG_FLAG
1074                              True - Integrity service may be invoked by
1075                                     calling either gss_sign or gss_seal
1076                                     routines.
1077                              False - Per-message integrity service
1078                                      unavailable.
1079
1080      time_rec          integer, modify, optional
1081                        number of seconds for which the context
1082                        will remain valid. If the implementation does
1083                        not support credential expiration, the value
1084                        GSS_C_INDEFINITE will be returned.  Specify
1085                        NULL if not required.
1086
1087      minor_status      integer, modify
1088                        Mechanism specific status code.
1089
1090   Function value:
1091
1092   GSS status code:
1093
1094   GSS_S_COMPLETE    Successful completion
1095
1096   GSS_S_CONTINUE_NEEDED Indicates that a token from the peer
1097                     application is required to complete thecontext, and
1098                     that gss_init_sec_context must be called again with
1099                     that token.
1100
1101   GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks performed on
1102                     the input_token failed
1103
1104   GSS_S_DEFECTIVE_CREDENTIAL Indicates that consistency checks
1105                     performed on the credential failed.
1106
1107   GSS_S_NO_CRED     The supplied credentials were not valid for context
1108                     initiation, or the credential handle did not
1109                     reference any credentials.
1110
1111   GSS_S_CREDENTIALS_EXPIRED The referenced credentials have expired
1112
1113   GSS_S_BAD_BINDINGS The input_token contains different channel
1114                     bindings to those specified via the
1115                     input_chan_bindings parameter
1116
1117   GSS_S_BAD_SIG     The input_token contains an invalid signature, or a
1118                     signature that could not be verified
1119
1120
1121
1122Wray                                                           [Page 20]
1123
1124RFC 1509            GSSAPI - Overview and C bindings      September 1993
1125
1126
1127   GSS_S_OLD_TOKEN   The input_token was too old.  This is a fatal error
1128                     during context establishment
1129
1130   GSS_S_DUPLICATE_TOKEN The input_token is valid, but is a duplicate of
1131                     a token already processed.  This is a fatal error
1132                     during context establishment.
1133
1134   GSS_S_NO_CONTEXT  Indicates that the supplied context handle did not
1135                     refer to a valid context
1136
1137   GSS_S_BAD_NAMETYPE The provided target_name parameter contained an
1138                     invalid or unsupported type of name
1139
1140   GSS_S_BAD_NAME    The provided target_name parameter was ill-formed.
1141
1142   GSS_S_FAILURE     Failure.  See minor_status for more information
1143
11443.4. gss_accept_sec_context
1145
1146      OM_uint32  gss_accept_sec_context (
1147                     OM_uint32 *     minor_status,
1148                     gss_ctx_id_t *  context_handle,
1149                     gss_cred_id_t   verifier_cred_handle,
1150                     gss_buffer_t    input_token_buffer
1151                     gss_channel_bindings_t
1152                                     input_chan_bindings,
1153                     gss_name_t *    src_name,
1154                     gss_OID *       mech_type,
1155                     gss_buffer_t    output_token,
1156                     int *           ret_flags,
1157                     OM_uint32 *     time_rec,
1158                     gss_cred_id_t * delegated_cred_handle)
1159
1160   Purpose:
1161
1162   Allows a remotely initiated security context between the application
1163   and a remote peer to be established.  The routine may return a
1164   output_token which should be transferred to the peer application,
1165   where the peer application will present it to gss_init_sec_context.
1166   If no token need be sent, gss_accept_sec_context will indicate this
1167   by setting the length field of the output_token argument to zero.  To
1168   complete the context establishment, one or more reply tokens may be
1169   required from the peer application; if so, gss_accept_sec_context
1170   will return a status flag of GSS_S_CONTINUE_NEEDED, in which case it
1171   should be called again when the reply token is received from the peer
1172   application, passing the token to gss_accept_sec_context via the
1173   input_token parameters.
1174
1175
1176
1177
1178Wray                                                           [Page 21]
1179
1180RFC 1509            GSSAPI - Overview and C bindings      September 1993
1181
1182
1183   The values returned via the src_name, ret_flags, time_rec, and
1184   delegated_cred_handle parameters are not defined unless the routine
1185   returns GSS_S_COMPLETE.
1186
1187   Parameters:
1188
1189      context_handle    gss_ctx_id_t, read/modify
1190                        context handle for new context.  Supply
1191                        GSS_C_NO_CONTEXT for first call; use value
1192                        returned in subsequent calls.
1193
1194      verifier_cred_handle    gss_cred_id_t, read, optional
1195                              Credential handle claimed by context
1196      acceptor.
1197                              Specify GSS_C_NO_CREDENTIAL to use default
1198                              credentials.  If GSS_C_NO_CREDENTIAL is
1199                              specified, but the caller has no default
1200                              credentials established, an
1201                              implementation-defined default credential
1202                              may be used.
1203
1204      input_token_buffer      buffer, opaque, read
1205                              token obtained from remote application
1206
1207      input_chan_bindings     channel bindings, read
1208                              Application-specified bindings.  Allows
1209                              application to securely bind channel
1210                              identification information to the security
1211                              context.
1212
1213      src_name          gss_name_t, modify, optional
1214                        Authenticated name of context initiator.
1215                        After use, this name should be deallocated by
1216                        passing it to gss_release_name.  If not required,
1217                        specify NULL.
1218
1219      mech_type         Object ID, modify
1220                        Security mechanism used.  The returned
1221                        OID value will be a pointer into static
1222                        storage, and should be treated as read-only
1223                        by the caller.
1224
1225      output_token      buffer, opaque, modify
1226                        Token to be passed to peer application. If the
1227                        length field of the returned token buffer is 0,
1228                        then no token need be passed to the peer
1229                        application.
1230
1231
1232
1233
1234Wray                                                           [Page 22]
1235
1236RFC 1509            GSSAPI - Overview and C bindings      September 1993
1237
1238
1239      ret_flags         bit-mask, modify
1240                        Contains six independent flags, each of
1241                        which indicates that the context supports a
1242                        specific service option.  Symbolic names are
1243                        provided for each flag, and the symbolic names
1244                        corresponding to the required flags
1245                        should be logically-ANDed with the ret_flags
1246                        value to test whether a given option is
1247                        supported by the context.  The flags are:
1248                        GSS_C_DELEG_FLAG
1249                              True - Delegated credentials are available
1250                                     via the delegated_cred_handle
1251                                     parameter
1252                              False - No credentials were delegated
1253                        GSS_C_MUTUAL_FLAG
1254                              True - Remote peer asked for mutual
1255                                     authentication
1256                              False - Remote peer did not ask for mutual
1257                                      authentication
1258                        GSS_C_REPLAY_FLAG
1259                              True - replay of signed or sealed messages
1260                                     will be detected
1261                              False - replayed messages will not be
1262                                      detected
1263                        GSS_C_SEQUENCE_FLAG
1264                              True - out-of-sequence signed or sealed
1265                                     messages will be detected
1266                              False - out-of-sequence messages will not
1267                                      be detected
1268                        GSS_C_CONF_FLAG
1269                              True - Confidentiality service may be
1270                                     invoked by calling seal routine
1271                              False - No confidentiality service (via
1272                                      seal) available. seal will
1273                                      provide message encapsulation,
1274                                      data-origin authentication and
1275                                      integrity services only.
1276                        GSS_C_INTEG_FLAG
1277                              True - Integrity service may be invoked
1278                                     by calling either gss_sign or
1279                                     gss_seal routines.
1280                              False - Per-message integrity service
1281                                      unavailable.
1282
1283      time_rec          integer, modify, optional
1284                        number of seconds for which the context
1285                        will remain valid. Specify NULL if not required.
1286
1287
1288
1289
1290Wray                                                           [Page 23]
1291
1292RFC 1509            GSSAPI - Overview and C bindings      September 1993
1293
1294
1295      delegated_cred_handle
1296                        gss_cred_id_t, modify
1297                        credential handle for credentials received from
1298                        context initiator.  Only valid if deleg_flag in
1299                        ret_flags is true.
1300
1301      minor_status      integer, modify
1302                        Mechanism specific status code.
1303
1304   Function value:
1305
1306      GSS status code:
1307
1308      GSS_S_COMPLETE    Successful completion
1309
1310      GSS_S_CONTINUE_NEEDED Indicates that a token from the peer
1311                        application is required to complete the context,
1312                        and that gss_accept_sec_context must be called
1313                        again with that token.
1314
1315      GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks
1316                        performed on the input_token failed.
1317
1318      GSS_S_DEFECTIVE_CREDENTIAL Indicates that consistency checks
1319                        performed on the credential failed.
1320
1321      GSS_S_NO_CRED The supplied credentials were not valid for
1322                        context acceptance, or the credential handle
1323                        did not reference any credentials.
1324
1325      GSS_S_CREDENTIALS_EXPIRED The referenced credentials have
1326                        expired.
1327
1328      GSS_S_BAD_BINDINGS The input_token contains different channel
1329                        bindings to those specified via the
1330                        input_chan_bindings parameter.
1331
1332      GSS_S_NO_CONTEXT Indicates that the supplied context handle did
1333                       not refer to a valid context.
1334
1335      GSS_S_BAD_SIG    The input_token contains an invalid signature.
1336
1337      GSS_S_OLD_TOKEN   The input_token was too old.  This is a fatal
1338                        error during context establishment.
1339
1340      GSS_S_DUPLICATE_TOKEN The input_token is valid, but is a
1341                        duplicate of a token already processed.  This
1342                        is a fatal error during context establishment.
1343
1344
1345
1346Wray                                                           [Page 24]
1347
1348RFC 1509            GSSAPI - Overview and C bindings      September 1993
1349
1350
1351      GSS_S_FAILURE     Failure.  See minor_status for more information.
1352
13533.5. gss_process_context_token
1354
1355      OM_uint32  gss_process_context_token (
1356                     OM_uint32 *     minor_status,
1357                     gss_ctx_id_t    context_handle,
1358                     gss_buffer_t    token_buffer)
1359
1360   Purpose:
1361
1362   Provides a way to pass a token to the security service.  Usually,
1363   tokens are associated either with context establishment (when they
1364   would be passed to gss_init_sec_context or gss_accept_sec_context) or
1365   with per-message security service (when they would be passed to
1366   gss_verify or gss_unseal).  Occasionally, tokens may be received at
1367   other times, and gss_process_context_token allows such tokens to be
1368   passed to the underlying security service for processing.  At
1369   present, such additional tokens may only be generated by
1370   gss_delete_sec_context.  GSSAPI implementation may use this service
1371   to implement deletion of the security context.
1372
1373   Parameters:
1374
1375      context_handle    gss_ctx_id_t, read
1376                        context handle of context on which token is to
1377                        be processed
1378
1379      token_buffer      buffer, opaque, read
1380                        pointer to first byte of token to process
1381
1382      minor_status      integer, modify
1383                        Implementation specific status code.
1384
1385   Function value:
1386
1387      GSS status code:
1388
1389      GSS_S_COMPLETE    Successful completion
1390
1391      GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks
1392                        performed on the token failed
1393
1394      GSS_S_FAILURE     Failure.  See minor_status for more information
1395
1396      GSS_S_NO_CONTEXT The context_handle did not refer to a valid
1397                       context
1398
1399
1400
1401
1402Wray                                                           [Page 25]
1403
1404RFC 1509            GSSAPI - Overview and C bindings      September 1993
1405
1406
14073.6. gss_delete_sec_context
1408
1409      OM_uint32  gss_delete_sec_context (
1410                     OM_uint32 *     minor_status,
1411                     gss_ctx_id_t *  context_handle,
1412                     gss_buffer_t    output_token)
1413
1414   Purpose:
1415
1416   Delete a security context.  gss_delete_sec_context will delete the
1417   local data structures associated with the specified security context,
1418   and generate an output_token, which when passed to the peer
1419   gss_process_context_token will instruct it to do likewise.  No
1420   further security services may be obtained using the context specified
1421   by context_handle.
1422
1423   Parameters:
1424
1425      minor_status      integer, modify
1426                        Mechanism specific status code.
1427
1428      context_handle    gss_ctx_id_t, modify
1429                        context handle identifying context to delete.
1430
1431      output_token      buffer, opaque, modify
1432                        token to be sent to remote application to
1433                        instruct it to also delete the context
1434
1435   Function value:
1436
1437      GSS status code:
1438
1439      GSS_S_COMPLETE    Successful completion
1440
1441      GSS_S_FAILURE     Failure, see minor_status for more information
1442
1443      GSS_S_NO_CONTEXT  No valid context was supplied
1444
14453.7. gss_context_time
1446
1447      OM_uint32  gss_context_time (
1448                     OM_uint32 *     minor_status,
1449                     gss_ctx_id_t    context_handle,
1450                     OM_uint32 *     time_rec)
1451   Purpose:
1452
1453   Determines the number of seconds for which the specified context will
1454   remain valid.
1455
1456
1457
1458Wray                                                           [Page 26]
1459
1460RFC 1509            GSSAPI - Overview and C bindings      September 1993
1461
1462
1463      Parameters:
1464
1465      minor_status      integer, modify
1466                        Implementation specific status code.
1467
1468      context_handle    gss_ctx_id_t, read
1469                        Identifies the context to be interrogated.
1470
1471      time_rec          integer, modify
1472                        Number of seconds that the context will remain
1473                        valid.  If the context has already expired,
1474                        zero will be returned.
1475   Function value:
1476
1477      GSS status code:
1478
1479      GSS_S_COMPLETE    Successful completion
1480
1481      GSS_S_CONTEXT_EXPIRED The context has already expired
1482
1483      GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
1484                        associated credentials have expired
1485
1486      GSS_S_NO_CONTEXT The context_handle parameter did not identify a
1487                        valid context
1488
14893.8. gss_sign
1490
1491      OM_uint32  gss_sign (
1492                     OM_uint32 *     minor_status,
1493                     gss_ctx_id_t    context_handle,
1494                     int             qop_req,
1495                     gss_buffer_t    message_buffer,
1496                     gss_buffer_t    msg_token)
1497   Purpose:
1498
1499   Generates a cryptographic signature for the supplied message, and
1500   places the signature in a token for transfer to the peer application.
1501   The qop_req parameter allows a choice between several cryptographic
1502   algorithms, if supported by the chosen mechanism.
1503
1504   Parameters:
1505
1506      minor_status      integer, modify
1507                        Implementation specific status code.
1508
1509      context_handle    gss_ctx_id_t, read
1510                        identifies the context on which the message
1511
1512
1513
1514Wray                                                           [Page 27]
1515
1516RFC 1509            GSSAPI - Overview and C bindings      September 1993
1517
1518
1519                        will be sent
1520
1521      qop_req           integer, read, optional
1522                        Specifies requested quality of protection.
1523                        Callers are encouraged, on portability grounds,
1524                        to accept the default quality of protection
1525                        offered by the chosen mechanism, which may be
1526                        requested by specifying GSS_C_QOP_DEFAULT for
1527                        this parameter.  If an unsupported protection
1528                        strength is requested, gss_sign will return a
1529                        major_status of GSS_S_FAILURE.
1530
1531      message_buffer    buffer, opaque, read
1532                        message to be signed
1533
1534      msg_token         buffer, opaque, modify
1535                        buffer to receive token
1536
1537   Function value:
1538
1539      GSS status code:
1540
1541      GSS_S_COMPLETE    Successful completion
1542
1543      GSS_S_CONTEXT_EXPIRED The context has already expired
1544
1545      GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
1546                        associated credentials have expired
1547
1548      GSS_S_NO_CONTEXT  The context_handle parameter did not identify a
1549                        valid context
1550
1551      GSS_S_FAILURE     Failure. See minor_status for more information.
1552
15533.9. gss_verify
1554
1555      OM_uint32  gss_verify (
1556                     OM_uint32 *     minor_status,
1557                     gss_ctx_id_t    context_handle,
1558                     gss_buffer_t    message_buffer,
1559                     gss_buffer_t    token_buffer,
1560                     int *           qop_state)
1561   Purpose:
1562
1563   Verifies that a cryptographic signature, contained in the token
1564   parameter, fits the supplied message.  The qop_state parameter allows
1565   a message recipient to determine the strength of protection that was
1566   applied to the message.
1567
1568
1569
1570Wray                                                           [Page 28]
1571
1572RFC 1509            GSSAPI - Overview and C bindings      September 1993
1573
1574
1575   Parameters:
1576
1577      minor_status      integer, modify
1578                        Mechanism specific status code.
1579
1580      context_handle    gss_ctx_id_t, read
1581                        identifies the context on which the message
1582                        arrived
1583
1584      message_buffer    buffer, opaque, read
1585                        message to be verified
1586
1587      token_buffer      buffer, opaque, read
1588                        token associated with message
1589
1590      qop_state         integer, modify
1591                        quality of protection gained from signature
1592
1593   Function value:
1594
1595      GSS status code:
1596
1597      GSS_S_COMPLETE    Successful completion
1598
1599      GSS_S_DEFECTIVE_TOKEN The token failed consistency checks
1600
1601      GSS_S_BAD_SIG     The signature was incorrect
1602
1603      GSS_S_DUPLICATE_TOKEN The token was valid, and contained a correct
1604                        signature for the message, but it had already
1605                        been processed
1606
1607      GSS_S_OLD_TOKEN   The token was valid, and contained a correct
1608                        signature for the message, but it is too old
1609
1610      GSS_S_UNSEQ_TOKEN The token was valid, and contained a correct
1611                        signature for the message, but has been
1612                        verified out of sequence; an earlier token has
1613                        been signed or sealed by the remote
1614                        application, but not yet been processed
1615                        locally.
1616
1617      GSS_S_CONTEXT_EXPIRED The context has already expired
1618
1619      GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
1620                        associated credentials have expired
1621
1622
1623
1624
1625
1626Wray                                                           [Page 29]
1627
1628RFC 1509            GSSAPI - Overview and C bindings      September 1993
1629
1630
1631      GSS_S_NO_CONTEXT  The context_handle parameter did not identify a
1632                        valid context
1633
1634      GSS_S_FAILURE     Failure.  See minor_status for more information.
1635
16363.10. gss_seal
1637
1638      OM_uint32  gss_seal (
1639                     OM_uint32 *     minor_status,
1640                     gss_ctx_id_t    context_handle,
1641                     int             conf_req_flag,
1642                     int             qop_req
1643                     gss_buffer_t    input_message_buffer,
1644                     int *           conf_state,
1645                     gss_buffer_t    output_message_buffer)
1646
1647   Purpose:
1648
1649   Cryptographically signs and optionally encrypts the specified
1650   input_message.  The output_message contains both the signature and
1651   the message.  The qop_req parameter allows a choice between several
1652   cryptographic algorithms, if supported by the chosen mechanism.
1653
1654   Parameters:
1655
1656      minor_status      integer, modify
1657                        Mechanism specific status code.
1658
1659      context_handle    gss_ctx_id_t, read
1660                        identifies the context on which the message
1661                        will be sent
1662
1663      conf_req_flag     boolean, read
1664                        True - Both confidentiality and integrity
1665                               services are requested
1666                        False - Only integrity service is requested
1667
1668      qop_req           integer, read, optional
1669                        Specifies required quality of protection.  A
1670                        mechanism-specific default may be requested by
1671                        setting qop_req to GSS_C_QOP_DEFAULT.  If an
1672                        unsupported protection strength is requested,
1673                        gss_seal will return a major_status of
1674                        GSS_S_FAILURE.
1675
1676      input_message_buffer   buffer, opaque, read
1677                             message to be sealed
1678
1679
1680
1681
1682Wray                                                           [Page 30]
1683
1684RFC 1509            GSSAPI - Overview and C bindings      September 1993
1685
1686
1687      conf_state        boolean, modify
1688                        True - Confidentiality, data origin
1689                               authentication and integrity services
1690                               have been applied
1691                        False - Integrity and data origin services only
1692                                has been applied.
1693
1694      output_message_buffer  buffer, opaque, modify
1695                             buffer to receive sealed message
1696
1697   Function value:
1698
1699      GSS status code:
1700
1701      GSS_S_COMPLETE    Successful completion
1702
1703      GSS_S_CONTEXT_EXPIRED The context has already expired
1704
1705      GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
1706                        associated credentials have expired
1707
1708      GSS_S_NO_CONTEXT  The context_handle parameter did not identify a
1709                        valid context
1710
1711      GSS_S_FAILURE     Failure.  See minor_status for more information.
1712
17133.11. gss_unseal
1714
1715      OM_uint32  gss_unseal (
1716                     OM_uint32 *     minor_status,
1717                     gss_ctx_id_t    context_handle,
1718                     gss_buffer_t    input_message_buffer,
1719                     gss_buffer_t    output_message_buffer,
1720                     int *           conf_state,
1721                     int *           qop_state)
1722
1723   Purpose:
1724
1725   Converts a previously sealed message back to a usable form, verifying
1726   the embedded signature.  The conf_state parameter indicates whether
1727   the message was encrypted; the qop_state parameter indicates the
1728   strength of protection that was used to provide the confidentiality
1729   and integrity services.
1730
1731   Parameters:
1732
1733      minor_status      integer, modify
1734                        Mechanism specific status code.
1735
1736
1737
1738Wray                                                           [Page 31]
1739
1740RFC 1509            GSSAPI - Overview and C bindings      September 1993
1741
1742
1743      context_handle    gss_ctx_id_t, read
1744                        identifies the context on which the message
1745                        arrived
1746
1747      input_message_buffer   buffer, opaque, read
1748                             sealed message
1749
1750      output_message_buffer  buffer, opaque, modify
1751                             buffer to receive unsealed message
1752
1753      conf_state        boolean, modify
1754                        True - Confidentiality and integrity protection
1755                               were used
1756                        False - Inteegrity service only was used
1757
1758      qop_state         integer, modify
1759                        quality of protection gained from signature
1760
1761   Function value:
1762
1763      GSS status code:
1764
1765      GSS_S_COMPLETE    Successful completion
1766
1767      GSS_S_DEFECTIVE_TOKEN The token failed consistency checks
1768
1769      GSS_S_BAD_SIG     The signature was incorrect
1770
1771      GSS_S_DUPLICATE_TOKEN The token was valid, and contained a
1772                        correct signature for the message, but it had
1773                        already been processed
1774
1775      GSS_S_OLD_TOKEN The token was valid, and contained a correct
1776                        signature for the message, but it is too old
1777
1778      GSS_S_UNSEQ_TOKEN The token was valid, and contained a correct
1779                        signature for the message, but has been
1780                        verified out of sequence; an earlier token has
1781                        been signed or sealed by the remote
1782                        application, but not yet been processed
1783                        locally.
1784
1785      GSS_S_CONTEXT_EXPIRED The context has already expired
1786
1787      GSS_S_CREDENTIALS_EXPIRED The context is recognized, but
1788                        associated credentials have expired
1789
1790
1791
1792
1793
1794Wray                                                           [Page 32]
1795
1796RFC 1509            GSSAPI - Overview and C bindings      September 1993
1797
1798
1799      GSS_S_NO_CONTEXT  The context_handle parameter did not identify a
1800                        valid context
1801
1802      GSS_S_FAILURE     Failure.  See minor_status for more information.
1803
18043.12. gss_display_status
1805
1806      OM_uint32  gss_display_status (
1807                     OM_uint32 *     minor_status,
1808                     int             status_value,
1809                     int             status_type,
1810                     gss_OID         mech_type,
1811                     int *           message_context,
1812                     gss_buffer_t    status_string)
1813
1814   Purpose:
1815
1816   Allows an application to obtain a textual representation of a GSSAPI
1817   status code, for display to the user or for logging purposes.  Since
1818   some status values may indicate multiple errors, applications may
1819   need to call gss_display_status multiple times, each call generating
1820   a single text string.  The message_context parameter is used to
1821   indicate which error message should be extracted from a given
1822   status_value; message_context should be initialized to 0, and
1823   gss_display_status will return a non-zero value if there are further
1824   messages to extract.
1825
1826   Parameters:
1827
1828      minor_status      integer, modify
1829                        Mechanism specific status code.
1830
1831      status_value      integer, read
1832                        Status value to be converted
1833
1834      status_type       integer, read
1835                        GSS_C_GSS_CODE - status_value is a GSS status
1836                                         code
1837                        GSS_C_MECH_CODE - status_value is a mechanism
1838                                          status code
1839
1840      mech_type         Object ID, read, optional
1841                        Underlying mechanism (used to interpret a
1842                        minor status value) Supply GSS_C_NULL_OID to
1843                        obtain the system default.
1844
1845      message_context   integer, read/modify
1846                        Should be initialized to zero by caller
1847
1848
1849
1850Wray                                                           [Page 33]
1851
1852RFC 1509            GSSAPI - Overview and C bindings      September 1993
1853
1854
1855                        on first call.  If further messages are
1856                        contained in the status_value parameter,
1857                        message_context will be non-zero on return,
1858                        and this value should be passed back to
1859                        subsequent calls, along with the same
1860                        status_value, status_type and mech_type
1861                        parameters.
1862
1863      status_string     buffer, character string, modify
1864                        textual interpretation of the status_value
1865
1866   Function value:
1867
1868      GSS status code:
1869
1870      GSS_S_COMPLETE    Successful completion
1871
1872      GSS_S_BAD_MECH    Indicates that translation in accordance with
1873                        an unsupported mechanism type was requested
1874
1875      GSS_S_BAD_STATUS The status value was not recognized, or the
1876                        status type was neither GSS_C_GSS_CODE nor
1877                        GSS_C_MECH_CODE.
1878
1879
18803.13. gss_indicate_mechs
1881
1882      OM_uint32  gss_indicate_mechs (
1883                     OM_uint32 *     minor_status,
1884                     gss_OID_set *   mech_set)
1885
1886   Purpose:
1887
1888         Allows an application to determine which underlying security
1889         mechanisms are available.
1890
1891   Parameters:
1892
1893      minor_status      integer, modify
1894                        Mechanism specific status code.
1895
1896      mech_set          set of Object IDs, modify
1897                        set of implementation-supported mechanisms.
1898                        The returned gss_OID_set value will be a
1899                        pointer into static storage, and should be
1900                        treated as read-only by the caller.
1901
1902
1903
1904
1905
1906Wray                                                           [Page 34]
1907
1908RFC 1509            GSSAPI - Overview and C bindings      September 1993
1909
1910
1911   Function value:
1912
1913      GSS status code:
1914
1915      GSS_S_COMPLETE    Successful completion
1916
19173.14. gss_compare_name
1918
1919      OM_uint32  gss_compare_name (
1920                     OM_uint32 *     minor_status,
1921                     gss_name_t      name1,
1922                     gss_name_t      name2,
1923                     int *           name_equal)
1924
1925   Purpose:
1926
1927   Allows an application to compare two internal-form names to determine
1928   whether they refer to the same entity.
1929
1930   Parameters:
1931
1932      minor_status      integer, modify
1933                        Mechanism specific status code.
1934
1935      name1             gss_name_t, read
1936                        internal-form  name
1937
1938      name2             gss_name_t, read
1939                        internal-form  name
1940
1941      name_equal        boolean, modify
1942                        True - names refer to same entity
1943                        False - names refer to different entities
1944                                (strictly, the names are not known to
1945                                refer to the same identity).
1946   Function value:
1947
1948      GSS status code:
1949
1950      GSS_S_COMPLETE    Successful completion
1951
1952      GSS_S_BAD_NAMETYPE The type contained within either name1 or
1953                        name2 was unrecognized, or the names were of
1954                        incomparable types.
1955
1956      GSS_S_BAD_NAME    One or both of name1 or name2 was ill-formed
1957
1958
1959
1960
1961
1962Wray                                                           [Page 35]
1963
1964RFC 1509            GSSAPI - Overview and C bindings      September 1993
1965
1966
19673.15. gss_display_name
1968
1969      OM_uint32  gss_display_name (
1970                     OM_uint32 *     minor_status,
1971                     gss_name_t      input_name,
1972                     gss_buffer_t    output_name_buffer,
1973                     gss_OID *       output_name_type)
1974
1975   Purpose:
1976
1977   Allows an application to obtain a textual representation of an opaque
1978   internal-form  name for display purposes.  The syntax of a printable
1979   name is defined by the GSSAPI implementation.
1980
1981   Parameters:
1982
1983      minor_status      integer, modify
1984                        Mechanism specific status code.
1985
1986      input_name        gss_name_t, read
1987                        name to be displayed
1988
1989      output_name_buffer   buffer, character-string, modify
1990                           buffer to receive textual name string
1991
1992      output_name_type  Object ID, modify
1993                        The type of the returned name.  The returned
1994                        gss_OID will be a pointer into static storage,
1995                        and should be treated as read-only by the caller
1996
1997   Function value:
1998
1999      GSS status code:
2000
2001      GSS_S_COMPLETE    Successful completion
2002
2003      GSS_S_BAD_NAMETYPE The type of input_name was not recognized
2004
2005      GSS_S_BAD_NAME    input_name was ill-formed
2006
20073.16. gss_import_name
2008
2009      OM_uint32 gss_import_name (
2010                    OM_uint32 *     minor_status,
2011                    gss_buffer_t    input_name_buffer,
2012                    gss_OID         input_name_type,
2013                    gss_name_t *    output_name)
2014
2015
2016
2017
2018Wray                                                           [Page 36]
2019
2020RFC 1509            GSSAPI - Overview and C bindings      September 1993
2021
2022
2023   Purpose:
2024
2025   Convert a printable name to internal form.
2026
2027   Parameters:
2028
2029      minor_status      integer, modify
2030                        Mechanism specific status code
2031
2032      input_name_buffer    buffer, character-string, read
2033                           buffer containing printable name to convert
2034
2035      input_name_type   Object ID, read, optional
2036                        Object Id specifying type of printable
2037                        name.  Applications may specify either
2038                        GSS_C_NULL_OID to use a local system-specific
2039                        printable syntax, or an OID registered by the
2040                        GSSAPI implementation to name a particular
2041                        namespace.
2042
2043      output_name       gss_name_t, modify
2044                        returned name in internal form
2045
2046   Function value:
2047
2048      GSS status code
2049
2050      GSS_S_COMPLETE    Successful completion
2051
2052      GSS_S_BAD_NAMETYPE The input_name_type was unrecognized
2053
2054      GSS_S_BAD_NAME    The input_name parameter could not be
2055                        interpreted as a name of the specified type
2056
20573.17. gss_release_name
2058
2059      OM_uint32 gss_release_name (
2060                    OM_uint32 *     minor_status,
2061                    gss_name_t *    name)
2062
2063   Purpose:
2064
2065   Free GSSAPI-allocated storage associated with an internal form name.
2066
2067   Parameters:
2068
2069      minor_status      integer, modify
2070                        Mechanism specific status code
2071
2072
2073
2074Wray                                                           [Page 37]
2075
2076RFC 1509            GSSAPI - Overview and C bindings      September 1993
2077
2078
2079      name              gss_name_t, modify
2080                        The name to be deleted
2081
2082   Function value:
2083
2084      GSS status code
2085
2086      GSS_S_COMPLETE    Successful completion
2087
2088      GSS_S_BAD_NAME    The name parameter did not contain a valid name
2089
20903.18. gss_release_buffer
2091
2092      OM_uint32 gss_release_buffer (
2093                    OM_uint32 *     minor_status,
2094                    gss_buffer_t    buffer)
2095
2096   Purpose:
2097
2098   Free storage associated with a buffer format name.  The storage must
2099   have been allocated by a GSSAPI routine.  In addition to freeing the
2100   associated storage, the routine will zero the length field in the
2101   buffer parameter.
2102
2103   Parameters:
2104
2105      minor_status      integer, modify
2106                        Mechanism specific status code
2107
2108      buffer            buffer, modify
2109                        The storage associated with the buffer will be
2110                        deleted.  The gss_buffer_desc object will not
2111                        be freed, but its length field will be zeroed.
2112
2113   Function value:
2114
2115      GSS status code
2116
2117      GSS_S_COMPLETE    Successful completion
2118
21193.19. gss_release_oid_set
2120
2121      OM_uint32 gss_release_oid_set (
2122                    OM_uint32 *     minor_status,
2123                    gss_OID_set *   set)
2124
2125   Purpose:
2126
2127
2128
2129
2130Wray                                                           [Page 38]
2131
2132RFC 1509            GSSAPI - Overview and C bindings      September 1993
2133
2134
2135   Free storage associated with a gss_OID_set object.  The storage must
2136   have been allocated by a GSSAPI routine.
2137
2138   Parameters:
2139
2140      minor_status      integer, modify
2141                        Mechanism specific status code
2142
2143      set               Set of Object IDs, modify
2144                        The storage associated with the gss_OID_set
2145                        will be deleted.
2146
2147   Function value:
2148
2149      GSS status code
2150
2151      GSS_S_COMPLETE    Successful completion
2152
21533.20. gss_inquire_cred
2154
2155      OM_uint32 gss_inquire_cred (
2156                    OM_uint32  *    minor_status,
2157                    gss_cred_id_t   cred_handle,
2158                    gss_name_t *    name,
2159                    OM_uint32 *     lifetime,
2160                    int *           cred_usage,
2161                    gss_OID_set *   mechanisms )
2162
2163   Purpose:
2164
2165   Obtains information about a credential.  The caller must already have
2166   obtained a handle that refers to the credential.
2167
2168   Parameters:
2169
2170      minor_status      integer, modify
2171                        Mechanism specific status code
2172
2173      cred_handle       gss_cred_id_t, read
2174                        A handle that refers to the target credential.
2175                        Specify GSS_C_NO_CREDENTIAL to inquire about
2176                        the default credential.
2177
2178      name              gss_name_t, modify
2179                        The name whose identity the credential asserts.
2180                        Specify NULL if not required.
2181
2182      lifetime          Integer, modify
2183
2184
2185
2186Wray                                                           [Page 39]
2187
2188RFC 1509            GSSAPI - Overview and C bindings      September 1993
2189
2190
2191                        The number of seconds for which the credential
2192                        will remain valid.  If the credential has
2193                        expired, this parameter will be set to zero.
2194                        If the implementation does not support
2195                        credential expiration, the value
2196                        GSS_C_INDEFINITE will be returned.  Specify
2197                        NULL if not required.
2198
2199      cred_usage        Integer, modify
2200                        How the credential may be used.  One of the
2201                        following:
2202                           GSS_C_INITIATE
2203                           GSS_C_ACCEPT
2204                           GSS_C_BOTH
2205                        Specify NULL if not required.
2206
2207      mechanisms        gss_OID_set, modify
2208                        Set of mechanisms supported by the credential.
2209                        Specify NULL if not required.
2210
2211   Function value:
2212
2213      GSS status code
2214
2215      GSS_S_COMPLETE    Successful completion
2216
2217      GSS_S_NO_CRED     The referenced credentials could not be
2218                        accessed.
2219
2220      GSS_S_DEFECTIVE_CREDENTIAL The referenced credentials were
2221                        invalid.
2222
2223      GSS_S_CREDENTIALS_EXPIRED The referenced credentials have expired.
2224                        If the lifetime parameter was not passed as
2225                        NULL, it will be set to 0.
2226
2227
2228  #ifndef GSSAPI_H_
2229  #define GSSAPI_H_
2230
2231  /*
2232   * First, define the platform-dependent types.
2233   */
2234  typedef <platform-specific> OM_uint32;
2235  typedef <platform-specific> gss_ctx_id_t;
2236  typedef <platform-specific> gss_cred_id_t;
2237  typedef <platform-specific> gss_name_t;
2238
2239
2240
2241
2242Wray                                                           [Page 40]
2243
2244RFC 1509            GSSAPI - Overview and C bindings      September 1993
2245
2246
2247  /*
2248   * Note that a platform supporting the xom.h X/Open header file
2249   * may make use of that header for the definitions of OM_uint32
2250   * and the structure to which gss_OID_desc equates.
2251   */
2252
2253  typedef struct gss_OID_desc_struct {
2254        OM_uint32 length;
2255        void      *elements;
2256  } gss_OID_desc, *gss_OID;
2257
2258  typedef struct gss_OID_set_desc_struct  {
2259        int     count;
2260        gss_OID elements;
2261  } gss_OID_set_desc, *gss_OID_set;
2262
2263  typedef struct gss_buffer_desc_struct {
2264        size_t length;
2265        void *value;
2266  } gss_buffer_desc, *gss_buffer_t;
2267
2268  typedef struct gss_channel_bindings_struct {
2269        OM_uint32 initiator_addrtype;
2270        gss_buffer_desc initiator_address;
2271        OM_uint32 acceptor_addrtype;
2272        gss_buffer_desc acceptor_address;
2273        gss_buffer_desc application_data;
2274  } *gss_channel_bindings_t;
2275
2276
2277  /*
2278   * Six independent flags each of which indicates that a context
2279   * supports a specific service option.
2280   */
2281  #define GSS_C_DELEG_FLAG 1
2282  #define GSS_C_MUTUAL_FLAG 2
2283  #define GSS_C_REPLAY_FLAG 4
2284  #define GSS_C_SEQUENCE_FLAG 8
2285  #define GSS_C_CONF_FLAG 16
2286  #define GSS_C_INTEG_FLAG 32
2287
2288
2289  /*
2290   * Credential usage options
2291   */
2292  #define GSS_C_BOTH 0
2293  #define GSS_C_INITIATE 1
2294  #define GSS_C_ACCEPT 2
2295
2296
2297
2298Wray                                                           [Page 41]
2299
2300RFC 1509            GSSAPI - Overview and C bindings      September 1993
2301
2302
2303  /*
2304   * Status code types for gss_display_status
2305   */
2306  #define GSS_C_GSS_CODE 1
2307  #define GSS_C_MECH_CODE 2
2308
2309  /*
2310   * The constant definitions for channel-bindings address families
2311   */
2312  #define GSS_C_AF_UNSPEC     0;
2313  #define GSS_C_AF_LOCAL      1;
2314  #define GSS_C_AF_INET       2;
2315  #define GSS_C_AF_IMPLINK    3;
2316  #define GSS_C_AF_PUP        4;
2317  #define GSS_C_AF_CHAOS      5;
2318  #define GSS_C_AF_NS         6;
2319  #define GSS_C_AF_NBS        7;
2320  #define GSS_C_AF_ECMA       8;
2321  #define GSS_C_AF_DATAKIT    9;
2322  #define GSS_C_AF_CCITT      10;
2323  #define GSS_C_AF_SNA        11;
2324  #define GSS_C_AF_DECnet     12;
2325  #define GSS_C_AF_DLI        13;
2326  #define GSS_C_AF_LAT        14;
2327  #define GSS_C_AF_HYLINK     15;
2328  #define GSS_C_AF_APPLETALK  16;
2329  #define GSS_C_AF_BSC        17;
2330  #define GSS_C_AF_DSS        18;
2331  #define GSS_C_AF_OSI        19;
2332  #define GSS_C_AF_X25        21;
2333
2334  #define GSS_C_AF_NULLADDR   255;
2335
2336  #define GSS_C_NO_BUFFER ((gss_buffer_t) 0)
2337  #define GSS_C_NULL_OID ((gss_OID) 0)
2338  #define GSS_C_NULL_OID_SET ((gss_OID_set) 0)
2339  #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
2340  #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
2341  #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
2342  #define GSS_C_EMPTY_BUFFER {0, NULL}
2343
2344  /*
2345   * Define the default Quality of Protection for per-message
2346   * services.  Note that an implementation that offers multiple
2347   * levels of QOP may either reserve a value (for example zero,
2348   * as assumed here) to mean "default protection", or alternatively
2349   * may simply equate GSS_C_QOP_DEFAULT to a specific explicit QOP
2350   * value.
2351
2352
2353
2354Wray                                                           [Page 42]
2355
2356RFC 1509            GSSAPI - Overview and C bindings      September 1993
2357
2358
2359   */
2360  #define GSS_C_QOP_DEFAULT 0
2361
2362  /*
2363   * Expiration time of 2^32-1 seconds means infinite lifetime for a
2364   * credential or security context
2365   */
2366  #define GSS_C_INDEFINITE 0xfffffffful
2367
2368
2369  /* Major status codes */
2370
2371  #define GSS_S_COMPLETE 0
2372
2373  /*
2374   * Some "helper" definitions to make the status code macros obvious.
2375   */
2376  #define GSS_C_CALLING_ERROR_OFFSET 24
2377  #define GSS_C_ROUTINE_ERROR_OFFSET 16
2378  #define GSS_C_SUPPLEMENTARY_OFFSET 0
2379  #define GSS_C_CALLING_ERROR_MASK 0377ul
2380  #define GSS_C_ROUTINE_ERROR_MASK 0377ul
2381  #define GSS_C_SUPPLEMENTARY_MASK 0177777ul
2382
2383  /*
2384   * The macros that test status codes for error conditions
2385   */
2386  #define GSS_CALLING_ERROR(x) \
2387    (x & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
2388  #define GSS_ROUTINE_ERROR(x) \
2389    (x & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
2390  #define GSS_SUPPLEMENTARY_INFO(x) \
2391    (x & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
2392  #define GSS_ERROR(x) \
2393    ((GSS_CALLING_ERROR(x) != 0) || (GSS_ROUTINE_ERROR(x) != 0))
2394
2395
2396  /*
2397   * Now the actual status code definitions
2398   */
2399
2400  /*
2401   * Calling errors:
2402   */
2403  #define GSS_S_CALL_INACCESSIBLE_READ \
2404                               (1ul << GSS_C_CALLING_ERROR_OFFSET)
2405  #define GSS_S_CALL_INACCESSIBLE_WRITE \
2406                               (2ul << GSS_C_CALLING_ERROR_OFFSET)
2407
2408
2409
2410Wray                                                           [Page 43]
2411
2412RFC 1509            GSSAPI - Overview and C bindings      September 1993
2413
2414
2415  #define GSS_S_CALL_BAD_STRUCTURE \
2416                               (3ul << GSS_C_CALLING_ERROR_OFFSET)
2417
2418  /*
2419   * Routine errors:
2420   */
2421  #define GSS_S_BAD_MECH (1ul << GSS_C_ROUTINE_ERROR_OFFSET)
2422  #define GSS_S_BAD_NAME (2ul << GSS_C_ROUTINE_ERROR_OFFSET)
2423  #define GSS_S_BAD_NAMETYPE (3ul << GSS_C_ROUTINE_ERROR_OFFSET)
2424  #define GSS_S_BAD_BINDINGS (4ul << GSS_C_ROUTINE_ERROR_OFFSET)
2425  #define GSS_S_BAD_STATUS (5ul << GSS_C_ROUTINE_ERROR_OFFSET)
2426  #define GSS_S_BAD_SIG (6ul << GSS_C_ROUTINE_ERROR_OFFSET)
2427  #define GSS_S_NO_CRED (7ul << GSS_C_ROUTINE_ERROR_OFFSET)
2428  #define GSS_S_NO_CONTEXT (8ul << GSS_C_ROUTINE_ERROR_OFFSET)
2429  #define GSS_S_DEFECTIVE_TOKEN (9ul << GSS_C_ROUTINE_ERROR_OFFSET)
2430  #define GSS_S_DEFECTIVE_CREDENTIAL (10ul << GSS_C_ROUTINE_ERROR_OFFSET)
2431  #define GSS_S_CREDENTIALS_EXPIRED (11ul << GSS_C_ROUTINE_ERROR_OFFSET)
2432  #define GSS_S_CONTEXT_EXPIRED (12ul << GSS_C_ROUTINE_ERROR_OFFSET)
2433  #define GSS_S_FAILURE (13ul << GSS_C_ROUTINE_ERROR_OFFSET)
2434
2435  /*
2436   * Supplementary info bits:
2437   */
2438  #define GSS_S_CONTINUE_NEEDED (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
2439  #define GSS_S_DUPLICATE_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
2440  #define GSS_S_OLD_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
2441  #define GSS_S_UNSEQ_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 3))
2442
2443
2444  /*
2445   * Finally, function prototypes for the GSSAPI routines.
2446   */
2447
2448  OM_uint32 gss_acquire_cred
2449             (OM_uint32*,       /* minor_status */
2450              gss_name_t,       /* desired_name */
2451              OM_uint32,        /* time_req */
2452              gss_OID_set,      /* desired_mechs */
2453              int,              /* cred_usage */
2454              gss_cred_id_t*,   /* output_cred_handle */
2455              gss_OID_set*,     /* actual_mechs */
2456              OM_uint32*        /* time_rec */
2457             );
2458
2459  OM_uint32 gss_release_cred,
2460             (OM_uint32*,       /* minor_status */
2461              gss_cred_id_t*    /* cred_handle */
2462             );
2463
2464
2465
2466Wray                                                           [Page 44]
2467
2468RFC 1509            GSSAPI - Overview and C bindings      September 1993
2469
2470
2471  OM_uint32 gss_init_sec_context
2472             (OM_uint32*,       /* minor_status */
2473              gss_cred_id_t,    /* claimant_cred_handle */
2474              gss_ctx_id_t*,    /* context_handle */
2475              gss_name_t,       /* target_name */
2476              gss_OID,          /* mech_type */
2477              int,              /* req_flags */
2478              OM_uint32,        /* time_req */
2479              gss_channel_bindings_t,
2480                                /* input_chan_bindings */
2481              gss_buffer_t,     /* input_token */
2482              gss_OID*,         /* actual_mech_type */
2483              gss_buffer_t,     /* output_token */
2484              int*,             /* ret_flags */
2485              OM_uint32*        /* time_rec */
2486             );
2487
2488  OM_uint32 gss_accept_sec_context
2489             (OM_uint32*,       /* minor_status */
2490              gss_ctx_id_t*,    /* context_handle */
2491              gss_cred_id_t,    /* verifier_cred_handle */
2492              gss_buffer_t,     /* input_token_buffer */
2493              gss_channel_bindings_t,
2494                                /* input_chan_bindings */
2495              gss_name_t*,      /* src_name */
2496              gss_OID*,         /* mech_type */
2497              gss_buffer_t,     /* output_token */
2498              int*,             /* ret_flags */
2499              OM_uint32*,       /* time_rec */
2500              gss_cred_id_t*    /* delegated_cred_handle */
2501             );
2502
2503  OM_uint32 gss_process_context_token
2504             (OM_uint32*,       /* minor_status */
2505              gss_ctx_id_t,     /* context_handle */
2506              gss_buffer_t      /* token_buffer */
2507             );
2508
2509  OM_uint32 gss_delete_sec_context
2510             (OM_uint32*,       /* minor_status */
2511              gss_ctx_id_t*,    /* context_handle */
2512              gss_buffer_t      /* output_token */
2513             );
2514
2515
2516
2517
2518
2519
2520
2521
2522Wray                                                           [Page 45]
2523
2524RFC 1509            GSSAPI - Overview and C bindings      September 1993
2525
2526
2527  OM_uint32 gss_context_time
2528             (OM_uint32*,       /* minor_status */
2529              gss_ctx_id_t,     /* context_handle */
2530              OM_uint32*        /* time_rec */
2531             );
2532
2533  OM_uint32 gss_sign
2534             (OM_uint32*,       /* minor_status */
2535              gss_ctx_id_t,     /* context_handle */
2536              int,              /* qop_req */
2537              gss_buffer_t,     /* message_buffer */
2538              gss_buffer_t      /* message_token */
2539             );
2540
2541  OM_uitn32 gss_verify
2542             (OM_uint32*,       /* minor_status */
2543              gss_ctx_id_t,     /* context_handle */
2544              gss_buffer_t,     /* message_buffer */
2545              gss_buffer_t,     /* token_buffer */
2546              int*              /* qop_state */
2547             );
2548
2549  OM_uint32 gss_seal
2550             (OM_uint32*,       /* minor_status */
2551              gss_ctx_id_t,     /* context_handle */
2552              int,              /* conf_req_flag */
2553              int,              /* qop_req */
2554              gss_buffer_t,     /* input_message_buffer */
2555              int*,             /* conf_state */
2556              gss_buffer_t      /* output_message_buffer */
2557             );
2558
2559  OM_uint32 gss_unseal
2560             (OM_uint32*,       /* minor_status */
2561              gss_ctx_id_t,     /* context_handle */
2562              gss_buffer_t,     /* input_message_buffer */
2563              gss_buffer_t,     /* output_message_buffer */
2564              int*,             /* conf_state */
2565              int*              /* qop_state */
2566             );
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578Wray                                                           [Page 46]
2579
2580RFC 1509            GSSAPI - Overview and C bindings      September 1993
2581
2582
2583  OM_uint32 gss_display_status
2584             (OM_uint32*,       /* minor_status */
2585              OM_uint32,        /* status_value */
2586              int,              /* status_type */
2587              gss_OID,          /* mech_type */
2588              int*,             /* message_context */
2589              gss_buffer_t      /* status_string */
2590             );
2591
2592  OM_uint32 gss_indicate_mechs
2593             (OM_uint32*,       /* minor_status */
2594              gss_OID_set*      /* mech_set */
2595             );
2596
2597  OM_uint32 gss_compare_name
2598             (OM_uint32*,       /* minor_status */
2599              gss_name_t,       /* name1 */
2600              gss_name_t,       /* name2 */
2601              int*              /* name_equal */
2602             );
2603
2604  OM_uint32 gss_display_name,
2605             (OM_uint32*,      /* minor_status */
2606              gss_name_t,      /* input_name */
2607              gss_buffer_t,     /* output_name_buffer */
2608              gss_OID*         /* output_name_type */
2609             );
2610
2611  OM_uint32 gss_import_name
2612             (OM_uint32*,       /* minor_status */
2613              gss_buffer_t,     /* input_name_buffer */
2614              gss_OID,          /* input_name_type */
2615              gss_name_t*       /* output_name */
2616             );
2617
2618  OM_uint32 gss_release_name
2619             (OM_uint32*,       /* minor_status */
2620              gss_name_t*       /* input_name */
2621             );
2622
2623  OM_uint32 gss_release_buffer
2624             (OM_uint32*,       /* minor_status */
2625              gss_buffer_t      /* buffer */
2626             );
2627
2628  OM_uint32 gss_release_oid_set
2629             (OM_uint32*,       /* minor_status */
2630              gss_OID_set*      /* set */
2631
2632
2633
2634Wray                                                           [Page 47]
2635
2636RFC 1509            GSSAPI - Overview and C bindings      September 1993
2637
2638
2639             );
2640
2641  OM_uint32 gss_inquire_cred
2642             (OM_uint32 *,      /* minor_status */
2643              gss_cred_id_t,    /* cred_handle */
2644              gss_name_t *,     /* name */
2645              OM_uint32 *,      /* lifetime */
2646              int *,            /* cred_usage */
2647              gss_OID_set *     /* mechanisms */
2648             );
2649
2650
2651
2652  #endif /* GSSAPI_H_ */
2653
2654References
2655
2656   [1] Linn, J., "Generic Security Service Application Program
2657       Interface", RFC 1508, Geer Zolot Associate, September 1993.
2658
2659   [2] "OSI Object Management API Specification, Version 2.0 t", X.400
2660       API Association & X/Open Company Limited, August 24, 1990.
2661       Specification of datatypes and routines for manipulating
2662       information objects.
2663
2664Security Considerations
2665
2666   Security issues are discussed throughout this memo.
2667
2668Author's Address
2669
2670   John Wray
2671   Digital Equipment Corporation
2672   550 King Street, LKG2-2/AA6
2673   Littleton, MA  01460
2674   USA
2675
2676   Phone: +1-508-486-5210
2677   EMail: Wray@tuxedo.enet.dec.com
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690Wray                                                           [Page 48]
2691