home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft_ietf_a_c / draft-ietf-cat-gssv2-cbind-03.txt < prev    next >
Text File  |  1996-11-26  |  205KB  |  6,138 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.    Internet draft                                                    J.Wray
  8.    IETF Common Authentication Technology WG   Digital Equipment Corporation
  9.    <draft-ietf-cat-gssv2-cbind-03.txt>                        November 1996
  10.  
  11.  
  12.  
  13.              Generic Security Service API Version 2 : C-bindings
  14.  
  15.  
  16.    1. STATUS OF THIS MEMO
  17.  
  18.    This document is an Internet Draft.  Internet Drafts are working
  19.    documents of the Internet Engineering Task Force (IETF), its Areas, and
  20.    its Working Groups.  Note that other groups may also distribute working
  21.    documents as Internet Drafts.  Internet Drafts are draft documents valid
  22.    for a maximum of six months. Internet Drafts may be updated, replaced,
  23.    or obsoleted by other documents at any time.  It is not appropriate to
  24.    use Internet Drafts as reference material or to cite them other than as
  25.    a "working draft" or "work in progress." Please check the I-D abstract
  26.    listing contained in each Internet Draft directory to learn the current
  27.    status of this or any other Internet Draft.
  28.  
  29.    Comments on this document should be sent to "cat-ietf@MIT.EDU", the IETF
  30.    Common Authentication Technology WG discussion list.
  31.  
  32.  
  33.    2. ABSTRACT
  34.  
  35.    This draft document specifies C language bindings for Version 2 of the
  36.    Generic Security Service Application Program Interface (GSSAPI), which
  37.    is described at a language-independent conceptual level in other drafts
  38.    [GSSAPI]. It revises RFC-1509, making specific incremental changes in
  39.    response to implementation experience and liaison requests.  It is
  40.    intended, therefore, that this draft or a successor version thereof will
  41.    become the basis for subsequent progression of the GSS-API specification
  42.    on the standards track.
  43.  
  44.    The Generic Security Service Application Programming Interface provides
  45.    security services to its callers, and is intended for implementation
  46.    atop a variety of underlying cryptographic mechanisms.  Typically,
  47.    GSSAPI callers will be application protocols into which security
  48.    enhancements are integrated through invocation of services provided by
  49.    the GSSAPI. The GSSAPI allows a caller application to authenticate a
  50.    principal identity associated with a peer application, to delegate
  51.    rights to a peer, and to apply security services such as confidentiality
  52.    and integrity on a per-message basis.
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.    Wray                Document Expiration: 1 June 1997            [Page 1]
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  70.  
  71.  
  72.  
  73.    3. INTRODUCTION
  74.  
  75.    The Generic Security Service Application Programming Interface [GSSAPI]
  76.    provides security services to calling applications.  It allows a
  77.    communicating application to authenticate the user associated with
  78.    another application, to delegate rights to another application, and to
  79.    apply security services such as confidentiality and integrity on a per-
  80.    message basis.
  81.  
  82.    There are four stages to using the GSSAPI:
  83.  
  84.      (a) The application acquires a set of credentials with which it may
  85.          prove its identity to other processes.  The application's
  86.          credentials vouch for its global identity, which may or may not be
  87.          related to any local username under which it may be running.
  88.  
  89.      (b) A pair of communicating applications establish a joint security
  90.          context using their credentials.  The security context is a pair
  91.          of GSSAPI data structures that contain shared state information,
  92.          which is required in order that per-message security services may
  93.          be provided.  Examples of state that might be shared between
  94.          applications as part of a security context are cryptographic keys,
  95.          and message sequence numbers.  As part of the establishment of a
  96.          security context, the context initiator is authenticated to the
  97.          responder, and may require that the responder is authenticated in
  98.          turn.  The initiator may optionally give the responder the right
  99.          to initiate further security contexts, acting as an agent or
  100.          delegate of the initiator.  This transfer of rights is termed
  101.          delegation, and is achieved by creating a set of credentials,
  102.          similar to those used by the initiating application, but which may
  103.          be used by the responder.
  104.  
  105.          To establish and maintain the shared information that makes up the
  106.          security context, certain GSSAPI calls will return a token data
  107.          structure, which is a cryptographically protected opaque data
  108.          type.  The caller of such a GSSAPI routine is responsible for
  109.          transferring the token to the peer application, encapsulated if
  110.          necessary in an application-application protocol.  On receipt of
  111.          such a token, the peer application should pass it to a
  112.          corresponding GSSAPI routine which will decode the token and
  113.          extract the information, updating the security context state
  114.          information accordingly.
  115.  
  116.      (c) Per-message services are invoked to apply either:
  117.  
  118.            (i) integrity and data origin authentication, or
  119.  
  120.           (ii) confidentiality, integrity and data origin authentication
  121.  
  122.          to application data, which are treated by GSSAPI as arbitrary
  123.          octet-strings.  An application transmitting a message that it
  124.  
  125.  
  126.  
  127.    Wray                Document Expiration: 1 June 1997            [Page 2]
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  136.  
  137.  
  138.  
  139.          wishes to protect will call the appropriate GSSAPI routine
  140.          (gss_get_mic or gss_wrap) to apply protection, specifying the
  141.          appropriate security context, and send the resulting token to the
  142.          receiving application.  The receiver will pass the received token
  143.          (and, in the case of data protected by gss_get_mic, the
  144.          accompanying message-data) to the corresponding decoding routine
  145.          (gss_verify_mic or gss_unwrap) to remove the protection and
  146.          validate the data.
  147.  
  148.      (d) At the completion of a communications session (which may extend
  149.          across several transport connections), each application calls a
  150.          GSSAPI routine to delete the security context.  Multiple contexts
  151.          may also be used (either successively or simultaneously) within a
  152.          single communications association, at the option of the
  153.          applications.
  154.  
  155.  
  156.    4. GSSAPI ROUTINES
  157.  
  158.    This section lists the routines that make up the GSSAPI, and offers a
  159.    brief description of the purpose of each routine.  Detailed descriptions
  160.    of each routine are listed in alphabetical order in section 7.
  161.  
  162.    Table 4-1  GSSAPI Credential-management Routines
  163.  
  164.          ROUTINE            SECTION        FUNCTION
  165.  
  166.      gss_acquire_cred          7.2  Assume a global identity;
  167.                                     Obtain a GSSAPI credential
  168.                                     handle for pre-existing
  169.                                     credentials.
  170.  
  171.      gss_add_cred              7.3  Construct credentials
  172.                                     incrementally
  173.  
  174.      gss_inquire_cred          7.21 Obtain information about
  175.                                     a credential.
  176.  
  177.      gss_inquire_cred_by_mech  7.22 Obtain per-mechanism information
  178.                                     about a credential.
  179.  
  180.      gss_release_cred          7.28 Discard a credential handle.
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.    Wray                Document Expiration: 1 June 1997            [Page 3]
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  202.  
  203.  
  204.  
  205.    Table 4-2  GSSAPI Context-level Routines
  206.  
  207.          ROUTINE            SECTION        FUNCTION
  208.  
  209.      gss_init_sec_context      7.19 Initiate a security context
  210.                                     with a peer application
  211.  
  212.  
  213.      gss_accept_sec_context    7.1  Accept a security context
  214.                                     initiated by a peer
  215.                                     application
  216.  
  217.      gss_delete_sec_context    7.9  Discard a security context
  218.  
  219.      gss_process_context_token 7.26 Process a token on a security
  220.                                     context from a peer
  221.                                     application
  222.  
  223.      gss_context_time          7.7  Determine for how long a
  224.                                     context will remain valid
  225.  
  226.      gss_inquire_context       7.20 Obtain information about a
  227.                                     security context
  228.  
  229.      gss_wrap_size_limit       7.37 Determine token-size limit for
  230.                                     gss_wrap on a context
  231.  
  232.      gss_export_sec_context    7.14 Transfer a security context to
  233.                                     another process
  234.  
  235.      gss_import_sec_context    7.17 Import a transferred context
  236.  
  237.  
  238.  
  239.  
  240.    Table 4-3  GSSAPI Per-message Routines
  241.  
  242.          ROUTINE            SECTION        FUNCTION
  243.  
  244.      gss_get_mic               7.15 Calculate a cryptographic
  245.                                     Message Integrity Code (MIC)
  246.                                     for a message; integrity service
  247.  
  248.      gss_verify_mic            7.35 Check a MIC against a message;
  249.                                     verify integrity of a received
  250.                                     message
  251.  
  252.      gss_wrap                  7.36 Attach a MIC to a message, and
  253.                                     optionally encrypt the message
  254.                                     content; confidentiality service
  255.  
  256.  
  257.  
  258.  
  259.    Wray                Document Expiration: 1 June 1997            [Page 4]
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  268.  
  269.  
  270.  
  271.      gss_unwrap                7.34 Verify a message with attached
  272.                                     MIC, and decrypt message
  273.                                     content if necessary.
  274.  
  275.  
  276.  
  277.  
  278.    Table 4-4  GSSAPI Name manipulation Routines
  279.  
  280.          ROUTINE              SECTION        FUNCTION
  281.  
  282.      gss_import_name            7.16 Convert a contiguous string name
  283.                                      to internal-form
  284.  
  285.      gss_display_name           7.10 Convert internal-form name
  286.                                      to text
  287.  
  288.      gss_compare_name           7.6  Compare two internal-form names
  289.  
  290.      gss_release_name           7.29 Discard an internal-form name
  291.  
  292.      gss_inquire_names_for_mech 7.24 List the name-types supported
  293.                                      by a specified mechanism
  294.  
  295.      gss_inquire_mechs_for_name 7.23 List mechanisms that support
  296.                                      by a given nametype
  297.  
  298.      gss_canonicalize_name      7.5  Convert an internal name to
  299.                                      an MN.
  300.  
  301.      gss_export_name            7.13 Convert an MN to export form
  302.  
  303.      gss_duplicate_name         7.12 Create a copy of an internal name
  304.  
  305.  
  306.  
  307.  
  308.    Table 4-5  GSSAPI Miscellaneous Routines
  309.  
  310.          ROUTINE              SECTION        FUNCTION
  311.  
  312.      gss_display_status         7.11 Convert a GSSAPI status code
  313.                                      to text
  314.  
  315.      gss_indicate_mechs         7.18 Determine available underlying
  316.                                      authentication mechanisms
  317.  
  318.      gss_release_buffer         7.27 Discard a buffer
  319.  
  320.      gss_release_oid            7.30 Discard an object identifier
  321.  
  322.  
  323.  
  324.  
  325.    Wray                Document Expiration: 1 June 1997            [Page 5]
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  334.  
  335.  
  336.  
  337.      gss_release_oid_set        7.31 Discard a set of object
  338.                                      identifiers
  339.  
  340.      gss_create_empty_oid_set   7.8  Create a set containing no
  341.                                      object identifiers
  342.  
  343.      gss_add_oid_set_member     7.4  Add an object identifier to
  344.                                      a set
  345.  
  346.      gss_test_oid_set_member    7.33 Determines whether an object
  347.                                      identifier is a member of a set
  348.  
  349.      gss_oid_to_str             7.25 Create a printable
  350.                                      representation of an object
  351.                                      identifier
  352.  
  353.      gss_str_to_oid             7.32 Create an object identifier from
  354.                                      its printable representation
  355.  
  356.  
  357.  
  358.  
  359.  
  360.    Individual GSSAPI implementations may augment these routines by
  361.    providing additional mechanism-specific routines if required
  362.    functionality is not available from the generic forms.  Applications are
  363.    encouraged to use the generic routines wherever possible on portability
  364.    grounds.
  365.  
  366.  
  367.    5. DATA TYPES AND CALLING CONVENTIONS
  368.  
  369.    The following conventions are used by the GSSAPI C-language bindings:
  370.  
  371.    5.1.  Integer types
  372.  
  373.    GSSAPI uses the following integer data type:
  374.  
  375.         OM_uint32      32-bit unsigned integer
  376.  
  377.    Where guaranteed minimum bit-count is important, this portable data type
  378.    is used by the GSSAPI routine definitions.  Individual GSSAPI
  379.    implementations will include appropriate typedef definitions to map this
  380.    type onto a built-in data type.  If the platform supports the X/Open
  381.    xom.h header file, the OM_uint32 definition contained therein should be
  382.    used; the GSSAPI header file in Appendix A contains logic that will
  383.    detect the prior inclusion of xom.h, and will not attempt to re-declare
  384.    OM_uint32.  If the X/Open header file is not available on the platform,
  385.    the GSSAPI implementation should use the smallest natural unsigned
  386.    integer type that provides at least 32 bits of precision.
  387.  
  388.  
  389.  
  390.  
  391.    Wray                Document Expiration: 1 June 1997            [Page 6]
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  400.  
  401.  
  402.  
  403.    5.2.  String and similar data
  404.  
  405.    Many of the GSSAPI routines take arguments and return values that
  406.    describe contiguous octet-strings.  All such data is passed between the
  407.    GSSAPI and the caller using the gss_buffer_t data type.  This data type
  408.    is a pointer to a buffer descriptor, which consists of a length field
  409.    that contains the total number of bytes in the datum, and a value field
  410.    which contains a pointer to the actual datum:
  411.  
  412.  
  413.         typedef struct gss_buffer_desc_struct {
  414.            size_t  length;
  415.            void    *value;
  416.         } gss_buffer_desc, *gss_buffer_t;
  417.  
  418.    Storage for data passed to the application by a GSSAPI routine using the
  419.    gss_buffer_t conventions is allocated by the GSSAPI routine.  The
  420.    application may free this storage by invoking the gss_release_buffer
  421.    routine.  Allocation of the gss_buffer_desc object is always the
  422.    responsibility of the application;  unused gss_buffer_desc objects may
  423.    be initialized to the value GSS_C_EMPTY_BUFFER.
  424.  
  425.    5.2.1.  Opaque data types
  426.  
  427.    Certain multiple-word data items are considered opaque data types at the
  428.    GSSAPI, because their internal structure has no significance either to
  429.    the GSSAPI or to the caller.  Examples of such opaque data types are the
  430.    input_token parameter to gss_init_sec_context (which is opaque to the
  431.    caller), and the input_message parameter to gss_wrap (which is opaque to
  432.    the GSSAPI).  Opaque data is passed between the GSSAPI and the
  433.    application using the gss_buffer_t datatype.
  434.  
  435.    5.2.2.  Character strings
  436.  
  437.    Certain multiple-word data items may be regarded as simple ISO Latin-1
  438.    character strings.  Examples are the printable strings passed to
  439.    gss_import_name via the input_name_buffer parameter. Some GSSAPI
  440.    routines also return character strings.  All such character strings are
  441.    passed between the application and the GSSAPI implementation using the
  442.    gss_buffer_t datatype, which is a pointer to a gss_buffer_desc object.
  443.  
  444.    When a gss_buffer_desc object describes a printable string, the length
  445.    field of the gss_buffer_desc should only count printable characters
  446.    within the string.  In particular, a trailing NUL character should NOT
  447.    be included in the length count, nor should either the GSSAPI
  448.    implementation or the application assume the presence of an uncounted
  449.    trailing NUL.
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.    Wray                Document Expiration: 1 June 1997            [Page 7]
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  466.  
  467.  
  468.  
  469.    5.3.  Object Identifiers
  470.  
  471.    Certain GSSAPI procedures take parameters of the type gss_OID, or Object
  472.    identifier.  This is a type containing ISO-defined tree-structured
  473.    values, and is used by the GSSAPI caller to select an underlying
  474.    security mechanism and to specify namespaces.  A value of type gss_OID
  475.    has the following structure:
  476.  
  477.         typedef struct gss_OID_desc_struct {
  478.            OM_uint32 length;
  479.            void      *elements;
  480.         } gss_OID_desc, *gss_OID;
  481.  
  482.    The elements field of this structure points to the first byte of an
  483.    octet string containing the ASN.1 BER encoding of the value portion of
  484.    the normal BER TLV encoding of the gss_OID.  The length field contains
  485.    the number of bytes in this value.  For example, the gss_OID value
  486.    corresponding to {iso(1) identified-organization(3) icd-ecma(12)
  487.    member-company(2) dec(1011) cryptoAlgorithms(7) DASS(5)}, meaning the
  488.    DASS X.509 authentication mechanism, has a length field of 7 and an
  489.    elements field pointing to seven octets containing the following octal
  490.    values: 53,14,2,207,163,7,5. GSSAPI implementations should provide
  491.    constant gss_OID values to allow callers to request any supported
  492.    mechanism, although applications are encouraged on portability grounds
  493.    to accept the default mechanism.  gss_OID values should also be provided
  494.    to allow applications to specify particular name types (see section
  495.    5.9).  Applications should treat gss_OID_desc values returned by GSSAPI
  496.    routines as read-only.  In particular, the application should not
  497.    attempt to deallocate them with free(), although they can be safely
  498.    passed to the gss_release_oid routine.  The gss_OID_desc datatype is
  499.    equivalent to the X/Open OM_object_identifier datatype[XOM].
  500.  
  501.    5.4.  Object Identifier Sets
  502.  
  503.    Certain GSSAPI procedures take parameters of the type gss_OID_set.  This
  504.    type represents one or more object identifiers (section 5.3).  A
  505.    gss_OID_set object has the following structure:
  506.  
  507.         typedef struct gss_OID_set_desc_struct {
  508.            size_t       count;
  509.            gss_OID   elements;
  510.         } gss_OID_set_desc, *gss_OID_set;
  511.  
  512.    The count field contains the number of OIDs within the set.  The
  513.    elements field is a pointer to an array of gss_OID_desc objects, each of
  514.    which describes a single OID.  gss_OID_set values are used to name the
  515.    available mechanisms supported by the GSSAPI, to request the use of
  516.    specific mechanisms, and to indicate which mechanisms a given credential
  517.    supports.  Storage associated with gss_OID_set values returned to the
  518.    application by the GSSAPI may be deallocated by the gss_release_oid_set
  519.    routine.
  520.  
  521.  
  522.  
  523.    Wray                Document Expiration: 1 June 1997            [Page 8]
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  532.  
  533.  
  534.  
  535.    5.5.  Credentials
  536.  
  537.    A credential handle is a caller-opaque atomic datum that identifies a
  538.    GSSAPI credential data structure.  It is represented by the caller-
  539.    opaque type gss_cred_id_t, which should be implemented as a pointer or
  540.    arithmetic type.  If a pointer implementation is chosen, care must be
  541.    taken to ensure that two gss_cred_id_t values may be compared with the
  542.    == operator.
  543.  
  544.    GSSAPI credentials can contain mechanism-specific principal
  545.    authentication data for multiple mechanisms.  A GSSAPI credential is
  546.    composed of a set of credential-elements, each of which is applicable to
  547.    a single mechanism.  A credential may contain at most one credential-
  548.    element for each supported mechanism. A credential-element identifies
  549.    the data needed by a single mechanism to authenticate a single
  550.    principal, and conceptually contains two credential-references that
  551.    describing the actual mechanism-specific authentication data, one to be
  552.    used by GSSAPI for initiating contexts,  and one to be used for
  553.    accepting contexts.  For mechanisms that do not distinguish between
  554.    acceptor and initiator credentials, both references would point to the
  555.    same underlying mechanism-specific authentication data.
  556.  
  557.    Credentials describe a set of mechanism-specific principals, and give
  558.    their holder the ability to act as any of those principals.  All
  559.    principal identities asserted by a single GSSAPI credential should
  560.    belong to the same entity, although enforcement of this property is an
  561.    implementation-specific matter.  The GSSAPI does not make the actual
  562.    credentials available to applications; instead a credential handle is
  563.    used to identify a particular credential, held internally by GSSAPI.
  564.    The combination of GSSAPI credential handle and mechanism identifies the
  565.    principal whose identity will be asserted by the credential when used
  566.    with that mechanism.
  567.  
  568.    The gss_init_sec_context and gss_accept_sec_context routines allow the
  569.    value GSS_C_NO_CREDENTIAL to be specified as their credential handle
  570.    parameter.  This special credential-handle indicates a desire by the
  571.    application to act as a default principal.  While individual GSSAPI
  572.    implementations are free to determine such default behavior as
  573.    appropriate to the mechanism, the following default behavior by these
  574.    routines is recommended for portability:
  575.  
  576.      (a) gss_init_sec_context
  577.  
  578.            (i) If there is only a single principal capable of initiating
  579.                security contexts for the chosen mechanism that the
  580.                application is authorized to act on behalf of, then that
  581.                principal shall be used, otherwise
  582.  
  583.           (ii) If the platform maintains a concept of a default network-
  584.                identity for the chosen mechanism, and if the application is
  585.                authorized to act on behalf of that identity for the purpose
  586.  
  587.  
  588.  
  589.    Wray                Document Expiration: 1 June 1997            [Page 9]
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  598.  
  599.  
  600.  
  601.                of initiating security contexts, then the principal
  602.                corresponding to that identity shall be used, otherwise
  603.  
  604.          (iii) If the platform maintains a concept of a default local
  605.                identity, and provides a means to map local identities into
  606.                network-identities for the chosen mechanism, and if the
  607.                application is authorized to act on behalf of the network-
  608.                identity image of the default local identity for the purpose
  609.                of initiating security contexts using the chosen mechanism,
  610.                then the principal corresponding to that identity shall be
  611.                used, otherwise
  612.  
  613.           (iv) A user-configurable default identity should be used.
  614.  
  615.      (b) gss_accept_sec_context
  616.  
  617.            (i) If there is only a single authorized principal identity
  618.                capable of accepting security contexts for the chosen
  619.                mechanism, then that principal shall be used, otherwise
  620.  
  621.           (ii) If the mechanism can determine the identity of the target
  622.                principal by examining the context-establishment token, and
  623.                if the accepting application is authorized to act as that
  624.                principal for the purpose of accepting security contexts
  625.                using the chosen mechanism, then that principal identity
  626.                shall be used, otherwise
  627.  
  628.          (iii) If the mechanism supports context acceptance by any
  629.                principal, and if mutual authentication was not requested,
  630.                any principal that the application is authorized to accept
  631.                security contexts under using the chosen mechanismmay be
  632.                used, otherwise
  633.  
  634.           (iv) A user-configurable default identity shall be used.
  635.  
  636.    The purpose of the above rules is to allow security contexts to be
  637.    established by both initiator and acceptor using the default behavior
  638.    wherever possible.  Applications requesting default behavior are likely
  639.    to be more portable across mechanisms and platforms than ones that use
  640.    gss_acquire_cred to request a specific identity.
  641.  
  642.    5.6.  Contexts
  643.  
  644.    The gss_ctx_id_t data type contains a caller-opaque atomic value that
  645.    identifies one end of a GSSAPI security context.  It should be
  646.    implemented as a pointer or arithmetic type.  If a pointer type is
  647.    chosen, care should be taken to ensure that two gss_ctx_id_t values may
  648.    be compared with the == operator.
  649.  
  650.    The security context holds state information about each end of a peer
  651.    communication, including cryptographic state information.
  652.  
  653.  
  654.  
  655.    Wray                Document Expiration: 1 June 1997           [Page 10]
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  664.  
  665.  
  666.  
  667.    5.7.  Authentication tokens
  668.  
  669.    A token is a caller-opaque type that GSSAPI uses to maintain
  670.    synchronization between the context data structures at each end of a
  671.    GSSAPI security context.  The token is a cryptographically protected
  672.    octet-string, generated by the underlying mechanism at one end of a
  673.    GSSAPI security context for use by the peer mechanism at the other end.
  674.    Encapsulation (if required) and transfer of the token are the
  675.    responsibility of the peer applications.  A token is passed between the
  676.    GSSAPI and the application using the gss_buffer_t conventions.
  677.  
  678.    5.8.  Interprocess tokens
  679.  
  680.    Certain GSSAPI routines are intended to transfer data between processes
  681.    in multi-process programs.  These routines use a caller-opaque octet-
  682.    string, generated by the GSSAPI in one process for use by the GSSAPI in
  683.    another process.  The calling application is responsible for
  684.    transferring such tokens between processes in an OS-specific manner.
  685.    Note that, while GSSAPI implementors are encouraged to avoid placing
  686.    sensitive information within interprocess tokens, or to
  687.    cryptographically protect them, many implementations will be unable to
  688.    avoid placing key material or other sensitive data within them.  It is
  689.    the application's responsibility to ensure that interprocess tokens are
  690.    protected in transit, and transferred only to processes that are
  691.    trustworthy. An interprocess token is passed between the GSSAPI and the
  692.    application using the gss_buffer_t conventions.
  693.  
  694.    5.9.  Status values
  695.  
  696.    One or more status codes are returned by each GSSAPI routine.  Two
  697.    distinct sorts of status codes are returned.  These are termed GSS
  698.    status codes and Mechanism status codes.
  699.  
  700.    5.9.1.  GSS status codes
  701.  
  702.    GSSAPI routines return GSS status codes as their OM_uint32 function
  703.    value.  These codes indicate errors that are independent of the
  704.    underlying mechanism(s) used to provide the security service.  The
  705.    errors that can be indicated via a GSS status code are either generic
  706.    API routine errors (errors that are defined in the GSS-API
  707.    specification) or calling errors (errors that are specific to these
  708.    language bindings).
  709.  
  710.    A GSS status code can indicate a single fatal generic API error from the
  711.    routine and a single calling error.  In addition, supplementary status
  712.    information may be indicated via the setting of bits in the
  713.    supplementary info field of a GSS status code.
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.    Wray                Document Expiration: 1 June 1997           [Page 11]
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  730.  
  731.  
  732.  
  733.    These errors are encoded into the 32-bit GSS status code as follows:
  734.  
  735.        MSB                                                        LSB
  736.        |------------------------------------------------------------|
  737.        | Calling Error | Routine Error  |    Supplementary Info     |
  738.        |------------------------------------------------------------|
  739.     Bit 31           24 23            16 15                        0
  740.  
  741.  
  742.    Hence if a GSS-API routine returns a GSS status code whose upper 16 bits
  743.    contain a non-zero value, the call failed.  If the calling error field
  744.    is non-zero, the invoking application's call of the routine was
  745.    erroneous.  Calling errors are defined in table 5-1.  If the routine
  746.    error field is non-zero, the routine failed for one of the routine-
  747.    specific reasons listed below in table 5-2.  Whether or not the upper 16
  748.    bits indicate a failure or a success, the routine may indicate
  749.    additional information by setting bits in the supplementary info field
  750.    of the status code.  The meaning of individual bits is listed below in
  751.    table 5-3.
  752.  
  753.    Table 5-1  Calling Errors
  754.  
  755.          Name                    Value in        Meaning
  756.                                    Field
  757.     GSS_S_CALL_INACCESSIBLE_READ     1           A required input
  758.                                                  parameter could
  759.                                                  not be read.
  760.     GSS_S_CALL_INACCESSIBLE_WRITE    2           A required output
  761.                                                  parameter could
  762.                                                  not be written.
  763.     GSS_S_CALL_BAD_STRUCTURE         3           A parameter was
  764.                                                  malformed
  765.  
  766.  
  767.  
  768.  
  769.    Table 5-2  Routine Errors
  770.  
  771.           Name             Value in       Meaning
  772.                             Field
  773.  
  774.     GSS_S_BAD_MECH             1      An unsupported mechanism was
  775.                                       requested
  776.     GSS_S_BAD_NAME             2      An invalid name was supplied
  777.     GSS_S_BAD_NAMETYPE         3      A supplied name was of an
  778.                                       unsupported type
  779.     GSS_S_BAD_BINDINGS         4      Incorrect channel bindings
  780.                                       were supplied
  781.     GSS_S_BAD_STATUS           5      An invalid status code was
  782.  
  783.  
  784.  
  785.  
  786.  
  787.    Wray                Document Expiration: 1 June 1997           [Page 12]
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  796.  
  797.  
  798.  
  799.                                       supplied
  800.     GSS_S_BAD_SIG              6      A token had an invalid
  801.                                       signature or MIC
  802.     GSS_S_NO_CRED              7      No credentials were supplied
  803.     GSS_S_NO_CONTEXT           8      No context has been
  804.                                       established
  805.     GSS_S_DEFECTIVE_TOKEN      9      A token was invalid
  806.     GSS_S_DEFECTIVE_CREDENTIAL 10     A credential was invalid
  807.     GSS_S_CREDENTIALS_EXPIRED  11     The referenced credentials
  808.                                       have expired
  809.     GSS_S_CONTEXT_EXPIRED      12     The context has expired
  810.     GSS_S_FAILURE              13     Miscellaneous failure
  811.                                       (see text)
  812.     GSS_S_BAD_QOP              14     The quality-of-protection
  813.                                       requested could not be
  814.                                       provide
  815.     GSS_S_UNAUTHORIZED         15     The operation is forbidden by
  816.                                       local security policy
  817.     GSS_S_UNAVAILABLE          16     The operation or option is not
  818.                                       available
  819.     GSS_S_DUPLICATE_ELEMENT    17     The requested credential element
  820.                                       already exists
  821.     GSS_S_NAME_NOT_MN          18     The provided name was not a
  822.                                       mechanism name.
  823.  
  824.  
  825.  
  826.  
  827.  
  828.    Table 5-3  Supplementary Status Bits
  829.  
  830.     Name                Bit Number         Meaning
  831.     GSS_S_CONTINUE_NEEDED   0 (LSB)  The routine must be called
  832.                                      again to complete its function.
  833.                                      See routine documentation for
  834.                                      detailed description.
  835.     GSS_S_DUPLICATE_TOKEN   1        The token was a duplicate of
  836.                                      an earlier token
  837.     GSS_S_OLD_TOKEN         2        The token's validity period
  838.                                      has expired
  839.     GSS_S_UNSEQ_TOKEN       3        A later token has already been
  840.                                      processed
  841.     GSS_S_GAP_TOKEN         4        An expected per-message token
  842.                                      was not received
  843.  
  844.  
  845.    The routine documentation also uses the name GSS_S_COMPLETE, which is a
  846.    zero value, to indicate an absence of any API errors or supplementary
  847.    information bits.
  848.  
  849.  
  850.  
  851.  
  852.  
  853.    Wray                Document Expiration: 1 June 1997           [Page 13]
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  862.  
  863.  
  864.  
  865.    All GSS_S_xxx symbols equate to complete OM_uint32 status codes, rather
  866.    than to bitfield values.  For example, the actual value of the symbol
  867.    GSS_S_BAD_NAMETYPE (value 3 in the routine error field) is 3 << 16.
  868.  
  869.    The macros GSS_CALLING_ERROR(), GSS_ROUTINE_ERROR() and
  870.    GSS_SUPPLEMENTARY_INFO() are provided, each of which takes a GSS status
  871.    code and removes all but the relevant field.  For example, the value
  872.    obtained by applying GSS_ROUTINE_ERROR to a status code removes the
  873.    calling errors and supplementary info fields, leaving only the routine
  874.    errors field.  The values delivered by these macros may be directly
  875.    compared with a GSS_S_xxx symbol of the appropriate type.  The macro
  876.    GSS_ERROR() is also provided, which when applied to a GSS status code
  877.    returns a non-zero value if the status code indicated a calling or
  878.    routine error, and a zero value otherwise.  All macros defined by GSS-
  879.    API evaluate their argument(s) exactly once.
  880.  
  881.    A GSS-API implementation may choose to signal calling errors in a
  882.    platform-specific manner instead of, or in addition to the routine
  883.    value;  routine errors and supplementary info should be returned via
  884.    routine status values only.
  885.  
  886.    5.9.2.  Mechanism-specific status codes
  887.  
  888.    GSS-API routines return a minor_status parameter, which is used to
  889.    indicate specialized errors from the underlying security mechanism.
  890.    This parameter may contain a single mechanism-specific error, indicated
  891.    by a OM_uint32 value.
  892.  
  893.    The minor_status parameter will always be set by a GSS-API routine, even
  894.    if it returns a calling error or one of the generic API errors indicated
  895.    above as fatal, although most other output parameters may remain unset
  896.    in such cases.  However, output parameters that are expected to return
  897.    pointers to storage allocated by a routine must always be set by the
  898.    routine, even in the event of an error, although in such cases the GSS-
  899.    API routine may elect to set the returned parameter value to NULL to
  900.    indicate that no storage was actually allocated.  Any length field
  901.    associated with such pointers (as in a gss_buffer_desc structure) should
  902.    also be set to zero in such cases.
  903.  
  904.    The GSS status code GSS_S_FAILURE is used to indicate that the
  905.    underlying mechanism detected an error for which no specific GSS status
  906.    code is defined.  The mechanism status code will provide more details
  907.    about the error.
  908.  
  909.    5.10.  Names
  910.  
  911.    A name is used to identify a person or entity.  GSS-API authenticates
  912.    the relationship between a name and the entity claiming the name.
  913.  
  914.    Since different authentication mechanisms may employ different
  915.    namespaces for identifying their principals, GSSAPI's naming support is
  916.  
  917.  
  918.  
  919.    Wray                Document Expiration: 1 June 1997           [Page 14]
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  928.  
  929.  
  930.  
  931.    necessarily complex in multi-mechanism environments (or even in some
  932.    single-mechanism environments where the underlying mechanism supports
  933.    multiple namespaces).
  934.  
  935.    Two distinct representations are defined for names:
  936.  
  937.      (a) An internal form.  This is the GSSAPI "native" format for names,
  938.          represented by the implementation-specific gss_name_t type.  It is
  939.          opaque to GSSAPI callers.  A single gss_name_t object may contain
  940.          multiple names from different namespaces, but all names should
  941.          refer to the same entity.  An example of such an internal name
  942.          would be the name returned from a call to the gss_inquire_cred
  943.          routine, when applied to a credential containing credential
  944.          elements for multiple authentication mechanisms employing
  945.          different namespaces.  This gss_name_t object will contain a
  946.          distinct name for the entity for each authentication mechanism.
  947.  
  948.          For GSSAPI implementations supporting multiple namespaces, objects
  949.          of type gss_name_t must contain sufficient information to
  950.          determine the namespace to which each primitive name belongs.
  951.  
  952.      (b) Mechanism-specific contiguous octet-string forms.  A format
  953.          capable of containing a single name (from a single namespace).
  954.          Contiguous string names are always accompanied by an object
  955.          identifier specifying the namespace to which the name belongs, and
  956.          their format is dependent on the authentication mechanism that
  957.          employs the name.  Many, but not all, contiguous string names will
  958.          be printable, and may therefore be used by GSSAPI applications for
  959.          communication with their users.
  960.  
  961.    Routines (gss_import_name and gss_display_name) are provided to convert
  962.    names between contiguous string representations and the internal
  963.    gss_name_t type.  gss_import_name may support multiple syntaxes for each
  964.    supported namespace, allowing users the freedom to choose a preferred
  965.    name representation.  gss_display_name should use an implementation-
  966.    chosen printable syntax for each supported name-type.
  967.  
  968.    If an application calls gss_display_name(), passing the internal name
  969.    resulting from a call to gss_import_name(), there is no guarantee the
  970.    the resulting contiguous string name will be the same as the original
  971.    imported string name.  Nor do name-space identifiers necessarily survive
  972.    unchanged after a journey through the internal name-form.  An example of
  973.    this might be a mechanism that authenticates X.500 names, but provides
  974.    an algorithmic mapping of Internet DNS names into X.500.  That
  975.    mechanism's implementation of gss_import_name() might, when presented
  976.    with a DNS name, generate an internal name that contained both the
  977.    original DNS name and the equivalent X.500 name. Alternatively, it might
  978.    only store the X.500 name.  In the latter case, gss_display_name() would
  979.    most likely generate a printable X.500 name, rather than the original
  980.    DNS name.
  981.  
  982.  
  983.  
  984.  
  985.    Wray                Document Expiration: 1 June 1997           [Page 15]
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  994.  
  995.  
  996.  
  997.    The process of authentication delivers to the context acceptor an
  998.    internal name.  Since this name has been authenticated by a single
  999.    mechanism, it contains only a single name (even if the internal name of
  1000.    the context initiator had multiple components).  Such names are termed
  1001.    internal mechanism names, or "MN"s and the names emitted by
  1002.    gss_accept_sec_context() are always of this type.  Since some
  1003.    applications may require MNs without wanting to incur the overhead of an
  1004.    authentication operation, a second function, gss_canonicalize_name(), is
  1005.    provided to convert a general internal name into an MN.
  1006.  
  1007.    Comparison of internal-form names may be accomplished via the
  1008.    gss_compare_name() routine, which returns true if the two names being
  1009.    compared refer to the same entity.  This removes the need for the
  1010.    application program to understand the syntaxes of the various printable
  1011.    names that a given GSS-API implementation may support.  Since GSSAPI
  1012.    assumes that all primitive names contained within a given internal name
  1013.    refer to the same entity, gss_compare_name() can return true if the two
  1014.    names have at least one primitive name in common.  If the implementation
  1015.    embodies knowledge of equivalence relationships between names taken from
  1016.    different namespaces, this knowledge may also allow successful
  1017.    comparison of internal names containing no overlapping primitive
  1018.    elements.
  1019.  
  1020.    When used in large access control lists, the overhead of invoking
  1021.    gss_import_name() and gss_compare_name() on each name from the ACL may
  1022.    be prohibitive.  To support this case, GSSAPI defines a special form of
  1023.    the contiguous string name which may be compared directly (e.g. with
  1024.    memcmp()).  Contigous names suitable for comparison are generated by the
  1025.    gss_export_name() routine, which requires an MN as input.  Exported
  1026.    names may be re-imported by the gss_import_name() routine, and the
  1027.    resulting internal name will also be an MN.  The gss_OID constant
  1028.    GSS_C_NT_EXPORT_NAME indentifies the "export name" type, and the value
  1029.    of this constant is given in Appendix A.     Structurally, an exported
  1030.    name object consists of a header containing an OID identifying the
  1031.    mechanism that authenticated the name, and a trailer containing the name
  1032.    itself, where the syntax of the trailer is defined by the individual
  1033.    mechanism specification.   The precise format of an export name is
  1034.    defined in the language-independent GSSAPI specification [GSSAPI].
  1035.  
  1036.    The gss_name_t datatype should be implemented as a pointer type.  To
  1037.    allow the compiler to aid the application programmer by performing
  1038.    type-checking, the use of (void *) is discouraged.  A pointer to an
  1039.    implementation-defined type is the preferred choice.
  1040.  
  1041.    Storage is allocated by routines that return gss_name_t values.  A
  1042.    procedure, gss_release_name, is provided to free storage associated with
  1043.    a name.
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.    Wray                Document Expiration: 1 June 1997           [Page 16]
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1060.  
  1061.  
  1062.  
  1063.    5.11.  Channel Bindings
  1064.  
  1065.    GSS-API supports the use of user-specified tags to identify a given
  1066.    context to the peer application.  These tags are intended to be used to
  1067.    identify the particular communications channel that carries the context.
  1068.    Channel bindings are communicated to the GSS-API using the following
  1069.    structure:
  1070.  
  1071.         typedef struct gss_channel_bindings_struct {
  1072.            OM_uint32       initiator_addrtype;
  1073.            gss_buffer_desc initiator_address;
  1074.            OM_uint32       acceptor_addrtype;
  1075.            gss_buffer_desc acceptor_address;
  1076.            gss_buffer_desc application_data;
  1077.         } *gss_channel_bindings_t;
  1078.  
  1079.    The initiator_addrtype and acceptor_addrtype fields denote the type of
  1080.    addresses contained in the initiator_address and acceptor_address
  1081.    buffers.  The address type should be one of the following:
  1082.  
  1083.         GSS_C_AF_UNSPEC      Unspecified address type
  1084.         GSS_C_AF_LOCAL       Host-local address type
  1085.         GSS_C_AF_INET        DARPA Internet address type
  1086.         GSS_C_AF_IMPLINK     ARPAnet IMP address type (eg IP)
  1087.         GSS_C_AF_PUP         pup protocols (eg BSP) address type
  1088.         GSS_C_AF_CHAOS       MIT CHAOS protocol address type
  1089.         GSS_C_AF_NS          XEROX NS address type
  1090.         GSS_C_AF_NBS         nbs address type
  1091.         GSS_C_AF_ECMA        ECMA address type
  1092.         GSS_C_AF_DATAKIT     datakit protocols address type
  1093.         GSS_C_AF_CCITT       CCITT protocols (eg X.25)
  1094.         GSS_C_AF_SNA         IBM SNA address type
  1095.         GSS_C_AF_DECnet      DECnet address type
  1096.         GSS_C_AF_DLI         Direct data link interface address type
  1097.         GSS_C_AF_LAT         LAT address type
  1098.         GSS_C_AF_HYLINK      NSC Hyperchannel address type
  1099.         GSS_C_AF_APPLETALK   AppleTalk address type
  1100.         GSS_C_AF_BSC         BISYNC 2780/3780 address type
  1101.         GSS_C_AF_DSS         Distributed system services address type
  1102.         GSS_C_AF_OSI         OSI TP4 address type
  1103.         GSS_C_AF_X25         X25
  1104.         GSS_C_AF_NULLADDR    No address specified
  1105.  
  1106.    Note that these symbols name address families rather than specific
  1107.    addressing formats.  For address families that contain several
  1108.    alternative address forms, the initiator_address and acceptor_address
  1109.    fields must contain sufficient information to determine which address
  1110.    form is used.  When not otherwise specified, addresses should be
  1111.    specified in network byte-order (that is, native byte-ordering for the
  1112.    address family).
  1113.  
  1114.  
  1115.  
  1116.  
  1117.    Wray                Document Expiration: 1 June 1997           [Page 17]
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1126.  
  1127.  
  1128.  
  1129.    Conceptually, the GSS-API concatenates the initiator_addrtype,
  1130.    initiator_address, acceptor_addrtype, acceptor_address and
  1131.    application_data to form an octet string.  The mechanism signs this
  1132.    octet string, and binds the signature to the context establishment token
  1133.    emitted by gss_init_sec_context.  The same bindings are presented by the
  1134.    context acceptor to gss_accept_sec_context, and a signature is
  1135.    calculated in the same way.  The calculated signature is compared with
  1136.    that found in the token, and if the signatures differ,
  1137.    gss_accept_sec_context will return a GSS_S_BAD_BINDINGS error, and the
  1138.    context will not be established.  Some mechanisms may include the actual
  1139.    channel binding data in the token (rather than just a signature);
  1140.    applications should therefore not use confidential data as channel-
  1141.    binding components.  Individual mechanisms may impose additional
  1142.    constraints on addresses and address types that may appear in channel
  1143.    bindings.  For example, a mechanism may verify that the
  1144.    initiator_address field of the channel bindings presented to
  1145.    gss_init_sec_context contains the correct network address of the host
  1146.    system.  Portable applications should therefore ensure that they either
  1147.    provide correct information for the address fields, or omit addressing
  1148.    information, specifying GSS_C_AF_NULLADDR as the address-types.
  1149.  
  1150.    5.12.  Optional parameters
  1151.  
  1152.    Various parameters are described as optional.  This means that they
  1153.    follow a convention whereby a default value may be requested.  The
  1154.    following conventions are used for omitted parameters.  These
  1155.    conventions apply only to those parameters that are explicitly
  1156.    documented as optional.
  1157.  
  1158.    5.12.1.  gss_buffer_t types
  1159.  
  1160.    Specify GSS_C_NO_BUFFER as a value.  For an input parameter this
  1161.    signifies that default behavior is requested, while for an output
  1162.    parameter it indicates that the information that would be returned via
  1163.    the parameter is not required by the application.
  1164.  
  1165.    5.12.2.  Integer types (input)
  1166.  
  1167.    Individual parameter documentation lists values to be used to indicate
  1168.    default actions.
  1169.  
  1170.    5.12.3.  Integer types (output)
  1171.  
  1172.    Specify NULL as the value for the pointer.
  1173.  
  1174.    5.12.4.  Pointer types
  1175.  
  1176.    Specify NULL as the value.
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.    Wray                Document Expiration: 1 June 1997           [Page 18]
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1192.  
  1193.  
  1194.  
  1195.    5.12.5.  Object IDs
  1196.  
  1197.    Specify GSS_C_NO_OID as the value.
  1198.  
  1199.    5.12.6.  Object ID Sets
  1200.  
  1201.    Specify GSS_C_NO_OID_SET as the value.
  1202.  
  1203.    5.12.7.  Channel Bindings
  1204.  
  1205.    Specify GSS_C_NO_CHANNEL_BINDINGS to indicate that channel bindings are
  1206.    not to be used.
  1207.  
  1208.  
  1209.    6. ADDITIONAL CONTROLS
  1210.  
  1211.    This section discusses the optional services that a context initiator
  1212.    may request of the GSS-API at context establishment.  All these services
  1213.    are requested by setting flags in the req_flags input parameter to
  1214.    gss_init_sec_context.
  1215.  
  1216.    The optional services currently defined are:
  1217.  
  1218.    Delegation - The (usually temporary) transfer of rights from initiator
  1219.          to acceptor, enabling the acceptor to authenticate itself as an
  1220.          agent of the initiator.
  1221.  
  1222.    Mutual Authentication - In addition to the initiator authenticating its
  1223.          identity to the context acceptor, the context acceptor should also
  1224.          authenticate itself to the initiator.
  1225.  
  1226.    Replay detection - In addition to providing message integrity services,
  1227.          gss_get_mic and gss_wrap should include message numbering
  1228.          information to enable gss_verify_mic and gss_unwrap to detect if a
  1229.          message has been duplicated.
  1230.  
  1231.    Out-of-sequence detection - In addition to providing message integrity
  1232.          services, gss_get_mic and gss_wrap should include message
  1233.          sequencing information to enable gss_verify_mic and gss_unwrap to
  1234.          detect if a message has been received out of sequence.
  1235.  
  1236.    Anonymous authentication - The establishment of the security context
  1237.          should not reveal the initiator's identity to the context
  1238.          acceptor.
  1239.  
  1240.    Any currently undefined bits within such flag arguments should be
  1241.    ignored by GSS-API implementations when presented by an application, and
  1242.    should be set to zero when returned to the application by the GSS-API
  1243.    implementation.
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.    Wray                Document Expiration: 1 June 1997           [Page 19]
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1258.  
  1259.  
  1260.  
  1261.    Some mechanisms may not support all optional services, and some
  1262.    mechanisms may only support some services in conjunction with others.
  1263.    Both gss_init_sec_context and gss_accept_sec_context inform the
  1264.    applications which services will be available from the context when the
  1265.    establishment phase is complete, via the ret_flags output parameter.  In
  1266.    general, if the security mechanism is capable of providing a requested
  1267.    service, it should do so, even if additional services must be enabled in
  1268.    order to provide the requested service.  If the mechanism is incapable
  1269.    of providing a requested service, it should proceed without the service,
  1270.    leaving the application to abort the context establishment process if it
  1271.    considers the requested service to be mandatory.
  1272.  
  1273.    Some mechanisms may specify that support for some services is optional,
  1274.    and that implementors of the mechanism need not provide it.  This is
  1275.    most commonly true of the confidentiality service, often because of
  1276.    legal restrictions on the use of data-encryption, but may apply to any
  1277.    of the services.  For such mechanisms, at least one token must be sent
  1278.    from acceptor to initiator during context establishment when the
  1279.    initiator indicates a desire to use such a service, so that the
  1280.    initiating GSSAPI can correctly indicate whether the service is
  1281.    supported by the acceptor's GSSAPI.
  1282.  
  1283.    6.1.  Delegation
  1284.  
  1285.    The GSS-API allows delegation to be controlled by the initiating
  1286.    application via a boolean parameter to gss_init_sec_context(), the
  1287.    routine that establishes a security context.  Some mechanisms do not
  1288.    support delegation, and for such mechanisms attempts by an application
  1289.    to enable delegation are ignored.
  1290.  
  1291.    For many mechanisms that support delegation, a simple boolean does not
  1292.    provide enough control.  Examples of additional aspects of delegation
  1293.    control that a mechanism might provide to an application are duration of
  1294.    delegation, network addresses from which delegation is valid, and
  1295.    constraints on the tasks performed by a delegate.  Such controls are
  1296.    presently outside the scope of the GSS-API.  GSS-API implementations
  1297.    supporting mechanisms offering additional controls should provide
  1298.    extension routines that allow these controls to be exercised (perhaps by
  1299.    modifying the initiator's GSS-API credential prior to its use in
  1300.    establishing a context).  However, the simple delegation control
  1301.    provided by GSS-API should always be able to over-ride other mechanism-
  1302.    specific delegation controls - If the application instructs
  1303.    gss_init_sec_context() that delegation is not desired, then the
  1304.    implementation must not permit delegation to occur.  This is an
  1305.    exception to the general rule that a mechanism may enable services even
  1306.    if they are not requested - delegation may only be provide at the
  1307.    explicit request of the application.
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.    Wray                Document Expiration: 1 June 1997           [Page 20]
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1324.  
  1325.  
  1326.  
  1327.    6.2.  Mutual authentication
  1328.  
  1329.    Usually, a context acceptor will require that a context initiator
  1330.    authenticate itself so that the acceptor may make an access-control
  1331.    decision prior to performing a service for the initiator.  In some
  1332.    cases, the initiator may also request that the acceptor authenticate
  1333.    itself.  GSS-API allows the initiating application to request this
  1334.    mutual authentication service by setting a flag when calling
  1335.    gss_init_sec_context.
  1336.  
  1337.    The initiating application is informed as to whether or not mutual
  1338.    authentication is being requested of the context acceptor.  Note that
  1339.    some mechanisms may not support mutual authentication, and other
  1340.    mechanisms may always perform mutual authentication, whether or not the
  1341.    initiating application requests it.  In particular, mutual
  1342.    authentication my be required by some mechanisms in order to support
  1343.    replay or out-of-sequence message detection, and for such mechanisms a
  1344.    request for either of these services will automatically enable mutual
  1345.    authentication.
  1346.  
  1347.    6.3.  Replay and out-of-sequence detection
  1348.  
  1349.    The GSS-API may provide detection of mis-ordered message once a security
  1350.    context has been established.  Protection may be applied to messages by
  1351.    either application, by calling either gss_get_mic or gss_wrap, and
  1352.    verified by the peer application by calling gss_verify_mic or
  1353.    gss_unwrap.
  1354.  
  1355.    gss_get_mic calculates a cryptographic checksum of an application
  1356.    message, and returns that checksum in a token.  The application should
  1357.    pass both the token and the message to the peer application, which
  1358.    presents them to gss_verify_mic.
  1359.  
  1360.    gss_wrap calculates a cryptographic checksum of an application message,
  1361.    and places both the checksum and the message in a token.  The
  1362.    application should pass the token to the peer application, which
  1363.    presents it to gss_unwrap to extract the message.
  1364.  
  1365.    Either pair of routines may be capable of detecting out-of-sequence
  1366.    message delivery, or duplication of messages. Details of such mis-
  1367.    ordered messages are indicated through supplementary status bits in the
  1368.    major status code returned by gss_verify_mic or gss_unwrap.  The
  1369.    relevant supplementary bits are:
  1370.  
  1371.    GSS_S_DUPLICATE_TOKEN - The token is a duplicate of one that has already
  1372.          been received and processed.  Contexts that do not claim to
  1373.          provide replay detection may still set this bit if the duplicate
  1374.          message is processed immediately after the original, with no
  1375.          intervening messages.
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.    Wray                Document Expiration: 1 June 1997           [Page 21]
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1390.  
  1391.  
  1392.  
  1393.    GSS_S_OLD_TOKEN - The token is too old to determine whether or not it is
  1394.          a duplicate.  Contexts supporting out-of-sequence detection but
  1395.          not replay detection should always set this bit if
  1396.          GSS_S_UNSEQ_TOKEN is set; contexts that support replay detection
  1397.          should only set this bit if the token is so old that it cannot be
  1398.          checked for duplication.
  1399.  
  1400.    GSS_S_UNSEQ_TOKEN - A later token has already been processed.
  1401.  
  1402.    GSS_S_GAP_TOKEN - An earlier token has not yet been received.
  1403.  
  1404.    A mechanism need not maintain a list of all tokens that have been
  1405.    processed in order to support these status codes.  A typical mechanism
  1406.    might retain information about only the most recent "N" tokens
  1407.    processed, allowing it to distinguish duplicates and missing tokens
  1408.    within the most recent "N" messages; the receipt of a token older than
  1409.    the most recent "N" would result in a GSS_S_OLD_TOKEN status.
  1410.  
  1411.    6.4.  Anonymous Authentication
  1412.  
  1413.    In certain situations, an application may wish to initiate the
  1414.    authentication process to authenticate a peer, without revealing its own
  1415.    identity.  For example, consider an application providing access to a
  1416.    database containing medical information, and offering unrestricted
  1417.    access to the service.  A client of such a service might wish to
  1418.    authenticate the service (in order to establish trust in any information
  1419.    retrieved from it), but might not wish the service to be able to obtain
  1420.    the client's identity (perhaps due to privacy concerns about the
  1421.    specific inquiries, or perhaps simply to avoid being placed on mailing-
  1422.    lists).
  1423.  
  1424.    In normal use of the GSS-API, the initiator's identity is made available
  1425.    to the acceptor as a result of the context establishment process.
  1426.    However, context initiators may request that their identity not be
  1427.    revealed to the context acceptor.  Many mechanisms do not support
  1428.    anonymous authentication, and for such mechanisms the request will be
  1429.    refused.  An authentication token will be still be generated, but the
  1430.    application is always informed if a requested service is unavailable,
  1431.    and has the option to abort context establishment if anonymity is valued
  1432.    above the other security services that would require a context to be
  1433.    established.
  1434.  
  1435.    In addition to informing the application that a context is established
  1436.    anonymously (via the ret_flags outputs from gss_init_sec_context and
  1437.    gss_accept_sec_context), the optional src_name output from
  1438.    gss_accept_sec_context and gss_inquire_context will, for such contexts,
  1439.    return a reserved internal-form name, defined by the implementation.
  1440.    When presented to gss_display_name, this reserved internal-form name
  1441.    will result in a printable name that is syntactically distinguishable
  1442.    from any valid principal name supported by the implementation,
  1443.    associated with a name-type object identifier with the value
  1444.  
  1445.  
  1446.  
  1447.    Wray                Document Expiration: 1 June 1997           [Page 22]
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1456.  
  1457.  
  1458.  
  1459.    GSS_C_NT_ANONYMOUS, whose value us given in Appendix A.  The printable
  1460.    form of an anonymous name should be chosen such that it implies
  1461.    anonymity, since this name may appear in, for example, audit logs.  For
  1462.    example, the string "<anonymous>" might be a good choice, if no valid
  1463.    printable names supported by the implementation can begin with "<" and
  1464.    end with ">".
  1465.  
  1466.    6.5.  Confidentiality
  1467.  
  1468.    If a context supports the confidentiality service, gss_wrap may be used
  1469.    to encrypt application messages.  Messages are selectively encrypted,
  1470.    under the control of the conf_req_flag input parameter to gss_wrap.
  1471.  
  1472.    6.6.  Inter-process context transfer
  1473.  
  1474.    GSSAPI V2 provides routines (gss_export_sec_context and
  1475.    gss_import_sec_context) which allow a security context to be transferred
  1476.    between processes on a single machine.  The most common use for such a
  1477.    feature is a client-server design where the server is implemented as a
  1478.    single process that accepts incoming security contexts, which then
  1479.    launches child processes to deal with the data on these contexts.  In
  1480.    such a design, the child processes must have access to the security
  1481.    context cdata structure created within the parent by its call to
  1482.    gss_accept_sec_context so that they can use per-message protection
  1483.    services and delete the security context when the communication session
  1484.    ends.
  1485.  
  1486.    Since the security context data structure is expected to contain
  1487.    sequencing information, it is impractical in general to share a context
  1488.    between processes.  Thus GSSAPI provides a call (gss_export_sec_context)
  1489.    that the process which currently owns the context can call to declare
  1490.    that it has no intention to use the context subsequently, and to create
  1491.    an inter-process token containing information needed by the adopting
  1492.    process to successfully import the context.  After successful completion
  1493.    of this call, the original security context is deleted by GSSAPI, and
  1494.    any context handles referring to this context are no longer valid.  The
  1495.    originating process transfers the inter-process token to the adopting
  1496.    process, which passes it to gss_import_sec_context, and a fresh
  1497.    gss_ctx_id_t is created such that it is functionally identical to the
  1498.    original context.
  1499.  
  1500.    The inter-process token may contain sensitive data from the original
  1501.    security context (including cryptographic keys).  Applications using
  1502.    inter-process tokens to transfer security contexts must take appropriate
  1503.    steps to protect these tokens in transit.
  1504.  
  1505.    Implementations are not required to support the inter-process transfer
  1506.    of security contexts.  The ability to transfer a security context is
  1507.    indicated when the context is created, by gss_init_sec_context or
  1508.    gss_accept_sec_context setting the GSS_C_TRANS_FLAG bit in their
  1509.    ret_flags parameter.
  1510.  
  1511.  
  1512.  
  1513.    Wray                Document Expiration: 1 June 1997           [Page 23]
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1522.  
  1523.  
  1524.  
  1525.    6.7.  The use of incomplete contexts
  1526.  
  1527.    Some mechanisms may allow the per-message services to be used before the
  1528.    context establishment process is complete.  For example, a mechanism may
  1529.    include sufficient information in its initial context-level token for
  1530.    the context acceptor to immediately decode messages protected with
  1531.    gss_wrap or gss_get_mic.  For such a mechanism, the initiating
  1532.    application need not wait until subsequent context-level tokens have
  1533.    been sent and received before invoking the per-message protection
  1534.    services.
  1535.  
  1536.    The ability of a context to provide per-message services in advance of
  1537.    complete context establishment is indicated by the setting of the
  1538.    GSS_C_PROT_READY_FLAG bit in the ret_flags parameter from
  1539.    gss_init_sec_context and gss_accept_sec_context.  Applications wishing
  1540.    to use per-message protection services on patially-established contexts
  1541.    should check this flag before attempting to invoke gss_wrap or
  1542.    gss_get_mic.
  1543.  
  1544.  
  1545.  
  1546.    7. GSS-API routine descriptions
  1547.  
  1548.    In addition to the explicit major status codes documented here, the code
  1549.    GSS_S_FAILURE may be returned by any routine, indicating an
  1550.    implementation-specific or mechanism-specific error condition, further
  1551.    details of which are reported via the minor_status parameter.
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.    7.1.  gss_accept_sec_context
  1560.  
  1561.    OM_uint32 gss_accept_sec_context (
  1562.         OM_uint32 *              minor_status,
  1563.         gss_ctx_id_t *           context_handle,
  1564.         GSS_CONST gss_cred_id_t  acceptor_cred_handle,
  1565.         GSS_CONST gss_buffer_t   input_token_buffer,
  1566.         GSS_CONST gss_channel_bindings_t
  1567.                                  input_chan_bindings,
  1568.         GSS_CONST gss_name_t *   src_name,
  1569.         gss_OID *                mech_type,
  1570.         gss_buffer_t             output_token,
  1571.         OM_uint32 *              ret_flags,
  1572.         OM_uint32 *              time_rec,
  1573.         gss_cred_id_t *          delegated_cred_handle)
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.    Wray                Document Expiration: 1 June 1997           [Page 24]
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1588.  
  1589.  
  1590.  
  1591.    Purpose:
  1592.  
  1593.    Allows a remotely initiated security context between the application and
  1594.    a remote peer to be established.  The routine may return a output_token
  1595.    which should be transferred to the peer application, where the peer
  1596.    application will present it to gss_init_sec_context.  If no token need
  1597.    be sent, gss_accept_sec_context will indicate this by setting the length
  1598.    field of the output_token argument to zero.  To complete the context
  1599.    establishment, one or more reply tokens may be required from the peer
  1600.    application; if so, gss_accept_sec_context  will return a status flag of
  1601.    GSS_S_CONTINUE_NEEDED, in which case it should be called again when the
  1602.    reply token is received from the peer application, passing the token to
  1603.    gss_accept_sec_context via the input_token parameters.
  1604.  
  1605.    Portable applications should be constructed to use the token length and
  1606.    return status to determine whether token need to be sent or waited for.
  1607.    Thus a typical portable caller should always invoke
  1608.    gss_accept_sec_context within a loop:
  1609.  
  1610.        gss_ctx_id_t context_hdl = GSS_C_NO_CONTEXT;
  1611.        ...
  1612.  
  1613.        do {
  1614.           receive_token_from_peer(input_token);
  1615.           maj_stat = gss_accept_sec_context(&min_stat,
  1616.                                             &context_hdl,
  1617.                                             cred_hdl,
  1618.                                             input_token,
  1619.                                             input_bindings,
  1620.                                             &client_name,
  1621.                                             &mech_type,
  1622.                                             output_token,
  1623.                                             &ret_flags,
  1624.                                             &time_rec,
  1625.                                             &deleg_cred);
  1626.           if (GSS_ERROR(maj_stat)) {
  1627.              report_error(maj_stat);
  1628.              break;
  1629.           };
  1630.           if (output_token->length != 0) {
  1631.              send_token_to_peer(output_token);
  1632.           };
  1633.        }
  1634.        while (GSS_SUPPLEMENTARY_INFO(maj_stat) & GSS_S_CONTINUE_NEEDED);
  1635.  
  1636.  
  1637.    Whenever the routine returns a major status that includes the value
  1638.    GSS_S_CONTINUE_NEEDED, the context is not fully established and the
  1639.    following restrictions apply to the output parameters:
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.    Wray                Document Expiration: 1 June 1997           [Page 25]
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1654.  
  1655.  
  1656.  
  1657.      (a) The value returned via the time_rec parameter is undefined
  1658.  
  1659.      (b) Unless the accompanying ret_flags parameter contains the bit
  1660.          GSS_C_PROT_READY_FLAG, indicating that per-message services may be
  1661.          applied in advance of a successful completion status, the value
  1662.          returned via the mech_type parameter may be undefined until the
  1663.          routine returns a major status value of GSS_S_COMPLETE.
  1664.  
  1665.      (c) The values of the GSS_C_DELEG_FLAG, GSS_C_MUTUAL_FLAG,
  1666.          GSS_C_REPLAY_FLAG, GSS_C_SEQUENCE_FLAG, GSS_C_CONF_FLAG,
  1667.          GSS_C_INTEG_FLAG and GSS_C_ANON_FLAG bits returned via the
  1668.          ret_flags parameter should contain the values that the
  1669.          implementation expects would be valid if context establishment
  1670.          were to succeed.
  1671.  
  1672.          The values of the GSS_C_PROT_READY_FLAG and GSS_C_TRANS_FLAG bits
  1673.          within ret_flags should indicate the actual state at the time
  1674.          gss_accept_sec_context returns, whether or not the context is
  1675.          fully established.
  1676.  
  1677.          Although this requires that GSSAPI implementations set the
  1678.          GSS_C_PROT_READY_FLAG in the final ret_flags returned to a caller
  1679.          (i.e. when accompanied by a GSS_S_COMPLETE status code),
  1680.          applications should not rely on this behavior as the flag was not
  1681.          defined in Version 1 of the GSSAPI. Instead, applications should
  1682.          be prepared to use per-message services after a successful context
  1683.          establishment, according to the GSS_C_INTEG_FLAG and
  1684.          GSS_C_CONF_FLAG values.
  1685.  
  1686.  
  1687.    While the routine returns GSS_S_CONTINUE_NEEDED, the values returned via
  1688.    the ret_flags argument indicate the services that the implementation
  1689.    expects to be available from the established context.
  1690.  
  1691.    Parameters:
  1692.  
  1693.    context_handle    gss_ctx_id_t, read/modify
  1694.                      context handle for new context.  Supply
  1695.                      GSS_C_NO_CONTEXT for first call; use value
  1696.                      returned in subsequent calls.
  1697.  
  1698.    acceptor_cred_handle  gss_cred_id_t, read
  1699.                      Credential handle claimed by context acceptor.
  1700.                      Specify GSS_C_NO_CREDENTIAL to accept the
  1701.                      context as a default principal.  If
  1702.                      GSS_C_NO_CREDENTIAL is specified, but no
  1703.                      default acceptor principal is defined,
  1704.                      GSS_S_NO_CRED will be returned.
  1705.  
  1706.    input_token_buffer  buffer, opaque, read
  1707.                      token obtained from remote application.
  1708.  
  1709.  
  1710.  
  1711.    Wray                Document Expiration: 1 June 1997           [Page 26]
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1720.  
  1721.  
  1722.  
  1723.    input_chan_bindings  channel bindings, read, optional
  1724.                      Application-specified bindings.  Allows
  1725.                      application to securely bind channel
  1726.                      identification information to the security
  1727.                      context.  If channel bindings are not
  1728.                      used, specify GSS_C_NO_CHANNEL_BINDINGS.
  1729.  
  1730.    src_name          gss_name_t, modify, optional
  1731.                      Authenticated name of context initiator.
  1732.                      After use, this name should be deallocated by
  1733.                      passing it to gss_release_name.  If not required,
  1734.                      specify NULL.
  1735.  
  1736.    mech_type         Object ID, modify, optional
  1737.                      Security mechanism used.  The returned
  1738.                      OID value will be a pointer into static
  1739.                      storage, and should be treated as read-only
  1740.                      by the caller.  If not required, specify
  1741.                      NULL.
  1742.  
  1743.    output_token      buffer, opaque, modify
  1744.                      Token to be passed to peer application. If the
  1745.                      length field of the returned token buffer is 0,
  1746.                      then no token need be passed to the peer
  1747.                      application.
  1748.  
  1749.    ret_flags         bit-mask, modify, optional
  1750.                      Contains various independent flags, each of
  1751.                      which indicates that the context supports a
  1752.                      specific service option.  If not needed,
  1753.                      specify NULL.  Symbolic names are
  1754.                      provided for each flag, and the symbolic names
  1755.                      corresponding to the required flags
  1756.                      should be logically-ANDed with the ret_flags
  1757.                      value to test whether a given option is
  1758.                      supported by the context.  The flags are:
  1759.                      GSS_C_DELEG_FLAG
  1760.                            True - Delegated credentials are available
  1761.                                   via the delegated_cred_handle
  1762.                                   parameter
  1763.                            False - No credentials were delegated
  1764.                      GSS_C_MUTUAL_FLAG
  1765.                            True - Remote peer asked for mutual
  1766.                                   authentication
  1767.                            False - Remote peer did not ask for mutual
  1768.                                    authentication
  1769.                      GSS_C_REPLAY_FLAG
  1770.                            True - replay of protected messages
  1771.                                   will be detected
  1772.                            False - replayed messages will not be
  1773.  
  1774.  
  1775.  
  1776.  
  1777.    Wray                Document Expiration: 1 June 1997           [Page 27]
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1786.  
  1787.  
  1788.  
  1789.                                    detected
  1790.                      GSS_C_SEQUENCE_FLAG
  1791.                            True - out-of-sequence protected
  1792.                                   messages will be detected
  1793.                            False - out-of-sequence messages will not
  1794.                                    be detected
  1795.                      GSS_C_CONF_FLAG
  1796.                            True - Confidentiality service may be invoked
  1797.                                   by calling the gss_wrap routine
  1798.                            False - No confidentiality service (via
  1799.                                    gss_wrap) available. gss_wrap will
  1800.                                    provide message encapsulation,
  1801.                                    data-origin authentication and
  1802.                                    integrity services only.
  1803.                      GSS_C_INTEG_FLAG
  1804.                            True - Integrity service may be invoked by
  1805.                                   calling either gss_get_mic or gss_wrap
  1806.                                   routines.
  1807.                            False - Per-message integrity service
  1808.                                    unavailable.
  1809.                      GSS_C_ANON_FLAG
  1810.                            True - The initiator does not wish to
  1811.                                   be authenticated; the src_name
  1812.                                   parameter (if requested) contains
  1813.                                   an anonymous internal name.
  1814.                            False - The initiator has been
  1815.                                    authenticated normally.
  1816.                      GSS_C_PROT_READY_FLAG
  1817.                            True - Protection services (as specified
  1818.                                   by the states of the GSS_C_CONF_FLAG
  1819.                                   and GSS_C_INTEG_FLAG) are available
  1820.                                   if the accompanying major status return
  1821.                                   value is either GSS_S_COMPLETE or
  1822.                                   GSS_S_CONTINUE_NEEDED.
  1823.                            False - Protection services (as specified
  1824.                                    by the states of the GSS_C_CONF_FLAG
  1825.                                    and GSS_C_INTEG_FLAG) are available
  1826.                                    only if the accompanying major status
  1827.                                    return value is GSS_S_COMPLETE.
  1828.                      GSS_C_TRANS_FLAG
  1829.                            True - The resultant security context may
  1830.                                   be transferred to other processes via
  1831.                                   a call to gss_export_sec_context().
  1832.                            False - The security context is not
  1833.                                    transferrable.
  1834.  
  1835.    time_rec          Integer, modify, optional
  1836.                      number of seconds for which the context
  1837.                      will remain valid. Specify NULL if not required.
  1838.  
  1839.    delegated_cred_handle
  1840.  
  1841.  
  1842.  
  1843.    Wray                Document Expiration: 1 June 1997           [Page 28]
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1852.  
  1853.  
  1854.  
  1855.    gss_cred_id_t, modify, optional
  1856.                      credential handle for credentials received from
  1857.                      context initiator.  Only valid if deleg_flag in
  1858.                      ret_flags is true.  If not needed, specify NULL.
  1859.  
  1860.    minor_status      Integer, modify
  1861.                      Mechanism specific status code.
  1862.  
  1863.  
  1864.    Function value:  GSS status code
  1865.  
  1866.    GSS_S_COMPLETE    Successful completion
  1867.  
  1868.    GSS_S_CONTINUE_NEEDED Indicates that a token from the peer application
  1869.                      is required to complete the context, and that
  1870.                      gss_accept_sec_context must be called again with that
  1871.                      token.
  1872.  
  1873.    GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks performed on the
  1874.                      input_token failed.
  1875.  
  1876.    GSS_S_DEFECTIVE_CREDENTIAL Indicates that consistency checks performed
  1877.                      on the credential failed.
  1878.  
  1879.    GSS_S_NO_CRED     The supplied credentials were not valid for context
  1880.                      acceptance, or the credential handle did not reference
  1881.                      any credentials.
  1882.  
  1883.    GSS_S_CREDENTIALS_EXPIRED The referenced credentials have expired.
  1884.  
  1885.    GSS_S_BAD_BINDINGS The input_token contains different channel bindings
  1886.                      to those specified via the input_chan_bindings
  1887.                      parameter.
  1888.  
  1889.    GSS_S_NO_CONTEXT  Indicates that the supplied context handle did not
  1890.                      refer to a valid context.
  1891.  
  1892.    GSS_S_BAD_SIG     The input_token contains an invalid signature.
  1893.  
  1894.    GSS_S_OLD_TOKEN   The input_token was too old.  This is a fatal error
  1895.                      during context establishment.
  1896.  
  1897.    GSS_S_DUPLICATE_TOKEN The input_token is valid, but is a duplicate of a
  1898.                      token already processed.  This is a fatal error during
  1899.                      context establishment.
  1900.  
  1901.    GSS_S_BAD_MECH    The received token specified a mechanism that is not
  1902.                      supported by the implementation or the provided
  1903.                      credential.
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.    Wray                Document Expiration: 1 June 1997           [Page 29]
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1918.  
  1919.  
  1920.  
  1921.    7.2.  gss_acquire_cred
  1922.  
  1923.  
  1924.    OM_uint32 gss_acquire_cred (
  1925.         OM_uint32 *              minor_status,
  1926.         GSS_CONST gss_name_t     desired_name,
  1927.         OM_uint32                time_req,
  1928.         GSS_CONST gss_OID_set    desired_mechs,
  1929.         gss_cred_usage_t         cred_usage,
  1930.         gss_cred_id_t *          output_cred_handle,
  1931.         gss_OID_set *            actual_mechs,
  1932.         OM_uint32 *              time_rec)
  1933.  
  1934.    Purpose:
  1935.  
  1936.    Allows an application to acquire a handle for a pre-existing credential
  1937.    by name.  GSS-API implementations must impose a local access-control
  1938.    policy on callers of this routine to prevent unauthorized callers from
  1939.    acquiring credentials to which they are not entitled.  This routine is
  1940.    not intended to provide a ``login to the network'' function, as such a
  1941.    function would involve the creation of new credentials rather than
  1942.    merely acquiring a handle to existing credentials.  Such functions, if
  1943.    required, should be defined in implementation-specific extensions to the
  1944.    API.
  1945.  
  1946.    If desired_name is GSS_C_NO_NAME, the call is interpreted as a request
  1947.    for a credential handle that will invoke default behavior when passed to
  1948.    gss_init_sec_context() (if cred_usage is GSS_C_INITIATE or GSS_C_BOTH)
  1949.    or gss_accept_sec_context() (if cred_usage is GSS_C_ACCEPT or
  1950.    GSS_C_BOTH).
  1951.  
  1952.    This routine is expected to be used primarily by context acceptors,
  1953.    since implementations are likely to provide mechanism-specific ways of
  1954.    obtaining GSS-API initiator credentials from the system login process.
  1955.    Some implementations may therefore not support the acquisition of
  1956.    GSS_C_INITIATE or GSS_C_BOTH credentials via gss_acquire_cred for any
  1957.    name other than an empty name.
  1958.  
  1959.    If credential acquisition is time-consuming for a mechanism, the
  1960.    mechanism may chooses to delay the actual acquisition until the
  1961.    credential is required (e.g. by gss_init_sec_context or
  1962.    gss_accept_sec_context).  Such mechanism-specific implementation
  1963.    decisions should be invisible to the calling application; thus a call of
  1964.    gss_inquire_cred immediately following the call of gss_acquire_cred must
  1965.    return valid credential data, and may therefore incur the overhead of a
  1966.    deferred credential acquisition.
  1967.  
  1968.    Parameters:
  1969.  
  1970.    desired_name      gss_name_t, read
  1971.                      Name of principal whose credential
  1972.  
  1973.  
  1974.  
  1975.    Wray                Document Expiration: 1 June 1997           [Page 30]
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  1984.  
  1985.  
  1986.  
  1987.                      should be acquired
  1988.  
  1989.    time_req          Integer, read, optional
  1990.                      number of seconds that credentials
  1991.                      should remain valid. Specify GSS_C_INDEFINITE
  1992.                      to request that the credentials have the maximum
  1993.                      permitted lifetime.
  1994.  
  1995.    desired_mechs     Set of Object IDs, read, optional
  1996.                      set of underlying security mechanisms that
  1997.                      may be used.  GSS_C_NO_OID_SET may be used
  1998.                      to obtain an implementation-specific default.
  1999.  
  2000.    cred_usage        gss_cred_usage_t, read
  2001.                      GSS_C_BOTH - Credentials may be used
  2002.                                   either to initiate or accept
  2003.                                   security contexts.
  2004.                      GSS_C_INITIATE - Credentials will only be
  2005.                                       used to initiate security
  2006.                                       contexts.
  2007.                      GSS_C_ACCEPT - Credentials will only be used to
  2008.                                     accept security contexts.
  2009.  
  2010.    output_cred_handle  gss_cred_id_t, modify
  2011.                      The returned credential handle.
  2012.  
  2013.    actual_mechs      Set of Object IDs, modify, optional
  2014.                      The set of mechanisms for which the
  2015.                      credential is valid.  Specify NULL
  2016.                      if not required.
  2017.  
  2018.    time_rec          Integer, modify, optional
  2019.                      Actual number of seconds for which the
  2020.                      returned credentials will remain valid.  If the
  2021.                      implementation does not support expiration of
  2022.                      credentials, the value GSS_C_INDEFINITE will
  2023.                      be returned. Specify NULL if not required
  2024.  
  2025.    minor_status      Integer, modify
  2026.                      Mechanism specific status code.
  2027.  
  2028.    Function value:  GSS status code
  2029.  
  2030.    GSS_S_COMPLETE    Successful completion
  2031.  
  2032.    GSS_S_BAD_MECH    Unavailable mechanism requested
  2033.  
  2034.    GSS_S_BAD_NAMETYPE Type contained within desired_name parameter is not
  2035.                      supported
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.    Wray                Document Expiration: 1 June 1997           [Page 31]
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2050.  
  2051.  
  2052.  
  2053.    GSS_S_BAD_NAME    Value supplied for desired_name parameter is ill-
  2054.                      formed.
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.    7.3.  gss_add_cred
  2063.  
  2064.  
  2065.    OM_uint32 gss_add_cred (
  2066.         OM_uint32 *              minor_status,
  2067.         GSS_CONST gss_cred_id_t  input_cred_handle,
  2068.         GSS_CONST gss_name_t     desired_name,
  2069.         GSS_CONST gss_OID        desired_mech,
  2070.         gss_cred_usage_t         cred_usage,
  2071.         OM_uint32                initiator_time_req,
  2072.         OM_uint32                acceptor_time_req,
  2073.         gss_cred_id_t *          output_cred_handle,
  2074.         gss_OID_set *            actual_mechs,
  2075.         OM_uint32 *              initiator_time_rec,
  2076.         OM_uint32 *              acceptor_time_rec)
  2077.  
  2078.    Purpose:
  2079.  
  2080.    Adds a credential-element to a credential.  The credential-element is
  2081.    identified by the name of the principal to which it refers.  GSSAPI
  2082.    implementations must impose a local access-control policy on callers of
  2083.    this routine to prevent unauthorized callers from acquiring credential-
  2084.    elements to which they are not entitled. This routine is not intended to
  2085.    provide a ``login to the network'' function, as such a function would
  2086.    involve the creation of new mechanism-specific authentication data,
  2087.    rather than merely acquiring a GSSAPI handle to existing data.  Such
  2088.    functions, if required, should be defined in implementation-specific
  2089.    extensions to the API.
  2090.  
  2091.    This routine is expected to be used primarily by context acceptors,
  2092.    since implementations are likely to provide mechanism-specific ways of
  2093.    obtaining GSS-API initiator credentials from the system login process.
  2094.    Some implementations may therefore not support the acquisition of
  2095.    GSS_C_INITIATE or GSS_C_BOTH credentials via gss_acquire_cred.
  2096.  
  2097.    If credential acquisition is time-consuming for a mechanism, the
  2098.    mechanism may chooses to delay the actual acquisition until the
  2099.    credential is required (e.g. by gss_init_sec_context or
  2100.    gss_accept_sec_context).  Such mechanism-specific implementation
  2101.    decisions should be invisible to the calling application; thus a call of
  2102.    gss_inquire_cred immediately following the call of gss_acquire_cred must
  2103.    return valid credential data, and may therefore incur the overhead of a
  2104.  
  2105.  
  2106.  
  2107.    Wray                Document Expiration: 1 June 1997           [Page 32]
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2116.  
  2117.  
  2118.  
  2119.    deferred credential acquisition.
  2120.  
  2121.    This routine can be used to either create a new credential containing
  2122.    all credential-elements of the original in addition to the newly-acquire
  2123.    credential-element, or to add the new credential-element to an existing
  2124.    credential. If NULL is specified for the output_cred_handle parameter
  2125.    argument, the new credential-element will be added to the credential
  2126.    identified by input_cred_handle; if a valid pointer is specified for the
  2127.    output_cred_handle parameter, a new credential and handle will be
  2128.    created.
  2129.  
  2130.    If GSS_C_NO_CREDENTIAL is specified as the input_cred_handle, the
  2131.    gss_add_cred will create its output_cred_handle based on default
  2132.    behavior.  That is, the call will have the same effect as if the
  2133.    application had first made a call to gss_acquire_cred(), specifying the
  2134.    same usage and passing GSS_C_NO_NAME as the desired_name parameter to
  2135.    obtain an explicit credential handle embodying default behavior, passed
  2136.    this credential handle to gss_add_cred(), and finally called
  2137.    gss_release_cred() on the first credential handle.
  2138.  
  2139.    If GSS_C_NO_CREDENTIAL is specified as the input_cred_handle parameter,
  2140.    a non-NULL output_cred_handle must be supplied.
  2141.  
  2142.    Parameters:
  2143.  
  2144.    minor_status      Integer, modify
  2145.                      Mechanism specific status code.
  2146.  
  2147.    input_cred_handle gss_cred_id_t, read or modify, optional
  2148.                      The credential to which a credential-element
  2149.                      will be added.  If GSS_C_NO_CREDENTIAL is
  2150.                      specified, the routine will create the new
  2151.                      credential based on default behavior (see
  2152.                      description above).
  2153.  
  2154.    desired_name      gss_name_t, read.
  2155.                      Name of principal whose credential
  2156.                      should be acquired.
  2157.  
  2158.    desired_mech      Object ID, read
  2159.                      Underlying security mechanism with which the
  2160.                      credential may be used.
  2161.  
  2162.    cred_usage        gss_cred_usage_t, read
  2163.                      GSS_C_BOTH - Credential may be used
  2164.                                   either to initiate or accept
  2165.                                   security contexts.
  2166.                      GSS_C_INITIATE - Credential will only be
  2167.                                       used to initiate security
  2168.                                       contexts.
  2169.                      GSS_C_ACCEPT - Credential will only be used to
  2170.  
  2171.  
  2172.  
  2173.    Wray                Document Expiration: 1 June 1997           [Page 33]
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2182.  
  2183.  
  2184.  
  2185.                      accept security contexts.
  2186.  
  2187.    initiator_time_req Integer, read, optional
  2188.                      number of seconds that the credential
  2189.                      should remain valid for initiating security
  2190.                      contexts.  This argument is ignored if the
  2191.                      created credentials are of type GSS_C_ACCEPT.
  2192.                      Specify GSS_C_INDEFINITE to request that the
  2193.                      credentials have the maximum permitted initiator
  2194.                      lifetime.
  2195.  
  2196.    acceptor_time_req Integer, read, optional
  2197.                      number of seconds that the credential
  2198.                      should remain valid for accepting security
  2199.                      contexts.  This argument is ignored if the
  2200.                      created credentials are of type GSS_C_INITIATE.
  2201.                      Specify GSS_C_INDEFINITE to request that the
  2202.                      credentials have the maximum permitted initiator
  2203.                      lifetime.
  2204.  
  2205.    output_cred_handle gss_cred_id_t, modify, optional
  2206.                      The returned credential handle, containing
  2207.                      the new credential-element and all the
  2208.                      credential-elements from input_cred_handle.
  2209.                      If a valid pointer to a gss_cred_id_t is
  2210.                      supplied for this parameter, gss_add_cred
  2211.                      creates a new credential handle containing all
  2212.                      credential-elements from the input_cred_handle
  2213.                      and the newly acquired credential-element; if
  2214.                      NULL is specified for this parameter, the newly
  2215.                      acquired credential-element will be added
  2216.                      to the credential identified by input_cred_handle.
  2217.  
  2218.    actual_mechs      Set of Object IDs, modify, optional
  2219.                      The complete set of mechanisms for which
  2220.                      the new credential is valid.  Specify NULL
  2221.                      if not required.
  2222.  
  2223.    initiator_time_rec Integer, modify, optional
  2224.                      Actual number of seconds for which the
  2225.                      returned credentials will remain valid for
  2226.                      initiating contexts using the specified
  2227.                      mechanism.  If the implementation or mechanism
  2228.                      does not support expiration of credentials, the
  2229.                      value GSS_C_INDEFINITE will be returned. Specify
  2230.                      NULL if not required
  2231.  
  2232.    acceptor_time_rec Integer, modify, optional
  2233.                      Actual number of seconds for which the
  2234.                      returned credentials will remain valid for
  2235.                      accepting security contexts using the specified
  2236.  
  2237.  
  2238.  
  2239.    Wray                Document Expiration: 1 June 1997           [Page 34]
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2248.  
  2249.  
  2250.  
  2251.                      mechanism.  If the implementation or mechanism
  2252.                      does not support expiration of credentials, the
  2253.                      value GSS_C_INDEFINITE will be returned. Specify
  2254.                      NULL if not required
  2255.  
  2256.    Function value:   GSS status code
  2257.  
  2258.    GSS_S_COMPLETE    Successful completion
  2259.  
  2260.    GSS_S_BAD_MECH    Unavailable mechanism requested
  2261.  
  2262.    GSS_S_BAD_NAMETYPE Type contained within desired_name parameter is not
  2263.                      supported
  2264.  
  2265.    GSS_S_BAD_NAME    Value supplied for desired_name parameter is ill-
  2266.                      formed.
  2267.  
  2268.    GSS_S_DUPLICATE_ELEMENT The credential already contains an element for
  2269.                      the requested mechanism with overlapping usage and
  2270.                      validity period.
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.    7.4.  gss_add_oid_set_member
  2279.  
  2280.    OM_uint32 gss_add_oid_set_member (
  2281.         OM_uint32  *             minor_status,
  2282.         GSS_CONST gss_OID        member_oid,
  2283.         gss_OID_set *            oid_set)
  2284.  
  2285.    Purpose:
  2286.  
  2287.    Add an Object Identifier to an Object Identifier set.  This routine is
  2288.    intended for use in conjunction with gss_create_empty_oid_set when
  2289.    constructing a set of mechanism OIDs for input to gss_acquire_cred.
  2290.  
  2291.    Parameters:
  2292.  
  2293.    minor_status      Integer, modify
  2294.                      Mechanism specific status code
  2295.  
  2296.    member_oid        Object ID, read
  2297.                      The object identifier to copied into
  2298.                      the set.
  2299.  
  2300.    oid_set           Set of Object ID, modify
  2301.                      The set in which the object identifier
  2302.  
  2303.  
  2304.  
  2305.    Wray                Document Expiration: 1 June 1997           [Page 35]
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2314.  
  2315.  
  2316.  
  2317.                      should be inserted.
  2318.  
  2319.    Function value:   GSS status code
  2320.  
  2321.    GSS_S_COMPLETE    Successful completion
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329.    7.5.  gss_canonicalize_name
  2330.  
  2331.    OM_uint32 gss_canonicalize_name (
  2332.         OM_uint32  *             minor_status,
  2333.         GSS_CONST gss_name_t     input_name,
  2334.         CONST gss_OID            mech_type,
  2335.         gss_name_t *             output_name)
  2336.  
  2337.    Purpose:
  2338.  
  2339.    Generate a canonical mechanism name (MN) from an arbitrary internal
  2340.    name.  The mechanism name is the name that would be returned to a
  2341.    context acceptor on successful authentication of a context where the
  2342.    initiator used the input_name in a successful call to gss_acquire_cred,
  2343.    specifying an OID set containing <mech_type> as its only member,
  2344.    followed by a call to gss_init_sec_context, specifying <mech_type> as
  2345.    the authentication mechanism.
  2346.  
  2347.    Parameters:
  2348.  
  2349.    minor_status      Integer, modify
  2350.                      Mechanism specific status code
  2351.  
  2352.    input_name        gss_name_t, read
  2353.                      The name for which a canonical form is
  2354.                      desired
  2355.  
  2356.    mech_type         Object ID, read
  2357.                      The authentication mechanism for which the
  2358.                      canonical form of the name is desired.  The
  2359.                      desired mechanism must be specified explicitly;
  2360.                      no default is provided.
  2361.  
  2362.    output_name       gss_name_t, modify
  2363.                      The resultant canonical name.
  2364.  
  2365.    Function value:   GSS status code
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.    Wray                Document Expiration: 1 June 1997           [Page 36]
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2380.  
  2381.  
  2382.  
  2383.    GSS_S_COMPLETE    Successful completion.
  2384.  
  2385.    GSS_S_BAD_MECH    The identified mechanism is not supported.
  2386.  
  2387.    GSS_S_BAD_NAMETYPE The provided internal name contains no elements that
  2388.                      could be processed by the sepcified mechanism.
  2389.  
  2390.    GSS_S_BAD_NAME    The provided internal name was ill-formed.
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.    7.6.  gss_compare_name
  2399.  
  2400.    OM_uint32 gss_compare_name (
  2401.         OM_uint32 *              minor_status,
  2402.         GSS_CONST gss_name_t     name1,
  2403.         GSS_CONST gss_name_t     name2,
  2404.         int *                    name_equal)
  2405.  
  2406.    Purpose:
  2407.  
  2408.    Allows an application to compare two internal-form names to determine
  2409.    whether they refer to the same entity.
  2410.  
  2411.    If either name presented to gss_compare_name denotes an anonymous
  2412.    principal, the routines should indicate that the two names do not refer
  2413.    to the same identity.
  2414.  
  2415.    Parameters:
  2416.  
  2417.    minor_status      Integer, modify
  2418.                      Mechanism specific status code.
  2419.  
  2420.    name1             gss_name_t, read
  2421.                      internal-form name
  2422.  
  2423.    name2             gss_name_t, read
  2424.                      internal-form name
  2425.  
  2426.    name_equal        boolean, modify
  2427.                      True - names refer to same entity
  2428.                      False - names refer to different entities
  2429.                              (strictly, the names are not known
  2430.                              to refer to the same identity).
  2431.  
  2432.    Function value:   GSS status code
  2433.  
  2434.  
  2435.  
  2436.  
  2437.    Wray                Document Expiration: 1 June 1997           [Page 37]
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2446.  
  2447.  
  2448.  
  2449.    GSS_S_COMPLETE    Successful completion
  2450.  
  2451.    GSS_S_BAD_NAMETYPE The two names were of incomparable types.
  2452.  
  2453.    GSS_S_BAD_NAME    One or both of name1 or name2 was ill-formed
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.    7.7.  gss_context_time
  2462.  
  2463.    OM_uint32 gss_context_time (
  2464.         OM_uint32 *              minor_status,
  2465.         GSS_CONST gss_ctx_id_t   context_handle,
  2466.         OM_uint32 *              time_rec)
  2467.  
  2468.    Purpose:
  2469.  
  2470.    Determines the number of seconds for which the specified context will
  2471.    remain valid.
  2472.  
  2473.    Parameters:
  2474.  
  2475.    minor_status      Integer, modify
  2476.                      Implementation specific status code.
  2477.  
  2478.    context_handle    gss_ctx_id_t, read
  2479.                      Identifies the context to be interrogated.
  2480.  
  2481.    time_rec          Integer, modify
  2482.                      Number of seconds that the context will remain
  2483.                      valid.  If the context has already expired,
  2484.                      zero will be returned.
  2485.  
  2486.    Function value:   GSS status code
  2487.  
  2488.    GSS_S_COMPLETE    Successful completion
  2489.  
  2490.    GSS_S_CONTEXT_EXPIRED The context has already expired
  2491.  
  2492.    GSS_S_NO_CONTEXT  The context_handle parameter did not identify a valid
  2493.                      context
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501.  
  2502.  
  2503.    Wray                Document Expiration: 1 June 1997           [Page 38]
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2512.  
  2513.  
  2514.  
  2515.    7.8.  gss_create_empty_oid_set
  2516.  
  2517.    OM_uint32 gss_create_empty_oid_set (
  2518.         OM_uint32  *             minor_status,
  2519.         gss_OID_set *            oid_set)
  2520.  
  2521.    Purpose:
  2522.  
  2523.    Create an object-identifier set containing no object identifiers, to
  2524.    which members may be subsequently added using the gss_add_oid_set_member
  2525.    routine.  These routines are intended to be used to construct sets of
  2526.    mechanism object identifiers, for input to gss_acquire_cred.
  2527.  
  2528.    Parameters:
  2529.  
  2530.    minor_status      Integer, modify
  2531.                      Mechanism specific status code
  2532.  
  2533.    oid_set           Set of Object IDs, modify
  2534.                      The empty object identifier set.
  2535.                      The routine will allocate the
  2536.                      gss_OID_set_desc object.
  2537.  
  2538.    Function value:   GSS status code
  2539.  
  2540.    GSS_S_COMPLETE    Successful completion
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.    7.9.  gss_delete_sec_context
  2549.  
  2550.    OM_uint32 gss_delete_sec_context (
  2551.        OM_uint32 *               minor_status,
  2552.        gss_ctx_id_t *            context_handle,
  2553.        gss_buffer_t              output_token)
  2554.  
  2555.    Purpose:
  2556.  
  2557.    Delete a security context.  gss_delete_sec_context will delete the local
  2558.    data structures associated with the specified security context, and may
  2559.    generate an output_token, which when passed to the peer
  2560.    gss_process_context_token will instruct it to do likewise.  If no token
  2561.    is required by the mechanism, the GSS-API should set the length field of
  2562.    the output_token (if provided) to zero.  No further security services
  2563.    may be obtained using the context specified by context_handle.
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.    Wray                Document Expiration: 1 June 1997           [Page 39]
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2578.  
  2579.  
  2580.  
  2581.    The output_token parameter is retained for compatibility with version 1
  2582.    of the GSS-API.  It is recommended that both peer applications invoke
  2583.    gss_delete_sec_context passing the value GSS_C_NO_BUFFER for the
  2584.    output_token parameter, indicating that no token is required, and that
  2585.    gss_delete_sec_context should simply delete local context data
  2586.    structures.  If the application does pass a valid buffer to
  2587.    gss_delete_sec_context, mechanisms are encouraged to return a zero-
  2588.    length token, indicating that no peer action is necessary, and that no
  2589.    token should be transferred by the application.
  2590.  
  2591.    Parameters:
  2592.  
  2593.    minor_status      Integer, modify
  2594.                      Mechanism specific status code.
  2595.  
  2596.    context_handle    gss_ctx_id_t, modify
  2597.                      context handle identifying context to delete.
  2598.  
  2599.    output_token      buffer, opaque, modify, optional
  2600.                      token to be sent to remote application to
  2601.                      instruct it to also delete the context.  It
  2602.                      is recommended that applications specify
  2603.                      GSS_C_NO_BUFFER for this parameter, requesting
  2604.                      local deletion only.
  2605.  
  2606.    Function value:   GSS status code
  2607.  
  2608.    GSS_S_COMPLETE    Successful completion
  2609.  
  2610.    GSS_S_NO_CONTEXT  No valid context was supplied
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.    7.10.  gss_display_name
  2619.  
  2620.    OM_uint32 gss_display_name (
  2621.         OM_uint32 *              minor_status,
  2622.         GSS_CONST gss_name_t     input_name,
  2623.         gss_buffer_t             output_name_buffer,
  2624.         gss_OID *                output_name_type)
  2625.  
  2626.    Purpose:
  2627.  
  2628.    Allows an application to obtain a textual representation of an opaque
  2629.    internal-form  name for display purposes.  The syntax of a printable
  2630.    name is defined by the GSS-API implementation.
  2631.  
  2632.  
  2633.  
  2634.  
  2635.    Wray                Document Expiration: 1 June 1997           [Page 40]
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2644.  
  2645.  
  2646.  
  2647.    If input_name denotes an anonymous principal, the implementation should
  2648.    return the gss_OID value GSS_C_NT_ANONYMOUS as the output_name_type, and
  2649.    a textual name that is syntactically distinct from all valid supported
  2650.    printable names in output_name_buffer.
  2651.  
  2652.    Parameters:
  2653.  
  2654.    minor_status      Integer, modify
  2655.                      Mechanism specific status code.
  2656.  
  2657.    input_name        gss_name_t, read
  2658.                      name to be displayed
  2659.  
  2660.    output_name_buffer  buffer, character-string, modify
  2661.                      buffer to receive textual name string
  2662.  
  2663.    output_name_type  Object ID, modify, optional
  2664.                      The type of the returned name.  The returned
  2665.                      gss_OID will be a pointer into static storage,
  2666.                      and should be treated as read-only by the caller.
  2667.                      Specify NULL if not required.
  2668.  
  2669.    Function value:   GSS status code
  2670.  
  2671.    GSS_S_COMPLETE    Successful completion
  2672.  
  2673.    GSS_S_BAD_NAME    input_name was ill-formed
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.    7.11.  gss_display_status
  2682.  
  2683.    OM_uint32 gss_display_status (
  2684.         OM_uint32 *              minor_status,
  2685.         OM_uint32                status_value,
  2686.         int                      status_type,
  2687.         GSS_CONST gss_OID        mech_type,
  2688.         OM_uint32 *              message_context,
  2689.         gss_buffer_t             status_string)
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.    Wray                Document Expiration: 1 June 1997           [Page 41]
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2710.  
  2711.  
  2712.  
  2713.    Purpose:
  2714.  
  2715.    Allows an application to obtain a textual representation of a GSS-API
  2716.    status code, for display to the user or for logging purposes.  Since
  2717.    some status values may indicate multiple errors, applications may need
  2718.    to call gss_display_status multiple times, each call generating a single
  2719.    text string.  The message_context parameter is used to indicate which
  2720.    error message should be extracted from a given status_value;
  2721.    message_context should be initialized to 0, and gss_display_status will
  2722.    return a non-zero value if there are further messages to extract.
  2723.  
  2724.    Parameters:
  2725.  
  2726.    minor_status      Integer, modify
  2727.                      Mechanism specific status code.
  2728.  
  2729.    status_value      Integer, read
  2730.                      Status value to be converted
  2731.  
  2732.    status_type       Integer, read
  2733.                      GSS_C_GSS_CODE - status_value is a GSS status
  2734.                                       code
  2735.                      GSS_C_MECH_CODE - status_value is a mechanism
  2736.                                        status code
  2737.  
  2738.    mech_type         Object ID, read, optional
  2739.                      Underlying mechanism (used to interpret a
  2740.                      minor status value) Supply GSS_C_NO_OID to
  2741.                      obtain the system default.
  2742.  
  2743.    message_context   Integer, read/modify
  2744.                      Should be initialized to zero by caller
  2745.                      on first call.  If further messages are
  2746.                      contained in the status_value parameter,
  2747.                      message_context will be non-zero on return,
  2748.                      and this value should be passed back to
  2749.                      subsequent calls, along with the same
  2750.                      status_value, status_type and mech_type
  2751.                      parameters.
  2752.  
  2753.    status_string     buffer, character string, modify
  2754.                      textual interpretation of the status_value
  2755.  
  2756.    Function value:   GSS status code
  2757.  
  2758.    GSS_S_COMPLETE    Successful completion
  2759.  
  2760.    GSS_S_BAD_MECH    Indicates that translation in accordance with an
  2761.                      unsupported mechanism type was requested
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.    Wray                Document Expiration: 1 June 1997           [Page 42]
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2776.  
  2777.  
  2778.  
  2779.    GSS_S_BAD_STATUS  The status value was not recognized, or the status
  2780.                      type was neither GSS_C_GSS_CODE nor GSS_C_MECH_CODE.
  2781.  
  2782.  
  2783.  
  2784.  
  2785.  
  2786.  
  2787.  
  2788.    7.12.  gss_duplicate_name
  2789.  
  2790.    OM_uint32 gss_duplicate_name (
  2791.         OM_uint32 *              minor_status,
  2792.         GSS_CONST gss_name_t     src_name,
  2793.         gss_name_t *             dest_name)
  2794.  
  2795.    Purpose:
  2796.  
  2797.    Create an exact duplicate of the existing internal name src_name.  The
  2798.    new dest_name will be independent of src_name (i.e. src_name and
  2799.    dest_name must both be released, and the release of one shall not affect
  2800.    the validity of the other).
  2801.  
  2802.    Parameters:
  2803.  
  2804.    minor_status      Integer, modify
  2805.                      Mechanism specific status code.
  2806.  
  2807.    src_name          gss_name_t, read
  2808.                      internal name to be duplicated.
  2809.  
  2810.    dest_name         gss_name_t, modify
  2811.                      The resultant copy of <src_name>.
  2812.  
  2813.    Function value:   GSS status code
  2814.  
  2815.    GSS_S_COMPLETE    Successful completion
  2816.  
  2817.    GSS_S_BAD_NAME    The src_name parameter was ill-formed.
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.    Wray                Document Expiration: 1 June 1997           [Page 43]
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2842.  
  2843.  
  2844.  
  2845.    7.13.  gss_export_name
  2846.  
  2847.    OM_uint32 gss_export_name (
  2848.         OM_uint32 *              minor_status,
  2849.         GSS_CONST gss_name_t     input_name,
  2850.         gss_buffer_t             exported_name)
  2851.  
  2852.    Purpose:
  2853.  
  2854.    To produce a canonical contiguous string representation of a mechanism
  2855.    name (MN), suitable for direct comparison (e.g. with memcmp) for use in
  2856.    authorization functions (e.g. matching entries in an access-control
  2857.    list).
  2858.  
  2859.    The <input_name> parameter must specify a valid MN (i.e. an internal
  2860.    name generated by gss_accept_sec_context or by gss_canonicalize_name).
  2861.  
  2862.  
  2863.    Parameters:
  2864.  
  2865.    minor_status      Integer, modify
  2866.                      Mechanism specific status code
  2867.  
  2868.    input_name        gss_name_t, read
  2869.                      The MN to be exported
  2870.  
  2871.    exported_name     gss_buffer_t, octet-string, modify
  2872.                      The canonical contiguous string form of
  2873.                      <input_name>
  2874.  
  2875.    Function value:   GSS status code
  2876.  
  2877.    GSS_S_COMPLETE    Successful completion
  2878.  
  2879.    GSS_S_NAME_NOT_MN The provided internal name was not a mechanism name.
  2880.  
  2881.    GSS_S_BAD_NAME    The provide internal name was ill-formed.
  2882.  
  2883.    GSS_S_BAD_NAMETYPE The internal name was of a type not supported by the
  2884.                      GSSAPI implementation.
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.    Wray                Document Expiration: 1 June 1997           [Page 44]
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2908.  
  2909.  
  2910.  
  2911.    7.14.  gss_export_sec_context
  2912.  
  2913.    OM_uint32 gss_export_sec_context (
  2914.         OM_uint32  *             minor_status,
  2915.         gss_ctx_id_t *           context_handle,
  2916.         gss_buffer_t             interprocess_token)
  2917.  
  2918.    Purpose:
  2919.  
  2920.    Provided to support the sharing of work between multiple processes.
  2921.    This routine will typically be used by the context-acceptor, in an
  2922.    application where a single process receives incoming connection requests
  2923.    and accepts security contexts over them, then passes the established
  2924.    context to one or more other processes for message exchange.
  2925.    gss_export_sec_context() deactivates the security context for the
  2926.    calling process and creates an interprocess token which, when passed to
  2927.    gss_import_sec_context in another process, will re-activate the context
  2928.    in the second process. Only a single instantiation of a given context
  2929.    may be active at any one time; a subsequent attempt by a context
  2930.    exporter to access the exported security context will fail.
  2931.  
  2932.    The implementation may constrain the set of processes by which the
  2933.    interprocess token may be imported, either as a function of local
  2934.    security policy, or as a result of implementation decisions.  For
  2935.    example, some implementations may constrain context to be passed only
  2936.    between processes that run under the same account, or which are part of
  2937.    the same process group.
  2938.  
  2939.    The interprocess token may contain security-sensitive information (for
  2940.    example cryptographic keys).  While mechanisms are encouraged to either
  2941.    avoid placing such sensitive information within interprocess tokens, or
  2942.    to encrypt the token before returning it to the application, in a
  2943.    typical object-library GSSAPI implementation this may not be possible.
  2944.    Thus the application must take care to protect the interprocess token,
  2945.    and ensure that any process to which the token is transferred is
  2946.    trustworthy.
  2947.  
  2948.    Parameters:
  2949.  
  2950.    minor_status      Integer, modify
  2951.                      Mechanism specific status code
  2952.  
  2953.    context_handle    gss_ctx_id_t, modify
  2954.                      context handle identifying the context to transfer.
  2955.  
  2956.    interprocess_token   buffer, opaque, modify
  2957.                         token to be transferred to target process.
  2958.  
  2959.    Function value:   GSS status code
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.    Wray                Document Expiration: 1 June 1997           [Page 45]
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  2974.  
  2975.  
  2976.  
  2977.    GSS_S_COMPLETE    Successful completion
  2978.  
  2979.    GSS_S_CONTEXT_EXPIRED The context has expired
  2980.  
  2981.    GSS_S_NO_CONTEXT  The context was invalid
  2982.  
  2983.    GSS_S_UNAVAILABLE The operation is not supported.
  2984.  
  2985.  
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.    7.15.  gss_get_mic
  2992.  
  2993.    OM_uint32 gss_get_mic (
  2994.         OM_uint32 *              minor_status,
  2995.         GSS_CONST gss_ctx_id_t   context_handle,
  2996.         gss_qop_t                qop_req,
  2997.         GSS_CONST gss_buffer_t   message_buffer,
  2998.         gss_buffer_t             msg_token)
  2999.  
  3000.    Purpose:
  3001.  
  3002.    Generates a cryptographic signature for the supplied message, and places
  3003.    the signature in a token for transfer to the peer application.  The
  3004.    qop_req parameter allows a choice between several cryptographic
  3005.    algorithms, if supported by the chosen mechanism.
  3006.  
  3007.    Parameters:
  3008.  
  3009.    minor_status      Integer, modify
  3010.                      Implementation specific status code.
  3011.  
  3012.    context_handle    gss_ctx_id_t, read
  3013.                      identifies the context on which the message
  3014.                      will be sent
  3015.  
  3016.    qop_req           gss_qop_t, read, optional
  3017.                      Specifies requested quality of protection.
  3018.                      Callers are encouraged, on portability grounds,
  3019.                      to accept the default quality of protection
  3020.                      offered by the chosen mechanism, which may be
  3021.                      requested by specifying GSS_C_QOP_DEFAULT for
  3022.                      this parameter.  If an unsupported protection
  3023.                      strength is requested, gss_get_mic will return a
  3024.                      major_status of GSS_S_BAD_QOP.
  3025.  
  3026.    message_buffer    buffer, opaque, read
  3027.                      message to be protected
  3028.  
  3029.  
  3030.  
  3031.    Wray                Document Expiration: 1 June 1997           [Page 46]
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3040.  
  3041.  
  3042.  
  3043.    msg_token         buffer, opaque, modify
  3044.                      buffer to receive token
  3045.  
  3046.    Function value:   GSS status code
  3047.  
  3048.    GSS_S_COMPLETE    Successful completion
  3049.  
  3050.    GSS_S_CONTEXT_EXPIRED The context has already expired
  3051.  
  3052.    GSS_S_NO_CONTEXT  The context_handle parameter did not identify a valid
  3053.                      context
  3054.  
  3055.    GSS_S_BAD_QOP     The specified QOP is not supported by the mechanism.
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.  
  3062.  
  3063.    7.16.  gss_import_name
  3064.  
  3065.    OM_uint32 gss_import_name (
  3066.         OM_uint32 *              minor_status,
  3067.         GSS_CONST gss_buffer_t   input_name_buffer,
  3068.         GSS_CONST gss_OID        input_name_type,
  3069.         gss_name_t *             output_name)
  3070.  
  3071.    Purpose:
  3072.  
  3073.    Convert a contiguous string name to internal form.  In general, the
  3074.    internal name returned (via the <output_name> parameter) will not be an
  3075.    MN; the exception to this is if the <input_name_type> indicates that the
  3076.    contiguous string provided via the <input_name_buffer> parameter is of
  3077.    type GSS_C_NT_EXPORT_NAME, in which case the returned internal name will
  3078.    be an MN for the mechanism that exported the name.
  3079.  
  3080.    Parameters:
  3081.  
  3082.    minor_status      Integer, modify
  3083.                      Mechanism specific status code
  3084.  
  3085.    input_name_buffer  buffer, octet-string, read
  3086.                      buffer containing contiguous string name to convert
  3087.  
  3088.    input_name_type   Object ID, read, optional
  3089.                      Object ID specifying type of printable
  3090.                      name.  Applications may specify either
  3091.                      GSS_C_NO_OID to use a local system-specific
  3092.                      printable syntax, or an OID registered by the
  3093.                      GSS-API implementation to name a particular
  3094.  
  3095.  
  3096.  
  3097.    Wray                Document Expiration: 1 June 1997           [Page 47]
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3106.  
  3107.  
  3108.  
  3109.                      namespace.
  3110.  
  3111.    output_name       gss_name_t, modify
  3112.                      returned name in internal form
  3113.  
  3114.    Function value:   GSS status code
  3115.  
  3116.    GSS_S_COMPLETE    Successful completion
  3117.  
  3118.    GSS_S_BAD_NAMETYPE The input_name_type was unrecognized
  3119.  
  3120.    GSS_S_BAD_NAME    The input_name parameter could not be interpreted as a
  3121.                      name of the specified type
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.    7.17.  gss_import_sec_context
  3131.  
  3132.    OM_uint32 gss_import_sec_context (
  3133.         OM_uint32  *             minor_status,
  3134.         GSS_CONST gss_buffer_t   interprocess_token
  3135.         gss_ctx_id_t *           context_handle)
  3136.  
  3137.    Purpose:
  3138.  
  3139.    Allows a process to import a security context established by another
  3140.    process.  See gss_export_sec_context.
  3141.  
  3142.    Parameters:
  3143.  
  3144.    minor_status      Integer, modify
  3145.                      Mechanism specific status code
  3146.  
  3147.    interprocess_token  buffer, opaque, modify
  3148.                      token received from exporting process
  3149.  
  3150.    context_handle    gss_ctx_id_t, modify
  3151.                      context handle of newly reactivated context.
  3152.  
  3153.  
  3154.    Function value:   GSS status code
  3155.  
  3156.    GSS_S_COMPLETE    Successful completion.
  3157.  
  3158.    GSS_S_NO_CONTEXT  The token did not contain a valid context reference.
  3159.  
  3160.  
  3161.  
  3162.  
  3163.    Wray                Document Expiration: 1 June 1997           [Page 48]
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3172.  
  3173.  
  3174.  
  3175.    GSS_S_DEFECTIVE_TOKEN The token was invalid.
  3176.  
  3177.    GSS_S_UNAVAILABLE The operation is unavailable.
  3178.  
  3179.    GSS_S_UNAUTHORIZED Local policy prevents the import of this context by
  3180.                      the current process..
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.    7.18.  gss_indicate_mechs
  3189.  
  3190.    OM_uint32 gss_indicate_mechs (
  3191.         OM_uint32 *              minor_status,
  3192.         gss_OID_set *            mech_set)
  3193.  
  3194.    Purpose:
  3195.  
  3196.    Allows an application to determine which underlying security mechanisms
  3197.    are available.
  3198.  
  3199.    Parameters:
  3200.  
  3201.    minor_status      Integer, modify
  3202.                      Mechanism specific status code.
  3203.  
  3204.    mech_set          set of Object IDs, modify
  3205.                      set of implementation-supported mechanisms.
  3206.                      The returned gss_OID_set value will be a
  3207.                      pointer into static storage, and should be
  3208.                      treated as read-only by the caller.
  3209.  
  3210.    Function value:   GSS status code
  3211.  
  3212.    GSS_S_COMPLETE    Successful completion
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.    Wray                Document Expiration: 1 June 1997           [Page 49]
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3238.  
  3239.  
  3240.  
  3241.    7.19.  gss_init_sec_context
  3242.  
  3243.    OM_uint32 gss_init_sec_context (
  3244.         OM_uint32 *              minor_status,
  3245.         GSS_CONST gss_cred_id_t  initiator_cred_handle,
  3246.         gss_ctx_id_t *           context_handle,
  3247.         GSS_CONST gss_name_t     target_name,
  3248.         GSS_CONST gss_OID        mech_type,
  3249.         OM_uint32                req_flags,
  3250.         OM_uint32                time_req,
  3251.         GSS_CONST gss_channel_bindings_t
  3252.                                  input_chan_bindings,
  3253.         GSS_CONST gss_buffer_t   input_token
  3254.         gss_OID *                actual_mech_type,
  3255.         gss_buffer_t             output_token,
  3256.         OM_uint32 *              ret_flags,
  3257.         OM_uint32 *              time_rec )
  3258.  
  3259.    Purpose:
  3260.  
  3261.    Initiates the establishment of a security context between the
  3262.    application and a remote peer.  Initially, the input_token parameter
  3263.    should be specified either as GSS_C_NO_BUFFER, or as a pointer to a
  3264.    gss_buffer_desc object whose length field contains the value zero.  The
  3265.    routine may return a output_token which should be transferred to the
  3266.    peer application, where the peer application will present it to
  3267.    gss_accept_sec_context.  If no token need be sent, gss_init_sec_context
  3268.    will indicate this by setting the length field of the output_token
  3269.    argument to zero.  To complete the context establishment, one or more
  3270.    reply tokens may be required from the peer application; if so,
  3271.    gss_init_sec_context will return a status containing the supplementary
  3272.    information bit GSS_S_CONTINUE_NEEDED.  In this case,
  3273.    gss_init_sec_context should be called again when the reply token is
  3274.    received from the peer application, passing the reply token to
  3275.    gss_init_sec_context via the input_token parameters.
  3276.  
  3277.    Portable applications should be constructed to use the token length and
  3278.    return status to determine whether token need to be sent or waited for.
  3279.    Thus a typical portable caller should always invoke gss_init_sec_context
  3280.    within a loop:
  3281.  
  3282.        int context_established = 0;
  3283.        gss_ctx_id_t context_hdl = GSS_C_NO_CONTEXT;
  3284.        ...
  3285.        input_token->length = 0;
  3286.  
  3287.        while (!context_established) {
  3288.           maj_stat = gss_init_sec_context(&min_stat,
  3289.                                           cred_hdl,
  3290.                                           &context_hdl,
  3291.                                           target_name,
  3292.  
  3293.  
  3294.  
  3295.    Wray                Document Expiration: 1 June 1997           [Page 50]
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3304.  
  3305.  
  3306.  
  3307.                                           desired_mech,
  3308.                                           desired_services,
  3309.                                           desired_time,
  3310.                                           input_bindings,
  3311.                                           input_token,
  3312.                                           &actual_mech,
  3313.                                           output_token,
  3314.                                           &actual_services,
  3315.                                           &actual_time);
  3316.           if (GSS_ERROR(maj_stat)) {
  3317.              report_error(maj_stat);
  3318.              break;
  3319.           };
  3320.           if (output_token->length != 0) {
  3321.              send_token_to_peer(output_token);
  3322.           };
  3323.           if (GSS_SUPPLEMENTARY_INFO(maj_stat) & GSS_S_CONTINUE_NEEDED) {
  3324.              receive_token_from_peer(input_token);
  3325.           } else {
  3326.              context_established = 1;
  3327.           };
  3328.        };
  3329.  
  3330.    Whenever the routine returns a major status that includes the value
  3331.    GSS_S_CONTINUE_NEEDED, the context is not fully established and the
  3332.    following restrictions apply to the output parameters:
  3333.  
  3334.      (a) The value returned via the time_rec parameter is undefined
  3335.  
  3336.      (b) Unless the accompanying ret_flags parameter contains the bit
  3337.          GSS_C_PROT_READY_FLAG, indicating that per-message services may be
  3338.          applied in advance of a successful completion status, the value
  3339.          returned via the actual_mech_type parameter is undefined until the
  3340.          routine returns a major status value of GSS_S_COMPLETE.
  3341.  
  3342.      (c) The values of the GSS_C_DELEG_FLAG, GSS_C_MUTUAL_FLAG,
  3343.          GSS_C_REPLAY_FLAG, GSS_C_SEQUENCE_FLAG, GSS_C_CONF_FLAG,
  3344.          GSS_C_INTEG_FLAG and GSS_C_ANON_FLAG bits returned via the
  3345.          ret_flags parameter should contain the values that the
  3346.          implementation expects would be valid if context establishment
  3347.          were to succeed.  In particular, if the application has requested
  3348.          a service such as delegation or anonymous authentication via the
  3349.          req_flags argument, and such a service is unavailable from the
  3350.          underlying mechanism, gss_init_sec_context should generate a token
  3351.          that will not provide the service, and indicate via the ret_flags
  3352.          argument that the service will not be supported.  The application
  3353.          may choose to abort the context establishment by calling
  3354.          gss_delete_sec_context (if it cannot continue in the absence of
  3355.          the service), or it may choose to transmit the token and continue
  3356.          context establishment (if the service was merely desired but not
  3357.          mandatory).
  3358.  
  3359.  
  3360.  
  3361.    Wray                Document Expiration: 1 June 1997           [Page 51]
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3370.  
  3371.  
  3372.  
  3373.          The values of the GSS_C_PROT_READY_FLAG and GSS_C_TRANS_FLAG bits
  3374.          within ret_flags should indicate the actual state at the time
  3375.          gss_init_sec_context returns, whether or not the context is fully
  3376.          established.
  3377.  
  3378.          Although this requires that GSSAPI implementations set the
  3379.          GSS_C_PROT_READY_FLAG in the final ret_flags returned to a caller
  3380.          (i.e. when accompanied by a GSS_S_COMPLETE status code),
  3381.          applications should not rely on this behavior as the flag was not
  3382.          defined in Version 1 of the GSSAPI. Instead, applications should
  3383.          be prepared to use per-message services after a successful context
  3384.          establishment, according to the GSS_C_INTEG_FLAG and
  3385.          GSS_C_CONF_FLAG values.
  3386.  
  3387.  
  3388.    Parameters:
  3389.  
  3390.    minor_status      Integer,  modify
  3391.                      Mechanism specific status code.
  3392.  
  3393.    initiator_cred_handle  gss_cred_id_t, read, optional
  3394.                      handle for credentials claimed.  Supply
  3395.                      GSS_C_NO_CREDENTIAL to act as a default
  3396.                      initiator principal.  If no default
  3397.                      initiator is defined, the function will
  3398.                      return GSS_S_NO_CRED.
  3399.  
  3400.    context_handle    gss_ctx_id_t, read/modify
  3401.                      context handle for new context.  Supply
  3402.                      GSS_C_NO_CONTEXT for first call; use value
  3403.                      returned by first call in continuation calls.
  3404.  
  3405.    target_name       gss_name_t, read
  3406.                      Name of target
  3407.  
  3408.    mech_type         OID, read, optional
  3409.                      Object ID of desired mechanism. Supply
  3410.                      GSS_C_NO_OID to obtain an implementation
  3411.                      specific default
  3412.  
  3413.    req_flags         bit-mask, read
  3414.                      Contains various independent flags, each of
  3415.                      which requests that the context support a
  3416.                      specific service option.  Symbolic
  3417.                      names are provided for each flag, and the
  3418.                      symbolic names corresponding to the required
  3419.                      flags should be logically-ORed
  3420.                      together to form the bit-mask value.  The
  3421.                      flags are:
  3422.  
  3423.                      GSS_C_DELEG_FLAG
  3424.  
  3425.  
  3426.  
  3427.    Wray                Document Expiration: 1 June 1997           [Page 52]
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3436.  
  3437.  
  3438.  
  3439.                            True - Delegate credentials to remote peer
  3440.                            False - Don't delegate
  3441.                      GSS_C_MUTUAL_FLAG
  3442.                            True - Request that remote peer
  3443.                                   authenticate itself
  3444.                            False - Authenticate self to remote peer
  3445.                                    only
  3446.                      GSS_C_REPLAY_FLAG
  3447.                            True - Enable replay detection for
  3448.                                   messages protected with gss_wrap
  3449.                                   or gss_get_mic
  3450.                            False - Don't attempt to detect
  3451.                                    replayed messages
  3452.                      GSS_C_SEQUENCE_FLAG
  3453.                            True - Enable detection of out-of-sequence
  3454.                                   protected messages
  3455.                            False - Don't attempt to detect
  3456.                                    out-of-sequence messages
  3457.                      GSS_C_ANON_FLAG
  3458.                            True - Do not reveal the initiator's
  3459.                                   identity to the acceptor.
  3460.                            False - Authenticate normally.
  3461.  
  3462.    time_req          Integer, read, optional
  3463.                      Desired number of seconds for which context
  3464.                      should remain valid.  Supply 0 to request a
  3465.                      default validity period.
  3466.  
  3467.    input_chan_bindings  channel bindings, read, optional
  3468.                      Application-specified bindings.  Allows
  3469.                      application to securely bind channel
  3470.                      identification information to the security
  3471.                      context.  Specify GSS_C_NO_CHANNEL_BINDINGS
  3472.                      if channel bindings are not used.
  3473.  
  3474.    input_token       buffer, opaque, read, optional (see text)
  3475.                      Token received from peer application.
  3476.                      Supply GSS_C_NO_BUFFER, or a pointer to
  3477.                      a buffer containing the value GSS_C_EMPTY_BUFFER
  3478.                      on initial call.
  3479.  
  3480.    actual_mech_type  OID, modify, optional
  3481.                      Actual mechanism used.  Specify NULL if
  3482.                      not required.
  3483.  
  3484.    output_token      buffer, opaque, modify
  3485.                      token to be sent to peer application.  If
  3486.                      the length field of the returned buffer is
  3487.                      zero, no token need be sent to the peer
  3488.                      application.
  3489.  
  3490.  
  3491.  
  3492.  
  3493.    Wray                Document Expiration: 1 June 1997           [Page 53]
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3502.  
  3503.  
  3504.  
  3505.    ret_flags         bit-mask, modify, optional
  3506.                      Contains various independent flags, each of which
  3507.                      indicates that the context supports a specific
  3508.                      service option.  Specify NULL if not
  3509.                      required.  Symbolic names are provided
  3510.                      for each flag, and the symbolic names
  3511.                      corresponding to the required flags should be
  3512.                      logically-ANDed with the ret_flags value to test
  3513.                      whether a given option is supported by the
  3514.                      context.  The flags are:
  3515.  
  3516.                      GSS_C_DELEG_FLAG
  3517.                            True - Credentials were delegated to
  3518.                                   the remote peer
  3519.                            False - No credentials were delegated
  3520.                      GSS_C_MUTUAL_FLAG
  3521.                            True - Remote peer has been asked to
  3522.                                   authenticated itself
  3523.                            False - Remote peer has not been asked to
  3524.                                    authenticate itself
  3525.                      GSS_C_REPLAY_FLAG
  3526.                            True - replay of protected messages
  3527.                                   will be detected
  3528.                            False - replayed messages will not be
  3529.                                    detected
  3530.                      GSS_C_SEQUENCE_FLAG
  3531.                            True - out-of-sequence protected
  3532.                                   messages will be detected
  3533.                            False - out-of-sequence messages will
  3534.                                    not be detected
  3535.                      GSS_C_CONF_FLAG
  3536.                            True - Confidentiality service may be
  3537.                                   invoked by calling gss_wrap routine
  3538.                            False - No confidentiality service (via
  3539.                                    gss_wrap) available. gss_wrap will
  3540.                                    provide message encapsulation,
  3541.                                    data-origin authentication and
  3542.                                    integrity services only.
  3543.                      GSS_C_INTEG_FLAG
  3544.                            True - Integrity service may be invoked by
  3545.                                   calling either gss_get_mic or gss_wrap
  3546.                                   routines.
  3547.                            False - Per-message integrity service
  3548.                                    unavailable.
  3549.                      GSS_C_ANON_FLAG
  3550.                            True - The initiator's identity has not been
  3551.                                   revealed, and will not be revealed if
  3552.                                   any emitted token is passed to the
  3553.                                   acceptor.
  3554.                            False - The initiator's identity has been or
  3555.                                    will be authenticated normally.
  3556.  
  3557.  
  3558.  
  3559.    Wray                Document Expiration: 1 June 1997           [Page 54]
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3568.  
  3569.  
  3570.  
  3571.                      GSS_C_PROT_READY_FLAG
  3572.                            True - Protection services (as specified
  3573.                                   by the states of the GSS_C_CONF_FLAG
  3574.                                   and GSS_C_INTEG_FLAG) are available for
  3575.                                   use if the accompanying major status
  3576.                                   return value is either GSS_S_COMPLETE or
  3577.                                   GSS_S_CONTINUE_NEEDED.
  3578.                            False - Protection services (as specified
  3579.                                    by the states of the GSS_C_CONF_FLAG
  3580.                                    and GSS_C_INTEG_FLAG) are available
  3581.                                    only if the accompanying major status
  3582.                                    return value is GSS_S_COMPLETE.
  3583.                      GSS_C_TRANS_FLAG
  3584.                            True - The resultant security context may
  3585.                                   be transferred to other processes via
  3586.                                   a call to gss_export_sec_context().
  3587.                            False - The security context is not
  3588.                                    transferrable.
  3589.  
  3590.    time_rec          Integer, modify, optional
  3591.                      number of seconds for which the context
  3592.                      will remain valid. If the implementation does
  3593.                      not support context expiration, the value
  3594.                      GSS_C_INDEFINITE will be returned.  Specify
  3595.                      NULL if not required.
  3596.  
  3597.    Function value:   GSS status code
  3598.  
  3599.    GSS_S_COMPLETE    Successful completion
  3600.  
  3601.    GSS_S_CONTINUE_NEEDED Indicates that a token from the peer application
  3602.                      is required to complete the context, and that
  3603.                      gss_init_sec_context must be called again with that
  3604.                      token.
  3605.  
  3606.    GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks performed on the
  3607.                      input_token failed
  3608.  
  3609.    GSS_S_DEFECTIVE_CREDENTIAL Indicates that consistency checks performed
  3610.                      on the credential failed.
  3611.  
  3612.    GSS_S_NO_CRED     The supplied credentials were not valid for context
  3613.                      initiation, or the credential handle did not reference
  3614.                      any credentials.
  3615.  
  3616.    GSS_S_CREDENTIALS_EXPIRED The referenced credentials have expired
  3617.  
  3618.    GSS_S_BAD_BINDINGS The input_token contains different channel bindings
  3619.                      to those specified via the input_chan_bindings
  3620.                      parameter
  3621.  
  3622.  
  3623.  
  3624.  
  3625.    Wray                Document Expiration: 1 June 1997           [Page 55]
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3634.  
  3635.  
  3636.  
  3637.    GSS_S_BAD_SIG     The input_token contains an invalid signature, or a
  3638.                      signature that could not be verified
  3639.  
  3640.    GSS_S_OLD_TOKEN   The input_token was too old.  This is a fatal error
  3641.                      during context establishment
  3642.  
  3643.    GSS_S_DUPLICATE_TOKEN The input_token is valid, but is a duplicate of a
  3644.                      token already processed.  This is a fatal error during
  3645.                      context establishment.
  3646.  
  3647.    GSS_S_NO_CONTEXT  Indicates that the supplied context handle did not
  3648.                      refer to a valid context
  3649.  
  3650.    GSS_S_BAD_NAMETYPE The provided target_name parameter contained an
  3651.                      invalid or unsupported type of name
  3652.  
  3653.    GSS_S_BAD_NAME    The provided target_name parameter was ill-formed.
  3654.  
  3655.    GSS_S_BAD_MECH    The specified mechanism is not supported by the
  3656.                      provided credential, or is unrecognized by the
  3657.                      implementation.
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.  
  3664.  
  3665.    7.20.  gss_inquire_context
  3666.  
  3667.    OM_uint32 gss_inquire_context (
  3668.         OM_uint32 *              minor_status,
  3669.         GSS_CONST gss_ctx_id_t   context_handle,
  3670.         gss_name_t *             src_name,
  3671.         gss_name_t *             targ_name,
  3672.         OM_uint32 *              lifetime_rec,
  3673.         gss_OID *                mech_type,
  3674.         OM_uint32 *              ctx_flags,
  3675.         int *                    locally_initiated,
  3676.         int *                    open )
  3677.  
  3678.    Purpose:
  3679.  
  3680.    Obtains information about a security context.  The caller must already
  3681.    have obtained a handle that refers to the context, although the context
  3682.    need not be fully established.
  3683.  
  3684.    Parameters:
  3685.  
  3686.    minor_status      Integer, modify
  3687.                      Mechanism specific status code
  3688.  
  3689.  
  3690.  
  3691.    Wray                Document Expiration: 1 June 1997           [Page 56]
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3700.  
  3701.  
  3702.  
  3703.    context_handle    gss_ctx_id_t, read
  3704.                      A handle that refers to the security context.
  3705.  
  3706.    src_name          gss_name_t, modify, optional
  3707.                      The name of the context initiator.
  3708.                      If the context was established using anonymous
  3709.                      authentication, and if the application invoking
  3710.                      gss_inquire_context is the context acceptor,
  3711.                      an anonymous name will be returned.
  3712.                      Specify NULL if not required.
  3713.  
  3714.    targ_name         gss_name_t, modify, optional
  3715.                      The name of the context acceptor.
  3716.                      Specify NULL if not required.
  3717.  
  3718.    lifetime_rec      Integer, modify, optional
  3719.                      The number of seconds for which the context
  3720.                      will remain valid.  If the context has
  3721.                      expired, this parameter will be set to zero.
  3722.                      If the implementation does not support
  3723.                      context expiration, the value
  3724.                      GSS_C_INDEFINITE will be returned.  Specify
  3725.                      NULL if not required.
  3726.  
  3727.    mech_type         gss_OID, modify, optional
  3728.                      The security mechanism providing the
  3729.                      context.
  3730.                      Specify NULL if not required.
  3731.  
  3732.    ctx_flags         bit-mask, modify, optional
  3733.                      Contains various independent flags, each of
  3734.                      which indicates that the context supports
  3735.                      (or is expected to support, if ctx_open is
  3736.                      false) a specific service option.  If not
  3737.                      needed, specify NULL.  Symbolic names are
  3738.                      provided for each flag, and the symbolic names
  3739.                      corresponding to the required flags
  3740.                      should be logically-ANDed with the ret_flags
  3741.                      value to test whether a given option is
  3742.                      supported by the context.  The flags are:
  3743.  
  3744.                      GSS_C_DELEG_FLAG
  3745.                            True - Credentials were delegated from
  3746.                                   the initiator to the acceptor.
  3747.                            False - No credentials were delegated
  3748.                      GSS_C_MUTUAL_FLAG
  3749.                            True - The acceptor was authenticated
  3750.                                   to the initiator
  3751.                            False - The acceptor did not authenticate
  3752.                                    itself.
  3753.                      GSS_C_REPLAY_FLAG
  3754.  
  3755.  
  3756.  
  3757.    Wray                Document Expiration: 1 June 1997           [Page 57]
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3766.  
  3767.  
  3768.  
  3769.                            True - replay of protected messages
  3770.                                   will be detected
  3771.                            False - replayed messages will not be
  3772.                                    detected
  3773.                      GSS_C_SEQUENCE_FLAG
  3774.                            True - out-of-sequence protected
  3775.                                   messages will be detected
  3776.                            False - out-of-sequence messages will not
  3777.                                    be detected
  3778.                      GSS_C_CONF_FLAG
  3779.                            True - Confidentiality service may be invoked
  3780.                                   by calling gss_wrap routine
  3781.                            False - No confidentiality service (via
  3782.                                    gss_wrap) available. gss_wrap will
  3783.                                    provide message encapsulation,
  3784.                                    data-origin authentication and
  3785.                                    integrity services only.
  3786.                      GSS_C_INTEG_FLAG
  3787.                            True - Integrity service may be invoked by
  3788.                                   calling either gss_get_mic or gss_wrap
  3789.                                   routines.
  3790.                            False - Per-message integrity service
  3791.                                    unavailable.
  3792.                      GSS_C_ANON_FLAG
  3793.                            True - The initiator's identity will not
  3794.                                   be revealed to the acceptor.
  3795.                                   The src_name parameter (if
  3796.                                   requested) contains an anonymous
  3797.                                   internal name.
  3798.                            False - The initiator has been
  3799.                                    authenticated normally.
  3800.                      GSS_C_PROT_READY_FLAG
  3801.                            True - Protection services (as specified
  3802.                                   by the states of the GSS_C_CONF_FLAG
  3803.                                   and GSS_C_INTEG_FLAG) are available
  3804.                                   for use.
  3805.                            False - Protection services (as specified
  3806.                                    by the states of the GSS_C_CONF_FLAG
  3807.                                    and GSS_C_INTEG_FLAG) are available
  3808.                                    only if the context is fully
  3809.                                    established (i.e. if the open parameter
  3810.                                    is non-zero).
  3811.                      GSS_C_TRANS_FLAG
  3812.                            True - The resultant security context may
  3813.                                   be transferred to other processes via
  3814.                                   a call to gss_export_sec_context().
  3815.                            False - The security context is not
  3816.                                    transferrable.
  3817.  
  3818.  
  3819.    locally_initiated Boolean, modify
  3820.  
  3821.  
  3822.  
  3823.    Wray                Document Expiration: 1 June 1997           [Page 58]
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830.  
  3831.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3832.  
  3833.  
  3834.  
  3835.                      True if the invoking application is the
  3836.                      context initiator.
  3837.                      Specify NULL if not required.
  3838.  
  3839.    open              Boolean, modify
  3840.                      True if the context is fully established;
  3841.                      false if a context-establishment token
  3842.                      is expected from the peer application.
  3843.                      Specify NULL if not required.
  3844.  
  3845.    Function value:   GSS status code
  3846.  
  3847.    GSS_S_COMPLETE    Successful completion
  3848.  
  3849.    GSS_S_NO_CONTEXT  The referenced context could not be accessed.
  3850.  
  3851.    GSS_S_CONTEXT_EXPIRED The context has expired.  If the lifetime_rec
  3852.                      parameter was requested, it will be set to 0.
  3853.  
  3854.  
  3855.  
  3856.  
  3857.  
  3858.  
  3859.  
  3860.    7.21.  gss_inquire_cred
  3861.  
  3862.    OM_uint32 gss_inquire_cred (
  3863.         OM_uint32  *             minor_status,
  3864.         GSS_CONST gss_cred_id_t  cred_handle,
  3865.         gss_name_t *             name,
  3866.         OM_uint32 *              lifetime,
  3867.         gss_cred_usage_t *       cred_usage,
  3868.         gss_OID_set *            mechanisms )
  3869.  
  3870.    Purpose:
  3871.  
  3872.    Obtains information about a credential.  The caller must already have
  3873.    obtained a handle that refers to the credential.
  3874.  
  3875.    Parameters:
  3876.  
  3877.    minor_status      Integer, modify
  3878.                      Mechanism specific status code
  3879.  
  3880.    cred_handle       gss_cred_id_t, read
  3881.                      A handle that refers to the target credential.
  3882.                      Specify GSS_C_NO_CREDENTIAL to inquire about
  3883.                      the default initiator principal.
  3884.  
  3885.    name              gss_name_t, modify, optional
  3886.  
  3887.  
  3888.  
  3889.    Wray                Document Expiration: 1 June 1997           [Page 59]
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3898.  
  3899.  
  3900.  
  3901.                      The name whose identity the credential asserts.
  3902.                      Specify NULL if not required.
  3903.  
  3904.    lifetime          Integer, modify, optional
  3905.                      The number of seconds for which the credential
  3906.                      will remain valid.  If the credential has
  3907.                      expired, this parameter will be set to zero.
  3908.                      If the implementation does not support
  3909.                      credential expiration, the value
  3910.                      GSS_C_INDEFINITE will be returned.  Specify
  3911.                      NULL if not required.
  3912.  
  3913.    cred_usage        gss_cred_usage_t, modify, optional
  3914.                      How the credential may be used.  One of the
  3915.                      following:
  3916.                         GSS_C_INITIATE
  3917.                         GSS_C_ACCEPT
  3918.                         GSS_C_BOTH
  3919.                      Specify NULL if not required.
  3920.  
  3921.    mechanisms        gss_OID_set, modify, optional
  3922.                      Set of mechanisms supported by the credential.
  3923.                      Specify NULL if not required.
  3924.  
  3925.    Function value:   GSS status code
  3926.  
  3927.    GSS_S_COMPLETE    Successful completion
  3928.  
  3929.    GSS_S_NO_CRED     The referenced credentials could not be accessed.
  3930.  
  3931.    GSS_S_DEFECTIVE_CREDENTIAL The referenced credentials were invalid.
  3932.  
  3933.    GSS_S_CREDENTIALS_EXPIRED The referenced credentials have expired.  If
  3934.                      the lifetime parameter was not passed as NULL, it will
  3935.                      be set to 0.
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.    7.22.  gss_inquire_cred_by_mech
  3944.  
  3945.    OM_uint32 gss_inquire_cred_by_mech (
  3946.         OM_uint32 *              minor_status,
  3947.         GSS_CONST gss_cred_id_t  cred_handle,
  3948.         GSS_CONST gss_OID        mech_type,
  3949.         gss_name_t *             name,
  3950.         OM_uint32 *              initiator_lifetime,
  3951.         OM_uint32 *              acceptor_lifetime,
  3952.  
  3953.  
  3954.  
  3955.    Wray                Document Expiration: 1 June 1997           [Page 60]
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.  
  3962.  
  3963.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  3964.  
  3965.  
  3966.  
  3967.          gss_cred_usage_t *       cred_usage )
  3968.  
  3969.    Purpose:
  3970.  
  3971.    Obtains per-mechanism information about a credential.  The caller must
  3972.    already have obtained a handle that refers to the credential.
  3973.  
  3974.    Parameters:
  3975.  
  3976.    minor_status      Integer, modify
  3977.                      Mechanism specific status code
  3978.  
  3979.    cred_handle       gss_cred_id_t, read
  3980.                      A handle that refers to the target credential.
  3981.                      Specify GSS_C_NO_CREDENTIAL to inquire about
  3982.                      the default initiator principal.
  3983.  
  3984.    mech_type         gss_OID, read
  3985.                      The mechanism for which information should be
  3986.                      returned.
  3987.  
  3988.    name              gss_name_t, modify, optional
  3989.                      The name whose identity the credential asserts.
  3990.                      Specify NULL if not required.
  3991.  
  3992.    initiator_lifetime  Integer, modify, optional
  3993.                      The number of seconds for which the credential
  3994.                      will remain capable of initiating security contexts
  3995.                      under the specified mechanism.  If the credential
  3996.                      can no longer be used to initiate contexts, or if
  3997.                      the credential usage for this mechanism is
  3998.    GSS_C_ACCEPT,
  3999.                      this parameter will be set to zero.  If the
  4000.                      implementation does not support expiration of
  4001.                      initiator credentials, the value GSS_C_INDEFINITE
  4002.                      will be returned.  Specify NULL if not required.
  4003.  
  4004.    acceptor_lifetime Integer, modify, optional
  4005.                      The number of seconds for which the credential
  4006.                      will remain capable of accepting security contexts
  4007.                      under the specified mechanism.  If the credential
  4008.                      can no longer be used to accept contexts, or if
  4009.                      the credential usage for this mechanism is
  4010.                      GSS_C_INITIATE, this parameter will be set to zero.
  4011.                      If the implementation does not support expiration
  4012.                      of acceptor credentials, the value GSS_C_INDEFINITE
  4013.                      will be returned.  Specify NULL if not required.
  4014.  
  4015.    cred_usage        gss_cred_usage_t, modify, optional
  4016.                      How the credential may be used with the specified
  4017.                      mechanism.  One of the following:
  4018.  
  4019.  
  4020.  
  4021.    Wray                Document Expiration: 1 June 1997           [Page 61]
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.  
  4028.  
  4029.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4030.  
  4031.  
  4032.  
  4033.                         GSS_C_INITIATE
  4034.                         GSS_C_ACCEPT
  4035.                         GSS_C_BOTH
  4036.                      Specify NULL if not required.
  4037.  
  4038.    Function value:   GSS status code
  4039.  
  4040.    GSS_S_COMPLETE    Successful completion
  4041.  
  4042.    GSS_S_NO_CRED     The referenced credentials could not be accessed.
  4043.  
  4044.    GSS_S_DEFECTIVE_CREDENTIAL The referenced credentials were invalid.
  4045.  
  4046.    GSS_S_CREDENTIALS_EXPIRED The referenced credentials have expired.  If
  4047.                      the lifetime parameter was not passed as NULL, it will
  4048.                      be set to 0.
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.    7.23.  gss_inquire_mechs_for_name
  4057.  
  4058.    OM_uint32 gss_inquire_mechs_for_name (
  4059.         OM_uint32 *              minor_status,
  4060.         GSS_CONST gss_name_t     input_name,
  4061.         gss_OID_set *            mech_types )
  4062.  
  4063.    Purpose:
  4064.  
  4065.    Returns the set of mechanisms supported by the GSSAPI implementation
  4066.    that may be able to process the specified name.
  4067.  
  4068.    Each mechanism returned will recognize at least one element within the
  4069.    name.  It is permissible for this routine to be implemented within a
  4070.    mechanism-independent GSSAPI layer, using the type information contained
  4071.    within the presented name, and based on registration information
  4072.    provided by individual mechanism implementations.  This means that the
  4073.    returned mech_types set may indicate that a particular mechanism will
  4074.    understand the name when in fact it would refuse to accept the name as
  4075.    input to gss_canonicalize_name, gss_init_sec_context, gss_acquire_cred
  4076.    or gss_add_cred (due to some property of the specific name, as opposed
  4077.    to the name type).  Thus this routine should be used only as a pre-
  4078.    filter for a call to a subsequent mechanism-specific routine.
  4079.  
  4080.  
  4081.  
  4082.    Parameters:
  4083.  
  4084.  
  4085.  
  4086.  
  4087.    Wray                Document Expiration: 1 June 1997           [Page 62]
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4096.  
  4097.  
  4098.  
  4099.    minor_status      Integer, modify
  4100.                      Implementation specific status code.
  4101.  
  4102.    input_name        gss_name_t, read
  4103.                      The name to which the inquiry relates.
  4104.  
  4105.    mech_types        gss_OID_set, modify
  4106.                      Set of mechanisms that may support the
  4107.                      specified name.  The returned OID set
  4108.                      must be freed by the caller by a call
  4109.                      to gss_release_oid_set().
  4110.  
  4111.    Function value:   GSS status code
  4112.  
  4113.    GSS_S_COMPLETE    Successful completion
  4114.  
  4115.    GSS_S_BAD_NAME    The input_name parameter was ill-formed.
  4116.  
  4117.    GSS_S_BAD_NAMETYPE The input_name parameter contained an invalid or
  4118.                      unsupported type of name
  4119.  
  4120.  
  4121.  
  4122.  
  4123.  
  4124.  
  4125.    7.24.  gss_inquire_names_for_mech
  4126.  
  4127.    OM_uint32 gss_inquire_names_for_mech (
  4128.         OM_uint32 *              minor_status,
  4129.         GSS_CONST gss_OID        mechanism,
  4130.         gss_OID_set *            name_types)
  4131.  
  4132.    Purpose:
  4133.  
  4134.    Returns the set of nametypes supported by the specified mechanism.
  4135.  
  4136.  
  4137.  
  4138.    Parameters:
  4139.  
  4140.    minor_status      Integer, modify
  4141.                      Implementation specific status code.
  4142.  
  4143.    mechanism         gss_OID, read
  4144.                      The mechanism to be interrogated.
  4145.  
  4146.    name_types        gss_OID_set, modify
  4147.                      Set of name-types supported by the
  4148.                      specified mechanism.
  4149.  
  4150.  
  4151.  
  4152.  
  4153.    Wray                Document Expiration: 1 June 1997           [Page 63]
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4162.  
  4163.  
  4164.  
  4165.    Function value:   GSS status code
  4166.  
  4167.    GSS_S_COMPLETE    Successful completion
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173.  
  4174.  
  4175.    7.25.  gss_oid_to_str
  4176.  
  4177.    OM_uint32 gss_oid_to_str (
  4178.         OM_uint32 *              minor_status,
  4179.         GSS_CONST gss_OID        oid,
  4180.         gss_buffer_t             oid_str)
  4181.  
  4182.    Purpose:
  4183.  
  4184.    Converts an object identifier value into its printable ASN.1
  4185.    representation.  For example, when passed the OID value
  4186.    GSS_C_NT_ANONYMOUS, the routine might deliver a buffer object containing
  4187.    the string "{1 3 6 1 5 6 3}".
  4188.  
  4189.    If the provided gss_OID value does not contain a validly encoded OID,
  4190.    the buffer pointedf to by oid_str will contain an empty buffer on
  4191.    return.
  4192.  
  4193.    Parameters:
  4194.  
  4195.    minor_status      Integer, modify
  4196.                      Implementation specific status code.
  4197.  
  4198.    oid               gss_OID, read
  4199.                      The OID to be translated.
  4200.  
  4201.    oid_str           buffer, character string, modify
  4202.                      textual interpretation of the OID
  4203.  
  4204.    Function value:   GSS status code
  4205.  
  4206.    GSS_S_COMPLETE    Successful completion
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.    Wray                Document Expiration: 1 June 1997           [Page 64]
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4228.  
  4229.  
  4230.  
  4231.    7.26.  gss_process_context_token
  4232.  
  4233.    OM_uint32 gss_process_context_token (
  4234.         OM_uint32 *              minor_status,
  4235.         GSS_CONST gss_ctx_id_t   context_handle,
  4236.         GSS_CONST gss_buffer_t   token_buffer)
  4237.  
  4238.    Purpose:
  4239.  
  4240.    Provides a way to pass a token to the security service.  Used with
  4241.    tokens emitted by gss_delete_sec_context.  Note that mechanisms are
  4242.    encouraged to perform local deletion, and not emit tokens from
  4243.    gss_delete_sec_context.  This routine, therefore, is primarily for
  4244.    backwards compatibility with V1 applications.
  4245.  
  4246.    Parameters:
  4247.  
  4248.    minor_status      Integer, modify
  4249.                      Implementation specific status code.
  4250.  
  4251.    context_handle    gss_ctx_id_t, read
  4252.                      context handle of context on which token is to
  4253.                      be processed
  4254.  
  4255.    token_buffer      buffer, opaque, read
  4256.                      token to process
  4257.  
  4258.    Function value:   GSS status code
  4259.  
  4260.    GSS_S_COMPLETE    Successful completion
  4261.  
  4262.    GSS_S_DEFECTIVE_TOKEN Indicates that consistency checks performed on the
  4263.                      token failed
  4264.  
  4265.    GSS_S_NO_CONTEXT  The context_handle did not refer to a valid context
  4266.  
  4267.  
  4268.  
  4269.  
  4270.  
  4271.  
  4272.  
  4273.    7.27.  gss_release_buffer
  4274.  
  4275.    OM_uint32 gss_release_buffer (
  4276.         OM_uint32 *              minor_status,
  4277.         gss_buffer_t             buffer)
  4278.  
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.    Wray                Document Expiration: 1 June 1997           [Page 65]
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.  
  4292.  
  4293.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4294.  
  4295.  
  4296.  
  4297.    Purpose:
  4298.  
  4299.    Free storage associated with a buffer.  The storage must have been
  4300.    allocated by a GSS-API routine.  In addition to freeing the associated
  4301.    storage, the routine will zero the length field in the descriptor to
  4302.    which the buffer parameter refers.
  4303.  
  4304.    Parameters:
  4305.  
  4306.    minor_status      Integer, modify
  4307.                      Mechanism specific status code
  4308.  
  4309.    buffer            buffer, modify
  4310.                      The storage associated with the buffer will be
  4311.                      deleted.  The gss_buffer_desc object will not
  4312.                      be freed, but its length field will be zeroed.
  4313.  
  4314.    Function value:   GSS status code
  4315.  
  4316.    GSS_S_COMPLETE    Successful completion
  4317.  
  4318.  
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  4324.    7.28.  gss_release_cred
  4325.  
  4326.    OM_uint32 gss_release_cred (
  4327.         OM_uint32 *              minor_status,
  4328.         gss_cred_id_t *          cred_handle)
  4329.  
  4330.    Purpose:
  4331.  
  4332.    Informs GSS-API that the specified credential handle is no longer
  4333.    required by the process.  When all processes have released a credential,
  4334.    it will be deleted.
  4335.  
  4336.    Parameters:
  4337.  
  4338.    cred_handle       gss_cred_id_t, modify, optional
  4339.                      Buffer containing opaque credential
  4340.                      handle.  If GSS_C_NO_CREDENTIAL is supplied,
  4341.                      the routine will complete successfully, but
  4342.                      will do nothing.
  4343.  
  4344.    minor_status      Integer, modify
  4345.                      Mechanism specific status code.
  4346.  
  4347.    Function value:   GSS status code
  4348.  
  4349.  
  4350.  
  4351.    Wray                Document Expiration: 1 June 1997           [Page 66]
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4360.  
  4361.  
  4362.  
  4363.    GSS_S_COMPLETE    Successful completion
  4364.  
  4365.    GSS_S_NO_CRED     Credentials could not be accessed.
  4366.  
  4367.  
  4368.  
  4369.  
  4370.  
  4371.  
  4372.  
  4373.    7.29.  gss_release_name
  4374.  
  4375.    OM_uint32 gss_release_name (
  4376.         OM_uint32 *              minor_status,
  4377.         gss_name_t *             name)
  4378.  
  4379.    Purpose:
  4380.  
  4381.    Free GSSAPI-allocated storage by associated with an internal form name.
  4382.  
  4383.    Parameters:
  4384.  
  4385.    minor_status      Integer, modify
  4386.                      Mechanism specific status code
  4387.  
  4388.    name              gss_name_t, modify
  4389.                      The name to be deleted
  4390.  
  4391.    Function value:   GSS status code
  4392.  
  4393.    GSS_S_COMPLETE    Successful completion
  4394.  
  4395.    GSS_S_BAD_NAME    The name parameter did not contain a valid name
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.    7.30.  gss_release_oid
  4404.  
  4405.    OM_uint32 gss_release_oid (
  4406.         OM_uint32 *              minor_status,
  4407.         gss_OID *                oid)
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.    Wray                Document Expiration: 1 June 1997           [Page 67]
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4426.  
  4427.  
  4428.  
  4429.    Purpose:
  4430.  
  4431.    Discard an OID.  This routine is provided for completeness only.  While
  4432.    some of the GSS-API routines return OIDs, these routines are currently
  4433.    documented as returning pointers to structures maintained in static
  4434.    storage.  gss_release_oid will recognize any of the GSSAPI's own OID
  4435.    values, and will silently ignore attempts to free these OIDs; for other
  4436.    OIDs it will call the C free() routine for both the OID data and the
  4437.    descriptor.  This allows applications to freely mix their own heap-
  4438.    allocated OID values with OIDs returned by GSS-API.
  4439.  
  4440.    Parameters:
  4441.  
  4442.    minor_status      Integer, modify
  4443.                      Mechanism specific status code
  4444.  
  4445.    oid               Object ID, modify
  4446.                      The object identifier to be freed.
  4447.  
  4448.    Function value:   GSS status code
  4449.  
  4450.    GSS_S_COMPLETE    Successful completion
  4451.  
  4452.  
  4453.  
  4454.  
  4455.  
  4456.  
  4457.  
  4458.    7.31.  gss_release_oid_set
  4459.  
  4460.    OM_uint32 gss_release_oid_set (
  4461.         OM_uint32 *              minor_status,
  4462.         gss_OID_set *            set)
  4463.  
  4464.    Purpose:
  4465.  
  4466.    Free storage associated with a gss_OID_set object. Like
  4467.    gss_release_oid(), gss_release_oid_set() will recognize any static
  4468.    gss_OID_set objects that the GSSAPI implementation defines, and will
  4469.    silently ignore attempts to free these sets.  For other OID sets, this
  4470.    routine is functionally equivalent to invoking gss_release_oid() on each
  4471.    element within the OID set, followed by calling the C free() routine on
  4472.    the gss_OID_set_desc set descriptor.
  4473.  
  4474.    Parameters:
  4475.  
  4476.    minor_status      Integer, modify
  4477.                      Mechanism specific status code
  4478.  
  4479.    set               Set of Object IDs, modify
  4480.  
  4481.  
  4482.  
  4483.    Wray                Document Expiration: 1 June 1997           [Page 68]
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4492.  
  4493.  
  4494.  
  4495.                      The storage associated with the gss_OID_set
  4496.                      will be deleted.
  4497.  
  4498.    Function value:   GSS status code
  4499.  
  4500.    GSS_S_COMPLETE    Successful completion
  4501.  
  4502.  
  4503.  
  4504.  
  4505.  
  4506.  
  4507.  
  4508.    7.32.  gss_str_to_oid
  4509.  
  4510.    OM_uint32 gss_str_to_oid (
  4511.         OM_uint32 *              minor_status,
  4512.         GSS_CONST gss_buffer_t   oid_str,
  4513.         gss_OID *                oid)
  4514.  
  4515.    Purpose:
  4516.  
  4517.    Converts an ASN.1 representation of an object identifier into a gss_OID
  4518.    value.  For example, when passed the string "{1 3 6 1 5 6 3}", the
  4519.    routine would deliver an object identifier whose value is the same as
  4520.    that of GSS_C_NT_ANONYMOUS.
  4521.  
  4522.    Note that full support of ASN.1 object identifier value syntax is not
  4523.    required.  At a minimum, strings of the form "{n1 n2 n3 ...}" (where
  4524.    n1,n2,n3 etc. are integers) should be supported, and it is permissible
  4525.    to impose reasonable platform-specific limits on the magnitude of
  4526.    individual components (for example, all components must be less than
  4527.    LONG_MAX).  The implementation must support conversion between gss_OID
  4528.    values and strings for all object identifier values that the
  4529.    implementation defines, and all string representations generated by
  4530.    gss_oid_to_str must also be supported as inputs to gss_str_to_oid.
  4531.  
  4532.    Parameters:
  4533.  
  4534.    minor_status      Integer, modify
  4535.                      Implementation specific status code.
  4536.  
  4537.    oid_str           buffer, character string, read
  4538.                      textual interpretation of the OID
  4539.  
  4540.    oid               gss_OID, modify
  4541.                      The returned OID value
  4542.  
  4543.  
  4544.    Function value:   GSS status code
  4545.  
  4546.  
  4547.  
  4548.  
  4549.    Wray                Document Expiration: 1 June 1997           [Page 69]
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4558.  
  4559.  
  4560.  
  4561.    GSS_S_COMPLETE    Successful completion
  4562.  
  4563.  
  4564.  
  4565.  
  4566.  
  4567.  
  4568.  
  4569.    7.33.  gss_test_oid_set_member
  4570.  
  4571.    OM_uint32 gss_test_oid_set_member (
  4572.         OM_uint32  *             minor_status,
  4573.         GSS_CONST gss_OID        member,
  4574.         GSS_CONST gss_OID_set    set,
  4575.         int *                    present)
  4576.  
  4577.    Purpose:
  4578.  
  4579.    Interrogate an Object Identifier set to determine whether a specified
  4580.    Object Identifier is a member.  This routine is intended to be used with
  4581.    OID sets returned by gss_indicate_mechs, gss_acquire_cred, and
  4582.    gss_inquire_cred, but will also work with user-generated sets.
  4583.  
  4584.    Parameters:
  4585.  
  4586.    minor_status      Integer, modify
  4587.                      Mechanism specific status code
  4588.  
  4589.    member            Object ID, read
  4590.                      The object identifier whose presence
  4591.                      is to be tested.
  4592.  
  4593.    set               Set of Object ID, read
  4594.                      The Object Identifier set.
  4595.  
  4596.    present           Boolean, modify
  4597.                      True if the specified OID is a member
  4598.                      of the set, false if not.
  4599.  
  4600.    Function value:   GSS status code
  4601.  
  4602.    GSS_S_COMPLETE    Successful completion
  4603.  
  4604.  
  4605.  
  4606.  
  4607.  
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.  
  4614.  
  4615.    Wray                Document Expiration: 1 June 1997           [Page 70]
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4624.  
  4625.  
  4626.  
  4627.    7.34.  gss_unwrap
  4628.  
  4629.    OM_uint32 gss_unwrap (
  4630.         OM_uint32 *              minor_status,
  4631.         GSS_CONST gss_ctx_id_t   context_handle,
  4632.         GSS_CONST gss_buffer_t   input_message_buffer,
  4633.         gss_buffer_t             output_message_buffer,
  4634.         int *                    conf_state,
  4635.         gss_qop_t *              qop_state)
  4636.  
  4637.    Purpose:
  4638.  
  4639.    Converts a message previously protected by gss_wrap back to a usable
  4640.    form, verifying the embedded signature.  The conf_state parameter
  4641.    indicates whether the message was encrypted; the qop_state parameter
  4642.    indicates the strength of protection that was used to provide the
  4643.    confidentiality and integrity services.
  4644.  
  4645.    Parameters:
  4646.  
  4647.    minor_status      Integer, modify
  4648.                      Mechanism specific status code.
  4649.  
  4650.    context_handle    gss_ctx_id_t, read
  4651.                      Identifies the context on which the message
  4652.                      arrived
  4653.  
  4654.    input_message_buffer  buffer, opaque, read
  4655.                      protected message
  4656.  
  4657.    output_message_buffer  buffer, opaque, modify
  4658.                      Buffer to receive unwrapped message
  4659.  
  4660.    conf_state        boolean, modify, optional
  4661.                      True - Confidentiality and integrity protection
  4662.                             were used
  4663.                      False - Integrity service only was used
  4664.                      Specify NULL if not required
  4665.  
  4666.    qop_state         gss_qop_t, modify, optional
  4667.                      Quality of protection gained from signature
  4668.                      Specify NULL if not required
  4669.  
  4670.    Function value:   GSS status code
  4671.  
  4672.    GSS_S_COMPLETE    Successful completion
  4673.  
  4674.    GSS_S_DEFECTIVE_TOKEN The token failed consistency checks
  4675.  
  4676.    GSS_S_BAD_SIG     The signature was incorrect
  4677.  
  4678.  
  4679.  
  4680.  
  4681.    Wray                Document Expiration: 1 June 1997           [Page 71]
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.  
  4688.  
  4689.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4690.  
  4691.  
  4692.  
  4693.    GSS_S_DUPLICATE_TOKEN The token was valid, and contained a correct
  4694.                      signature for the message, but it had already been
  4695.                      processed
  4696.  
  4697.    GSS_S_OLD_TOKEN   The token was valid, and contained a correct signature
  4698.                      for the message, but it is too old to check for
  4699.                      duplication.
  4700.  
  4701.    GSS_S_UNSEQ_TOKEN The token was valid, and contained a correct signature
  4702.                      for the message, but has been verified out of
  4703.                      sequence; a later token has already been received.
  4704.  
  4705.    GSS_S_GAP_TOKEN   The token was valid, and contained a correct signature
  4706.                      for the message, but has been verified out of
  4707.                      sequence;  an earlier expected token has not yet been
  4708.                      received.
  4709.  
  4710.    GSS_S_CONTEXT_EXPIRED The context has already expired
  4711.  
  4712.    GSS_S_NO_CONTEXT  The context_handle parameter did not identify a valid
  4713.                      context
  4714.  
  4715.  
  4716.  
  4717.  
  4718.  
  4719.  
  4720.  
  4721.    7.35.  gss_verify_mic
  4722.  
  4723.    OM_uint32 gss_verify_mic (
  4724.         OM_uint32 *              minor_status,
  4725.         GSS_CONST gss_ctx_id_t   context_handle,
  4726.         GSS_CONST gss_buffer_t   message_buffer,
  4727.         GSS_CONST gss_buffer_t   token_buffer,
  4728.         gss_qop_t *              qop_state)
  4729.  
  4730.    Purpose:
  4731.  
  4732.    Verifies that a cryptographic signature, contained in the token
  4733.    parameter, fits the supplied message.  The qop_state parameter allows a
  4734.    message recipient to determine the strength of protection that was
  4735.    applied to the message.
  4736.  
  4737.    Parameters:
  4738.  
  4739.    minor_status      Integer, modify
  4740.                      Mechanism specific status code.
  4741.  
  4742.    context_handle    gss_ctx_id_t, read
  4743.                      Identifies the context on which the message
  4744.  
  4745.  
  4746.  
  4747.    Wray                Document Expiration: 1 June 1997           [Page 72]
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4756.  
  4757.  
  4758.  
  4759.                      arrived
  4760.  
  4761.    message_buffer    buffer, opaque, read
  4762.                      Message to be verified
  4763.  
  4764.    token_buffer      buffer, opaque, read
  4765.                      Token associated with message
  4766.  
  4767.    qop_state         gss_qop_t, modify, optional
  4768.                      quality of protection gained from signature
  4769.                      Specify NULL if not required
  4770.  
  4771.    Function value:   GSS status code
  4772.  
  4773.    GSS_S_COMPLETE    Successful completion
  4774.  
  4775.    GSS_S_DEFECTIVE_TOKEN The token failed consistency checks
  4776.  
  4777.    GSS_S_BAD_SIG     The signature was incorrect
  4778.  
  4779.    GSS_S_DUPLICATE_TOKEN The token was valid, and contained a correct
  4780.                      signature for the message, but it had already been
  4781.                      processed
  4782.  
  4783.    GSS_S_OLD_TOKEN   The token was valid, and contained a correct signature
  4784.                      for the message, but it is too old to check for
  4785.                      duplication.
  4786.  
  4787.    GSS_S_UNSEQ_TOKEN The token was valid, and contained a correct signature
  4788.                      for the message, but has been verified out of
  4789.                      sequence; a later token has already been received.
  4790.  
  4791.    GSS_S_GAP_TOKEN   The token was valid, and contained a correct signature
  4792.                      for the message, but has been verified out of
  4793.                      sequence;  an earlier expected token has not yet been
  4794.                      received.
  4795.  
  4796.    GSS_S_CONTEXT_EXPIRED The context has already expired
  4797.  
  4798.    GSS_S_NO_CONTEXT  The context_handle parameter did not identify a valid
  4799.                      context
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.    Wray                Document Expiration: 1 June 1997           [Page 73]
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4822.  
  4823.  
  4824.  
  4825.    7.36.  gss_wrap
  4826.  
  4827.    OM_uint32 gss_wrap (
  4828.         OM_uint32 *              minor_status,
  4829.         GSS_CONST gss_ctx_id_t   context_handle,
  4830.         int                      conf_req_flag,
  4831.         gss_qop_t                qop_req
  4832.         GSS_CONST gss_buffer_t   input_message_buffer,
  4833.         int *                    conf_state,
  4834.         gss_buffer_t             output_message_buffer )
  4835.  
  4836.    Purpose:
  4837.  
  4838.    Cryptographically signs and optionally encrypts the specified
  4839.    input_message.  The output_message contains both the signature and the
  4840.    message.  The qop_req parameter allows a choice between several
  4841.    cryptographic algorithms, if supported by the chosen mechanism.
  4842.  
  4843.    Parameters:
  4844.  
  4845.    minor_status      Integer, modify
  4846.                      Mechanism specific status code.
  4847.  
  4848.    context_handle    gss_ctx_id_t, read
  4849.                      Identifies the context on which the message
  4850.                      will be sent
  4851.  
  4852.    conf_req_flag     boolean, read
  4853.                      True - Both confidentiality and integrity
  4854.                             services are requested
  4855.                      False - Only integrity service is requested
  4856.  
  4857.    qop_req           gss_qop_t, read, optional
  4858.                      Specifies required quality of protection.  A
  4859.                      mechanism-specific default may be requested by
  4860.                      setting qop_req to GSS_C_QOP_DEFAULT.  If an
  4861.                      unsupported protection strength is requested,
  4862.                      gss_wrap will return a major_status of
  4863.                      GSS_S_BAD_QOP.
  4864.  
  4865.    input_message_buffer  buffer, opaque, read
  4866.                      Message to be protected
  4867.  
  4868.    conf_state        boolean, modify, optional
  4869.                      True - Confidentiality, data origin
  4870.                             authentication and integrity services
  4871.                             have been applied
  4872.                      False - Integrity and data origin services only
  4873.                              has been applied.
  4874.                      Specify NULL if not required
  4875.  
  4876.  
  4877.  
  4878.  
  4879.    Wray                Document Expiration: 1 June 1997           [Page 74]
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4888.  
  4889.  
  4890.  
  4891.    output_message_buffer  buffer, opaque, modify
  4892.                      Buffer to receive protected message
  4893.  
  4894.    Function value:   GSS status code
  4895.  
  4896.    GSS_S_COMPLETE    Successful completion
  4897.  
  4898.    GSS_S_CONTEXT_EXPIRED The context has already expired
  4899.  
  4900.    GSS_S_NO_CONTEXT  The context_handle parameter did not identify a valid
  4901.                      context
  4902.  
  4903.    GSS_S_BAD_QOP     The specified QOP is not supported by the mechanism.
  4904.  
  4905.  
  4906.  
  4907.  
  4908.  
  4909.  
  4910.  
  4911.    7.37.  gss_wrap_size_limit
  4912.  
  4913.    OM_uint32 gss_wrap_size_limit (
  4914.         OM_uint32  *             minor_status,
  4915.         GSS_CONST gss_ctx_id_t   context_handle,
  4916.         int                      conf_req_flag,
  4917.         gss_qop_t                qop_req,
  4918.         OM_uint32                req_output_size,
  4919.         OM_uint32 *              max_input_size)
  4920.  
  4921.    Purpose:
  4922.  
  4923.    Allows an application to determine the maximum message size that, if
  4924.    presented to gss_wrap with the same conf_req_flag and qop_req
  4925.    parameters, will result in an output token containing no more than
  4926.    req_output_size bytes.
  4927.  
  4928.    This call is intended for use by applications that communicate over
  4929.    protocols that impose a maximum message size.  It enables the
  4930.    application to fragment messages prior to applying protection.
  4931.  
  4932.    Successful completion of this call does not guarantee that gss_wrap will
  4933.    be able to protect a message of length max_input_size bytes, since this
  4934.    ability may depend on the availability of system resources at the time
  4935.    that gss_wrap is called.  However, if the implementation itself imposes
  4936.    an upper limit on the length of messages that may be processed by
  4937.    gss_wrap, the implementation should not return a value via
  4938.    max_input_bytes that is greater than this length.
  4939.  
  4940.    Parameters:
  4941.  
  4942.  
  4943.  
  4944.  
  4945.    Wray                Document Expiration: 1 June 1997           [Page 75]
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.  
  4952.  
  4953.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  4954.  
  4955.  
  4956.  
  4957.    minor_status      Integer, modify
  4958.                      Mechanism specific status code
  4959.  
  4960.    context_handle    gss_ctx_id_t, read
  4961.                      A handle that refers to the security over
  4962.                      which the messages will be sent.
  4963.  
  4964.    conf_req_flag     Boolean, read
  4965.                      Indicates whether gss_wrap will be asked
  4966.                      to apply confidentiality protection in
  4967.                      addition to integrity protection.  See
  4968.                      the routine description for gss_wrap
  4969.                      for more details.
  4970.  
  4971.    qop_req           gss_qop_t, read
  4972.                      Indicates the level of protection that
  4973.                      gss_wrap will be asked to provide.  See
  4974.                      the routine description for gss_wrap for
  4975.                      more details.
  4976.  
  4977.    req_output_size   Integer, read
  4978.                      The desired maximum size for tokens emitted
  4979.                      by gss_wrap.
  4980.  
  4981.    max_input_size    Integer, modify
  4982.                      The maximum input message size that may
  4983.                      be presented to gss_wrap in order to
  4984.                      guarantee that the emitted token shall
  4985.                      be no larger than req_output_size bytes.
  4986.  
  4987.    Function value:   GSS status code
  4988.  
  4989.    GSS_S_COMPLETE    Successful completion
  4990.  
  4991.    GSS_S_NO_CONTEXT  The referenced context could not be accessed.
  4992.  
  4993.    GSS_S_CONTEXT_EXPIRED The context has expired.
  4994.  
  4995.    GSS_S_BAD_QOP     The specified QOP is not supported by the mechanism.
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.    Wray                Document Expiration: 1 June 1997           [Page 76]
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5020.  
  5021.  
  5022.  
  5023.    APPENDIX A. GSS-API C header file gssapi.h
  5024.  
  5025.    C-language GSS-API implementations should include a copy of the
  5026.    following header-file.
  5027.  
  5028.    #ifndef GSSAPI_H_
  5029.    #define GSSAPI_H_
  5030.  
  5031.  
  5032.  
  5033.    /*
  5034.     * First, include stddef.h to get size_t defined.
  5035.     */
  5036.    #include <stddef.h>
  5037.  
  5038.    /*
  5039.     * If the platform supports the xom.h header file, it should be
  5040.     * included here.
  5041.     */
  5042.    #include <xom.h>
  5043.  
  5044.  
  5045.    /*
  5046.     * define GSS_NO_CONST prior to including this header to tell GSSAPI not
  5047.     * to declare routine input parameters as "const".
  5048.     */
  5049.    #ifndef GSS_NO_CONST
  5050.    #define GSS_CONST const
  5051.    #else
  5052.    #define GSS_CONST
  5053.    #endif
  5054.  
  5055.  
  5056.    /*
  5057.     * Now define the three platform-dependent pointer types.
  5058.     */
  5059.    typedef <platform-specific> gss_ctx_id_t;
  5060.    typedef <platform-specific> gss_cred_id_t;
  5061.    typedef <platform-specific> gss_name_t;
  5062.  
  5063.    /*
  5064.     * The following type must be defined as the smallest natural
  5065.     * unsigned integer supported by the platform that has at least
  5066.     * 32 bits of precision.
  5067.     */
  5068.    typedef <platform-specific> gss_uint32;
  5069.  
  5070.  
  5071.    #ifdef OM_STRING
  5072.    /*
  5073.     * We have included the xom.h header file.  Verify that OM_uint32
  5074.  
  5075.  
  5076.  
  5077.    Wray                Document Expiration: 1 June 1997           [Page 77]
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5086.  
  5087.  
  5088.  
  5089.     * is defined correctly.
  5090.     */
  5091.  
  5092.    #if sizeof(gss_uint32) != sizeof(OM_uint32)
  5093.    #error Incompatible definition of OM_uint32 from xom.h
  5094.    #endif
  5095.  
  5096.    typedef OM_object_identifier gss_OID_desc, *gss_OID;
  5097.  
  5098.    #else
  5099.  
  5100.    /*
  5101.     * We can't use X/Open definitions, so roll our own.
  5102.     */
  5103.  
  5104.    typedef gss_uint32 OM_uint32;
  5105.  
  5106.    typedef struct gss_OID_desc_struct {
  5107.          OM_uint32 length;
  5108.          void      *elements;
  5109.    } gss_OID_desc, *gss_OID;
  5110.  
  5111.    #endif
  5112.  
  5113.    typedef struct gss_OID_set_desc_struct  {
  5114.          size_t     count;
  5115.          gss_OID    elements;
  5116.    } gss_OID_set_desc, *gss_OID_set;
  5117.  
  5118.    typedef struct gss_buffer_desc_struct {
  5119.          size_t length;
  5120.          void *value;
  5121.    } gss_buffer_desc, *gss_buffer_t;
  5122.  
  5123.    typedef struct gss_channel_bindings_struct {
  5124.          OM_uint32 initiator_addrtype;
  5125.          gss_buffer_desc initiator_address;
  5126.          OM_uint32 acceptor_addrtype;
  5127.          gss_buffer_desc acceptor_address;
  5128.          gss_buffer_desc application_data;
  5129.    } *gss_channel_bindings_t;
  5130.  
  5131.  
  5132.    /*
  5133.     * For now, define a QOP-type as an OM_uint32 (pending resolution
  5134.     * of ongoing discussions).
  5135.     */
  5136.    typedef OM_uint32 gss_qop_t;
  5137.  
  5138.    typedef int gss_cred_usage_t;
  5139.  
  5140.  
  5141.  
  5142.  
  5143.    Wray                Document Expiration: 1 June 1997           [Page 78]
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.  
  5150.  
  5151.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5152.  
  5153.  
  5154.  
  5155.    /*
  5156.     * Flag bits for context-level services.
  5157.     */
  5158.    #define GSS_C_DELEG_FLAG 1
  5159.    #define GSS_C_MUTUAL_FLAG 2
  5160.    #define GSS_C_REPLAY_FLAG 4
  5161.    #define GSS_C_SEQUENCE_FLAG 8
  5162.    #define GSS_C_CONF_FLAG 16
  5163.    #define GSS_C_INTEG_FLAG 32
  5164.    #define GSS_C_ANON_FLAG 64
  5165.    #define GSS_C_PROT_READY_FLAG 128
  5166.    #define GSS_C_TRANS_FLAG 256
  5167.  
  5168.    /*
  5169.     * Credential usage options
  5170.     */
  5171.    #define GSS_C_BOTH 0
  5172.    #define GSS_C_INITIATE 1
  5173.    #define GSS_C_ACCEPT 2
  5174.  
  5175.    /*
  5176.     * Status code types for gss_display_status
  5177.     */
  5178.    #define GSS_C_GSS_CODE 1
  5179.    #define GSS_C_MECH_CODE 2
  5180.  
  5181.    /*
  5182.     * The constant definitions for channel-bindings address families
  5183.     */
  5184.    #define GSS_C_AF_UNSPEC     0
  5185.    #define GSS_C_AF_LOCAL      1
  5186.    #define GSS_C_AF_INET       2
  5187.    #define GSS_C_AF_IMPLINK    3
  5188.    #define GSS_C_AF_PUP        4
  5189.    #define GSS_C_AF_CHAOS      5
  5190.    #define GSS_C_AF_NS         6
  5191.    #define GSS_C_AF_NBS        7
  5192.    #define GSS_C_AF_ECMA       8
  5193.    #define GSS_C_AF_DATAKIT    9
  5194.    #define GSS_C_AF_CCITT      10
  5195.    #define GSS_C_AF_SNA        11
  5196.    #define GSS_C_AF_DECnet     12
  5197.    #define GSS_C_AF_DLI        13
  5198.    #define GSS_C_AF_LAT        14
  5199.    #define GSS_C_AF_HYLINK     15
  5200.    #define GSS_C_AF_APPLETALK  16
  5201.    #define GSS_C_AF_BSC        17
  5202.    #define GSS_C_AF_DSS        18
  5203.    #define GSS_C_AF_OSI        19
  5204.    #define GSS_C_AF_X25        21
  5205.  
  5206.  
  5207.  
  5208.  
  5209.    Wray                Document Expiration: 1 June 1997           [Page 79]
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.  
  5216.  
  5217.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5218.  
  5219.  
  5220.  
  5221.    #define GSS_C_AF_NULLADDR   255
  5222.  
  5223.    /*
  5224.     * Various Null values
  5225.     */
  5226.    #define GSS_C_NO_NAME ((gss_name_t) 0)
  5227.    #define GSS_C_NO_BUFFER ((gss_buffer_t) 0)
  5228.    #define GSS_C_NO_OID ((gss_OID) 0)
  5229.    #define GSS_C_NO_OID_SET ((gss_OID_set) 0)
  5230.    #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0)
  5231.    #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0)
  5232.    #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0)
  5233.    #define GSS_C_EMPTY_BUFFER {0, NULL}
  5234.  
  5235.    /*
  5236.     * Some alternate names for a couple of the above
  5237.     * values.  These are defined for V1 compatibility.
  5238.     */
  5239.    #define GSS_C_NULL_OID GSS_C_NO_OID
  5240.    #define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET
  5241.  
  5242.    /*
  5243.     * Define the default Quality of Protection for per-message
  5244.     * services.  Note that an implementation that offers multiple
  5245.     * levels of QOP may either reserve a value (for example zero,
  5246.     * as assumed here) to mean "default protection", or
  5247.     * alternatively may simply equate GSS_C_QOP_DEFAULT to a specific
  5248.     * explicit QOP value.  However, a value of 0 should always be
  5249.     * interpreted by a GSSAPI implementation as a request for the
  5250.     * default protection level.
  5251.     */
  5252.    #define GSS_C_QOP_DEFAULT 0
  5253.  
  5254.    /*
  5255.     * Expiration time of 2^32-1 seconds means infinite lifetime for a
  5256.     * credential or security context
  5257.     */
  5258.    #define GSS_C_INDEFINITE 0xfffffffful
  5259.  
  5260.    /*
  5261.     * The implementation must reserve static storage for a
  5262.     * gss_OID_desc object containing the value
  5263.     * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
  5264.     *              "\x01\x02\x01\x01"},
  5265.     * corresponding to an object-identifier value of
  5266.     * {iso(1) member-body(2) United States(840) mit(113554)
  5267.     *  infosys(1) gssapi(2) generic(1) user_name(1)}.  The constant
  5268.     * GSS_C_NT_USER_NAME should be initialized to point
  5269.     * to that gss_OID_desc.
  5270.     */
  5271.    extern gss_OID GSS_C_NT_USER_NAME;
  5272.  
  5273.  
  5274.  
  5275.    Wray                Document Expiration: 1 June 1997           [Page 80]
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281.  
  5282.  
  5283.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5284.  
  5285.  
  5286.  
  5287.    /*
  5288.     * The implementation must reserve static storage for a
  5289.     * gss_OID_desc object containing the value
  5290.     * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
  5291.     *              "\x01\x02\x01\x02"},
  5292.     * corresponding to an object-identifier value of
  5293.     * {iso(1) member-body(2) United States(840) mit(113554)
  5294.     *  infosys(1) gssapi(2) generic(1) machine_uid_name(2)}.
  5295.     * The constant GSS_C_NT_MACHINE_UID_NAME should be
  5296.     * initialized to point to that gss_OID_desc.
  5297.     */
  5298.    extern gss_OID GSS_C_NT_MACHINE_UID_NAME;
  5299.  
  5300.    /*
  5301.     * The implementation must reserve static storage for a
  5302.     * gss_OID_desc object containing the value
  5303.     * {10, (void *)"\x2a\x86\x48\x86\xf7\x12"
  5304.     *              "\x01\x02\x01\x03"},
  5305.     * corresponding to an object-identifier value of
  5306.     * {iso(1) member-body(2) United States(840) mit(113554)
  5307.     *  infosys(1) gssapi(2) generic(1) string_uid_name(3)}.
  5308.     * The constant GSS_C_NT_STRING_UID_NAME should be
  5309.     * initialized to point to that gss_OID_desc.
  5310.     */
  5311.    extern gss_OID GSS_C_NT_STRING_UID_NAME;
  5312.  
  5313.    /*
  5314.     * The implementation must reserve static storage for a
  5315.     * gss_OID_desc object containing the value
  5316.     * {6, (void *)"\x2b\x06\x01\x05\x06\x02"},
  5317.     * corresponding to an object-identifier value of
  5318.     * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
  5319.     * 6(nametypes), 2(gss-host-based-services)}.  The constant
  5320.     * GSS_C_NT_HOSTBASED_SERVICE should be initialized to point
  5321.     * to that gss_OID_desc.
  5322.     */
  5323.    extern gss_OID GSS_C_NT_HOSTBASED_SERVICE;
  5324.  
  5325.    /*
  5326.     * The implementation must reserve static storage for a
  5327.     * gss_OID_desc object containing the value
  5328.     * {6, (void *)"\x2b\x06\01\x05\x06\x03"},
  5329.     * corresponding to an object identifier value of
  5330.     * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
  5331.     * 6(nametypes), 3(gss-anonymous-name)}.  The constant
  5332.     * and GSS_C_NT_ANONYMOUS should be initialized to point
  5333.     * to that gss_OID_desc.
  5334.     */
  5335.    extern gss_OID GSS_C_NT_ANONYMOUS;
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341.    Wray                Document Expiration: 1 June 1997           [Page 81]
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5350.  
  5351.  
  5352.  
  5353.    /*
  5354.     * The implementation must reserve static storage for a
  5355.     * gss_OID_desc object containing the value
  5356.     * {6, (void *)"\x2b\x06\x01\x05\x06\x04"},
  5357.     * corresponding to an object-identifier value of
  5358.     * {1(iso), 3(org), 6(dod), 1(internet), 5(security),
  5359.     * 6(nametypes), 4(gss-api-exported-name)}.  The constant
  5360.     * GSS_C_NT_EXPORT_NAME should be initialized to point
  5361.     * to that gss_OID_desc.
  5362.     */
  5363.    extern gss_OID GSS_C_NT_EXPORT_NAME;
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.    /* Major status codes */
  5370.  
  5371.    #define GSS_S_COMPLETE 0
  5372.  
  5373.    /*
  5374.     * Some "helper" definitions to make the status code macros obvious.
  5375.     */
  5376.    #define GSS_C_CALLING_ERROR_OFFSET 24
  5377.    #define GSS_C_ROUTINE_ERROR_OFFSET 16
  5378.    #define GSS_C_SUPPLEMENTARY_OFFSET 0
  5379.    #define GSS_C_CALLING_ERROR_MASK 0377ul
  5380.    #define GSS_C_ROUTINE_ERROR_MASK 0377ul
  5381.    #define GSS_C_SUPPLEMENTARY_MASK 0177777ul
  5382.  
  5383.    /*
  5384.     * The macros that test status codes for error conditions.
  5385.     * Note that the GSS_ERROR() macro has changed slightly from
  5386.     * the V1 GSSAPI so that it now evaluates its argument
  5387.     * only once.
  5388.     */
  5389.    #define GSS_CALLING_ERROR(x) \
  5390.      (x & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET))
  5391.    #define GSS_ROUTINE_ERROR(x) \
  5392.      (x & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))
  5393.    #define GSS_SUPPLEMENTARY_INFO(x) \
  5394.      (x & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET))
  5395.    #define GSS_ERROR(x) \
  5396.      (x & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \
  5397.            (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)))
  5398.  
  5399.  
  5400.    /*
  5401.     * Now the actual status code definitions
  5402.     */
  5403.  
  5404.  
  5405.  
  5406.  
  5407.    Wray                Document Expiration: 1 June 1997           [Page 82]
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5416.  
  5417.  
  5418.  
  5419.    /*
  5420.     * Calling errors:
  5421.     */
  5422.    #define GSS_S_CALL_INACCESSIBLE_READ \
  5423.                                 (1ul << GSS_C_CALLING_ERROR_OFFSET)
  5424.    #define GSS_S_CALL_INACCESSIBLE_WRITE \
  5425.                                 (2ul << GSS_C_CALLING_ERROR_OFFSET)
  5426.    #define GSS_S_CALL_BAD_STRUCTURE \
  5427.                                 (3ul << GSS_C_CALLING_ERROR_OFFSET)
  5428.  
  5429.    /*
  5430.     * Routine errors:
  5431.     */
  5432.    #define GSS_S_BAD_MECH (1ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5433.    #define GSS_S_BAD_NAME (2ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5434.    #define GSS_S_BAD_NAMETYPE (3ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5435.    #define GSS_S_BAD_BINDINGS (4ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5436.    #define GSS_S_BAD_STATUS (5ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5437.    #define GSS_S_BAD_SIG (6ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5438.    #define GSS_S_NO_CRED (7ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5439.    #define GSS_S_NO_CONTEXT (8ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5440.    #define GSS_S_DEFECTIVE_TOKEN (9ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5441.    #define GSS_S_DEFECTIVE_CREDENTIAL (10ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5442.    #define GSS_S_CREDENTIALS_EXPIRED (11ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5443.    #define GSS_S_CONTEXT_EXPIRED (12ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5444.    #define GSS_S_FAILURE (13ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5445.    #define GSS_S_BAD_QOP (14ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5446.    #define GSS_S_UNAUTHORIZED (15ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5447.    #define GSS_S_UNAVAILABLE (16ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5448.    #define GSS_S_DUPLICATE_ELEMENT (17ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5449.    #define GSS_S_NAME_NOT_MN (18ul << GSS_C_ROUTINE_ERROR_OFFSET)
  5450.  
  5451.    /*
  5452.     * Supplementary info bits:
  5453.     */
  5454.    #define GSS_S_CONTINUE_NEEDED (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 0))
  5455.    #define GSS_S_DUPLICATE_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 1))
  5456.    #define GSS_S_OLD_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 2))
  5457.    #define GSS_S_UNSEQ_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 3))
  5458.    #define GSS_S_GAP_TOKEN (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 4))
  5459.  
  5460.  
  5461.    /*
  5462.     * Finally, function prototypes for the GSS-API routines.
  5463.     */
  5464.  
  5465.    OM_uint32 gss_acquire_cred
  5466.               (OM_uint32 *,             /*  minor_status */
  5467.                GSS_CONST gss_name_t,    /* desired_name */
  5468.                OM_uint32,               /* time_req */
  5469.                GSS_CONST gss_OID_set,   /* desired_mechs */
  5470.  
  5471.  
  5472.  
  5473.    Wray                Document Expiration: 1 June 1997           [Page 83]
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5482.  
  5483.  
  5484.  
  5485.                gss_cred_usage_t,        /* cred_usage */
  5486.                gss_cred_id_t *,         /* output_cred_handle */
  5487.                gss_OID_set *,           /* actual_mechs */
  5488.                OM_uint32 *              /* time_rec */
  5489.               );
  5490.  
  5491.    OM_uint32 gss_release_cred
  5492.               (OM_uint32 *,             /* minor_status */
  5493.                gss_cred_id_t *          /* cred_handle */
  5494.               );
  5495.  
  5496.    OM_uint32 gss_init_sec_context
  5497.               (OM_uint32 *,             /* minor_status */
  5498.                GSS_CONST gss_cred_id_t, /* initiator_cred_handle */
  5499.                gss_ctx_id_t *,          /* context_handle */
  5500.                GSS_CONST gss_name_t,    /* target_name */
  5501.                GSS_CONST gss_OID,       /* mech_type */
  5502.                OM_uint32,               /* req_flags */
  5503.                OM_uint32,               /* time_req */
  5504.                GSS_CONST gss_channel_bindings_t,
  5505.                                         /* input_chan_bindings */
  5506.                GSS_CONST gss_buffer_t,  /* input_token */
  5507.                gss_OID *,               /* actual_mech_type */
  5508.                gss_buffer_t,            /* output_token */
  5509.                OM_uint32 *,             /* ret_flags */
  5510.                OM_uint32 *              /* time_rec */
  5511.               );
  5512.  
  5513.    OM_uint32 gss_accept_sec_context
  5514.               (OM_uint32 *,             /* minor_status */
  5515.                gss_ctx_id_t *,          /* context_handle */
  5516.                GSS_CONST gss_cred_id_t, /* acceptor_cred_handle */
  5517.                GSS_CONST gss_buffer_t,  /* input_token_buffer */
  5518.                GSS_CONST gss_channel_bindings_t,
  5519.                                         /* input_chan_bindings */
  5520.                gss_name_t *,            /* src_name */
  5521.                gss_OID *,               /* mech_type */
  5522.                gss_buffer_t,            /* output_token */
  5523.                OM_uint32 *,             /* ret_flags */
  5524.                OM_uint32 *,             /* time_rec */
  5525.                gss_cred_id_t *          /* delegated_cred_handle */
  5526.               );
  5527.  
  5528.    OM_uint32 gss_process_context_token
  5529.               (OM_uint32 *,             /* minor_status */
  5530.                GSS_CONST gss_ctx_id_t,  /* context_handle */
  5531.                GSS_CONST gss_buffer_t   /* token_buffer */
  5532.               );
  5533.  
  5534.    OM_uint32 gss_delete_sec_context
  5535.               (OM_uint32 *,             /* minor_status */
  5536.  
  5537.  
  5538.  
  5539.    Wray                Document Expiration: 1 June 1997           [Page 84]
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.  
  5546.  
  5547.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5548.  
  5549.  
  5550.  
  5551.                gss_ctx_id_t *,          /* context_handle */
  5552.                gss_buffer_t             /* output_token */
  5553.               );
  5554.  
  5555.    OM_uint32 gss_context_time
  5556.               (OM_uint32 *,             /* minor_status */
  5557.                GSS_CONST gss_ctx_id_t,  /* context_handle */
  5558.                OM_uint32 *              /* time_rec */
  5559.               );
  5560.  
  5561.    OM_uint32 gss_get_mic
  5562.               (OM_uint32 *,             /* minor_status */
  5563.                GSS_CONST gss_ctx_id_t,  /* context_handle */
  5564.                gss_qop_t,               /* qop_req */
  5565.                GSS_CONST gss_buffer_t,  /* message_buffer */
  5566.                gss_buffer_t             /* message_token */
  5567.               );
  5568.  
  5569.  
  5570.    OM_uint32 gss_verify_mic
  5571.               (OM_uint32 *,             /* minor_status */
  5572.                GSS_CONST gss_ctx_id_t,  /* context_handle */
  5573.                GSS_CONST gss_buffer_t,  /* message_buffer */
  5574.                GSS_CONST gss_buffer_t,  /* token_buffer */
  5575.                gss_qop_t *              /* qop_state */
  5576.               );
  5577.  
  5578.    OM_uint32 gss_wrap
  5579.               (OM_uint32 *,             /* minor_status */
  5580.                GSS_COINST gss_ctx_id_t, /* context_handle */
  5581.                int,                     /* conf_req_flag */
  5582.                gss_qop_t,               /* qop_req */
  5583.                GSS_CONST gss_buffer_t,  /* input_message_buffer */
  5584.                int *,                   /* conf_state */
  5585.                gss_buffer_t             /* output_message_buffer */
  5586.               );
  5587.  
  5588.  
  5589.    OM_uint32 gss_unwrap
  5590.               (OM_uint32 *,             /* minor_status */
  5591.                GSS_CONST gss_ctx_id_t,  /* context_handle */
  5592.                GSS_CONST gss_buffer_t,  /* input_message_buffer */
  5593.                gss_buffer_t,            /* output_message_buffer */
  5594.                int *,                   /* conf_state */
  5595.                gss_qop_t *              /* qop_state */
  5596.               );
  5597.  
  5598.  
  5599.  
  5600.    OM_uint32 gss_display_status
  5601.               (OM_uint32 *,             /* minor_status */
  5602.  
  5603.  
  5604.  
  5605.    Wray                Document Expiration: 1 June 1997           [Page 85]
  5606.  
  5607.  
  5608.  
  5609.  
  5610.  
  5611.  
  5612.  
  5613.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5614.  
  5615.  
  5616.  
  5617.                OM_uint32,               /* status_value */
  5618.                int,                     /* status_type */
  5619.                GSS_CONST gss_OID,       /* mech_type */
  5620.                OM_uint32 *,             /* message_context */
  5621.                gss_buffer_t             /* status_string */
  5622.               );
  5623.  
  5624.    OM_uint32 gss_indicate_mechs
  5625.               (OM_uint32 *,             /* minor_status */
  5626.                gss_OID_set *            /* mech_set */
  5627.               );
  5628.  
  5629.    OM_uint32 gss_compare_name
  5630.               (OM_uint32 *,             /* minor_status */
  5631.                GSS_CONST gss_name_t,    /* name1 */
  5632.                GSS_CONST gss_name_t,    /* name2 */
  5633.                int *                    /* name_equal */
  5634.               );
  5635.  
  5636.    OM_uint32 gss_display_name
  5637.               (OM_uint32 *,             /* minor_status */
  5638.                GSS_CONST gss_name_t,    /* input_name */
  5639.                gss_buffer_t,            /* output_name_buffer */
  5640.                gss_OID *                /* output_name_type */
  5641.               );
  5642.  
  5643.    OM_uint32 gss_import_name
  5644.               (OM_uint32 *,             /* minor_status */
  5645.                GSS_CONST gss_buffer_t,  /* input_name_buffer */
  5646.                GSS_CONST gss_OID,       /* input_name_type */
  5647.                gss_name_t *             /* output_name */
  5648.               );
  5649.  
  5650.    OM_uint32 gss_export_name
  5651.               (OM_uint32  *,            /* minor_status */
  5652.                GSS_CONST gss_name_t,    /* input_name */
  5653.                gss_buffer_t             /* exported_name */
  5654.               );
  5655.  
  5656.    OM_uint32 gss_release_name
  5657.               (OM_uint32 *,             /* minor_status */
  5658.                gss_name_t *             /* input_name */
  5659.               );
  5660.  
  5661.    OM_uint32 gss_release_buffer
  5662.               (OM_uint32 *,             /* minor_status */
  5663.                gss_buffer_t             /* buffer */
  5664.               );
  5665.  
  5666.    OM_uint32 gss_release_oid_set
  5667.               (OM_uint32 *,             /* minor_status */
  5668.  
  5669.  
  5670.  
  5671.    Wray                Document Expiration: 1 June 1997           [Page 86]
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.  
  5678.  
  5679.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5680.  
  5681.  
  5682.  
  5683.                gss_OID_set *            /* set */
  5684.               );
  5685.  
  5686.    OM_uint32 gss_inquire_cred
  5687.               (OM_uint32 *,             /* minor_status */
  5688.                GSS_CONST gss_cred_id_t, /* cred_handle */
  5689.                gss_name_t *,            /* name */
  5690.                OM_uint32 *,             /* lifetime */
  5691.                gss_cred_usage_t *,      /* cred_usage */
  5692.                gss_OID_set *            /* mechanisms */
  5693.               );
  5694.  
  5695.    OM_uint32 gss_inquire_context (
  5696.                OM_uint32 *,             /* minor_status */
  5697.                GSS_CONST gss_ctx_id_t,  /* context_handle */
  5698.                gss_name_t *,            /* src_name */
  5699.                gss_name_t *,            /* targ_name */
  5700.                OM_uint32 *,             /* lifetime_rec */
  5701.                gss_OID *,               /* mech_type */
  5702.                OM_uint32 *,             /* ctx_flags */
  5703.                int *,                   /* locally_initiated */
  5704.                int *                    /* open */
  5705.               );
  5706.  
  5707.    OM_uint32 gss_wrap_size_limit (
  5708.                OM_uint32 *,             /* minor_status */
  5709.                GSS_CONST gss_ctx_id_t,  /* context_handle */
  5710.                int,                     /* conf_req_flag */
  5711.                gss_qop_t,               /* qop_req */
  5712.                OM_uint32,               /* req_output_size */
  5713.                OM_uint32 *              /* max_input_size */
  5714.               );
  5715.  
  5716.  
  5717.    OM_uint32 gss_add_cred (
  5718.                OM_uint32 *,             /* minor_status */
  5719.                GSS_CONST gss_cred_id_t, /* input_cred_handle */
  5720.                GSS_CONST gss_name_t,    /* desired_name */
  5721.                GSS_CONST gss_OID,       /* desired_mech */
  5722.                gss_cred_usage_t,        /* cred_usage */
  5723.                OM_uint32,               /* initiator_time_req */
  5724.                OM_uint32,               /* acceptor_time_req */
  5725.                gss_cred_id_t *,         /* output_cred_handle */
  5726.                gss_OID_set *,           /* actual_mechs */
  5727.                OM_uint32 *,             /* initiator_time_rec */
  5728.                OM_uint32 *              /* acceptor_time_rec */
  5729.               );
  5730.  
  5731.  
  5732.    OM_uint32 gss_inquire_cred_by_mech (
  5733.                OM_uint32 *,             /* minor_status */
  5734.  
  5735.  
  5736.  
  5737.    Wray                Document Expiration: 1 June 1997           [Page 87]
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.  
  5744.  
  5745.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5746.  
  5747.  
  5748.  
  5749.                GSS_CONST gss_cred_id_t, /* cred_handle */
  5750.                GSS_CONST gss_OID,       /* mech_type */
  5751.                gss_name_t *,            /* name */
  5752.                OM_uint32 *,             /* initiator_lifetime */
  5753.                OM_uint32 *,             /* acceptor_lifetime */
  5754.                gss_cred_usage_t *       /* cred_usage */
  5755.               );
  5756.  
  5757.    OM_uint32 gss_export_sec_context (
  5758.                OM_uint32 *,             /* minor_status */
  5759.                gss_ctx_id_t *,          /* context_handle */
  5760.                gss_buffer_t             /* interprocess_token */
  5761.               );
  5762.  
  5763.    OM_uint32 gss_import_sec_context (
  5764.                OM_uint32 *,             /* minor_status */
  5765.                GSS_CONST gss_buffer_t,  /* interprocess_token */
  5766.                gss_ctx_id_t *           /* context_handle */
  5767.               );
  5768.  
  5769.  
  5770.    OM_uint32 gss_release_oid (
  5771.                OM_uint32 *,             /* minor_status */
  5772.                gss_OID *                /* oid */
  5773.               );
  5774.  
  5775.    OM_uint32 gss_create_empty_oid_set (
  5776.                OM_uint32 *,             /* minor_status */
  5777.                gss_OID_set *            /* oid_set */
  5778.               );
  5779.  
  5780.    OM_uint32 gss_add_oid_set_member (
  5781.                OM_uint32 *,             /* minor_status */
  5782.                GSS_CONST gss_OID,       /* member_oid */
  5783.                gss_OID_set *            /* oid_set */
  5784.               );
  5785.  
  5786.    OM_uint32 gss_test_oid_set_member (
  5787.                OM_uint32 *,             /* minor_status */
  5788.                GSS_CONST gss_OID,       /* member */
  5789.                GSS_CONST gss_OID_set,   /* set */
  5790.                int *                    /* present */
  5791.               );
  5792.  
  5793.    OM_uint32 gss_str_to_oid (
  5794.                OM_uint32 *,             /* minor_status */
  5795.                GSS_CONST gss_buffer_t,  /* oid_str */
  5796.                gss_OID *                /* oid */
  5797.               );
  5798.  
  5799.    OM_uint32 gss_oid_to_str (
  5800.  
  5801.  
  5802.  
  5803.    Wray                Document Expiration: 1 June 1997           [Page 88]
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5812.  
  5813.  
  5814.  
  5815.                OM_uint32 *,             /* minor_status */
  5816.                GSS_CONST gss_OID,       /* oid */
  5817.                gss_buffer_t             /* oid_str */
  5818.               );
  5819.  
  5820.    OM_uint32 gss_inquire_names_for_mech (
  5821.                OM_uint32 *,             /* minor_status */
  5822.                GSS_CONST gss_OID,       /* mechanism */
  5823.                gss_OID_set *            /* name_types */
  5824.               );
  5825.  
  5826.    OM_uint32 gss_inquire_mechs_for_name (
  5827.                OM_uint32 *,             /* minor_status */
  5828.                GSS_CONST gss_name_t,    /* input_name */
  5829.                gss_OID_set *            /* mech_types */
  5830.               );
  5831.  
  5832.    OM_uint32 gss_canonicalize_name (
  5833.                OM_uint32 *,             /* minor_status */
  5834.                GSS_CONST gss_name_t,    /* input_name */
  5835.                GSS_CONST gss_OID,       /* mech_type */
  5836.                gss_name_t *             /* output_name */
  5837.               );
  5838.  
  5839.    OM_uint32 gss_duplicate_name (
  5840.                OM_uint32 *,             /* minor_status */
  5841.                GSS_CONST gss_name_t,    /* src_name */
  5842.                gss_name_t *             /* dest_name */
  5843.               );
  5844.  
  5845.    /*
  5846.     * The following routines are obsolete variants of gss_get_mic,
  5847.     * gss_wrap, gss_verify_mic and gss_unwrap.  They should be
  5848.     * provided by GSSAPI V2 implementations for backwards
  5849.     * compatibility with V1 applications.  Distinct entrypoints
  5850.     * (as opposed to #defines) should be provided, both toallow
  5851.     * GSSAPI V1 applications to link against GSSAPI V2 implementations,
  5852.     * and to retain the slight parameter type differences between the
  5853.     * obsolete versions of these routines and their current forms.
  5854.     */
  5855.  
  5856.    OM_uint32 gss_sign
  5857.               (OM_uint32 *,        /* minor_status */
  5858.                gss_ctx_id_t,       /* context_handle */
  5859.                int,                /* qop_req */
  5860.                gss_buffer_t,       /* message_buffer */
  5861.                gss_buffer_t        /* message_token */
  5862.               );
  5863.  
  5864.  
  5865.    OM_uint32 gss_verify
  5866.  
  5867.  
  5868.  
  5869.    Wray                Document Expiration: 1 June 1997           [Page 89]
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5878.  
  5879.  
  5880.  
  5881.               (OM_uint32 *,        /* minor_status */
  5882.                gss_ctx_id_t,       /* context_handle */
  5883.                gss_buffer_t,       /* message_buffer */
  5884.                gss_buffer_t,       /* token_buffer */
  5885.                int *               /* qop_state */
  5886.               );
  5887.  
  5888.    OM_uint32 gss_seal
  5889.               (OM_uint32 *,        /* minor_status */
  5890.                gss_ctx_id_t,       /* context_handle */
  5891.                int,                /* conf_req_flag */
  5892.                int,                /* qop_req */
  5893.                gss_buffer_t,       /* input_message_buffer */
  5894.                int *,              /* conf_state */
  5895.                gss_buffer_t        /* output_message_buffer */
  5896.               );
  5897.  
  5898.  
  5899.    OM_uint32 gss_unseal
  5900.               (OM_uint32 *,        /* minor_status */
  5901.                gss_ctx_id_t,       /* context_handle */
  5902.                gss_buffer_t,       /* input_message_buffer */
  5903.                gss_buffer_t,       /* output_message_buffer */
  5904.                int *,              /* conf_state */
  5905.                int *               /* qop_state */
  5906.               );
  5907.  
  5908.  
  5909.  
  5910.  
  5911.    #endif /* GSSAPI_H_ */
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917.  
  5918.  
  5919.  
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.    Wray                Document Expiration: 1 June 1997           [Page 90]
  5936.  
  5937.  
  5938.  
  5939.  
  5940.  
  5941.  
  5942.  
  5943.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  5944.  
  5945.  
  5946.  
  5947.    APPENDIX B. Additional constraints for application binary portability
  5948.  
  5949.    The purpose of this C-bindings document is to encourage source-level
  5950.    portability of applications across GSS-API implementations on different
  5951.    platforms and atop different mechanisms.  Additional goals that have not
  5952.    been explicitly addressed by this document are link-time and run-time
  5953.    portability.
  5954.  
  5955.    Link-time portability provides the ability to compile an application
  5956.    against one implementation of GSS-API, and then link it against a
  5957.    different implementation on the same platform.  It is a stricter
  5958.    requirement than source-level portability.
  5959.  
  5960.    Run-time portability differs from link-time portability only on those
  5961.    platforms that implement dynamically loadable GSS-API implementations,
  5962.    but do not offer load-time symbol resolution.  On such platforms, run-
  5963.    time portability is a stricter requirement than link-time portability,
  5964.    and will typically include the precise placement of the various GSS-API
  5965.    routines within library entrypoint vectors.
  5966.  
  5967.    Individual platforms will impose their own rules that must be followed
  5968.    to achieve link-time (and run-time, if different) portability.  In order
  5969.    to ensure either form of binary portability, an ABI specification must
  5970.    be written for GSS-API implementations on that platform.  However, it is
  5971.    recognized that there are some issues that are likely to be common to
  5972.    all such ABI specifications. This appendix is intended to be a
  5973.    repository for such common issues, and contains some suggestions that
  5974.    individual ABI specifications may choose to reference.  Since machine
  5975.    architectures vary greatly, it may not be possible or desirable to
  5976.    follow these suggestions on all platforms.
  5977.  
  5978.    B.1.  Pointers
  5979.  
  5980.    While ANSI-C provides a single pointer type for each declared type, plus
  5981.    a single (void *) type, some platforms (notably those using segmented
  5982.    memory architectures) augment this with various modified pointer types
  5983.    (e.g. far pointers, near pointers).  These language bindings assume
  5984.    ANSI-C, and thus do not address such non-standard implementations.
  5985.    GSS-API implementations for such platforms must choose an appropriate
  5986.    memory model, and should use it consistently throughout.  For example,
  5987.    if a memory model is chosen that requires the use of far pointers when
  5988.    passing routine parameters, then far pointers should also be used within
  5989.    the structures defined by GSS-API.
  5990.  
  5991.    B.2.  Internal structure alignment
  5992.  
  5993.    GSS-API defines several data-structures containing differently-sized
  5994.    fields.  An ABI specification should include a detailed description of
  5995.    how the fields of such structures are aligned, and if there is any
  5996.    internal padding in these data structures.  The use of compiler defaults
  5997.    for the platform is recommended.
  5998.  
  5999.  
  6000.  
  6001.    Wray                Document Expiration: 1 June 1997           [Page 91]
  6002.  
  6003.  
  6004.  
  6005.  
  6006.  
  6007.  
  6008.  
  6009.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  6010.  
  6011.  
  6012.  
  6013.    B.3.  Handle types
  6014.  
  6015.    The C bindings specify that the gss_cred_id_t and gss_ctx_id_t types
  6016.    should be implemented as either pointer or arithmetic types, and that if
  6017.    pointer types are used, care should be taken to ensure that two handles
  6018.    may be compared with the == operator.  Note that ANSI-C does not
  6019.    guarantee that two pointer values may be compared with the == operator
  6020.    unless either the two pointers point to members of a single array, or at
  6021.    least one of the pointers contains a NULL value.
  6022.  
  6023.    For binary portability, additional constraints are required.  The
  6024.    following is an attempt at defining platform-independent constraints.
  6025.  
  6026.      (a) The size of the handle type must be the same as sizeof(void *),
  6027.          using the appropriate memory model.
  6028.  
  6029.      (b) The == operator for the chosen type must be a simple bit-wise
  6030.          comparison.  That is, for two in-memory handle objects h1 and h2,
  6031.          the boolean value of the expression
  6032.  
  6033.               (h1 == h2)
  6034.  
  6035.          should always be the same as the boolean value of the expression
  6036.  
  6037.               (memcmp(&h1, &h2, sizeof(h1)) == 0)
  6038.  
  6039.      (c) The actual use of the type (void *) for handle types is
  6040.          discouraged, not for binary portability reasons, but since it
  6041.          effectively disables much of the compile-time type-checking that
  6042.          the compiler can otherwise perform, and is therefore not
  6043.          "programmer-friendly".  If a pointer implementation is desired,
  6044.          and if the platform's implementation of pointers permits, the
  6045.          handles should be implemented as pointers to distinct
  6046.          implementation-defined types.
  6047.  
  6048.    B.4.  The gss_name_t type
  6049.  
  6050.    The gss_name_t type, representing the internal name object, should be
  6051.    implemented as a pointer type.  The use of the (void *) type is
  6052.    discouraged as it does not allow the compiler to perform strong type-
  6053.    checking.  However, the pointer type chosen should be of the same size
  6054.    as the (void *) type.  Provided this rule is obeyed, ABI specifications
  6055.    need not further constrain the implementation of gss_name_t objects.
  6056.  
  6057.    B.5.  The int and size_t types
  6058.  
  6059.    Some platforms may support differently sized implementations of the
  6060.    "int" and "size_t" types, perhaps chosen through compiler switches, and
  6061.    perhaps dependent on memory model.  An ABI specification for such a
  6062.    platform should include required implementations for these types. It is
  6063.    recommended that the default implementation (for the chosen memory
  6064.  
  6065.  
  6066.  
  6067.    Wray                Document Expiration: 1 June 1997           [Page 92]
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.    INTERNET-DRAFT          GSS-API V2 - C bindings            November 1996
  6076.  
  6077.  
  6078.  
  6079.    model, if appropriate) is chosen.
  6080.  
  6081.    B.6.  Procedure-calling conventions
  6082.  
  6083.    Some platforms support a variety of different binary conventions for
  6084.    calling procedures.  Such conventions cover things like the format of
  6085.    the stack frame, the order in which the routine parameters are pushed
  6086.    onto the stack, whether or not a parameter count is pushed onto the
  6087.    stack, whether some argument(s) or return values are to be passed in
  6088.    registers, and whether the called routine or the caller is responsible
  6089.    for removing the stack frame on return.  For such platforms, an ABI
  6090.    specification should specify which calling convention is to be used for
  6091.    GSSAPI implementations.
  6092.  
  6093.  
  6094.    REFERENCES
  6095.  
  6096.    [GSSAPI]    J. Linn, "Generic Security Service Application Program
  6097.                Interface, Version 2", Internet-Draft draft-ietf-cat-gssv2-
  6098.                08, 26 August 1996.  (This Internet-Draft, like all other
  6099.                Internet-Drafts, is not an archival document and is subject
  6100.                to change or deletion.  It is available at the time of this
  6101.                writing by anonymous ftp from ds.internic.net, directory
  6102.                internet-drafts. Would-be readers should check for successor
  6103.                Internet-Draft versions or Internet RFCs before relying on
  6104.                this document.)
  6105.  
  6106.    [XOM]       "OSI Object Management API Specification, Version 2.0",
  6107.                X.400 API Association & X/Open Company Limited, August 24,
  6108.                1990.  Specification of datatypes and routines for
  6109.                manipulating information objects.
  6110.  
  6111.  
  6112.    AUTHOR'S ADDRESS
  6113.  
  6114.    John Wray                       Internet email: Wray@tuxedo.enet.dec.com
  6115.    Digital Equipment Corporation                 Telephone: +1-508-486-5210
  6116.    550 King Street, LKG2-2/Z7
  6117.    Littleton, MA  01460
  6118.    USA
  6119.  
  6120.  
  6121.  
  6122.  
  6123.  
  6124.  
  6125.  
  6126.  
  6127.  
  6128.  
  6129.  
  6130.  
  6131.  
  6132.  
  6133.    Wray                Document Expiration: 1 June 1997           [Page 93]
  6134.  
  6135.  
  6136.  
  6137.  
  6138.