1*7f2fe78bSCy Schubert /* 2*7f2fe78bSCy Schubert * Copyright 2008 by the Massachusetts Institute of Technology. 3*7f2fe78bSCy Schubert * All Rights Reserved. 4*7f2fe78bSCy Schubert * 5*7f2fe78bSCy Schubert * Export of this software from the United States of America may 6*7f2fe78bSCy Schubert * require a specific license from the United States Government. 7*7f2fe78bSCy Schubert * It is the responsibility of any person or organization contemplating 8*7f2fe78bSCy Schubert * export to obtain such a license before exporting. 9*7f2fe78bSCy Schubert * 10*7f2fe78bSCy Schubert * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 11*7f2fe78bSCy Schubert * distribute this software and its documentation for any purpose and 12*7f2fe78bSCy Schubert * without fee is hereby granted, provided that the above copyright 13*7f2fe78bSCy Schubert * notice appear in all copies and that both that copyright notice and 14*7f2fe78bSCy Schubert * this permission notice appear in supporting documentation, and that 15*7f2fe78bSCy Schubert * the name of M.I.T. not be used in advertising or publicity pertaining 16*7f2fe78bSCy Schubert * to distribution of the software without specific, written prior 17*7f2fe78bSCy Schubert * permission. Furthermore if you modify this software you must label 18*7f2fe78bSCy Schubert * your software as modified software and not distribute it in such a 19*7f2fe78bSCy Schubert * fashion that it might be confused with the original M.I.T. software. 20*7f2fe78bSCy Schubert * M.I.T. makes no representations about the suitability of 21*7f2fe78bSCy Schubert * this software for any purpose. It is provided "as is" without express 22*7f2fe78bSCy Schubert * or implied warranty. 23*7f2fe78bSCy Schubert */ 24*7f2fe78bSCy Schubert 25*7f2fe78bSCy Schubert #ifndef GSSAPI_EXT_H_ 26*7f2fe78bSCy Schubert #define GSSAPI_EXT_H_ 27*7f2fe78bSCy Schubert 28*7f2fe78bSCy Schubert #include <gssapi/gssapi.h> 29*7f2fe78bSCy Schubert 30*7f2fe78bSCy Schubert #ifdef __cplusplus 31*7f2fe78bSCy Schubert extern "C" { 32*7f2fe78bSCy Schubert #endif /* __cplusplus */ 33*7f2fe78bSCy Schubert 34*7f2fe78bSCy Schubert /* 35*7f2fe78bSCy Schubert * Solaris extensions 36*7f2fe78bSCy Schubert */ 37*7f2fe78bSCy Schubert #ifndef _WIN32 38*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 39*7f2fe78bSCy Schubert gss_pname_to_uid 40*7f2fe78bSCy Schubert (OM_uint32 *minor, 41*7f2fe78bSCy Schubert const gss_name_t name, 42*7f2fe78bSCy Schubert const gss_OID mech_type, 43*7f2fe78bSCy Schubert uid_t *uidOut); 44*7f2fe78bSCy Schubert #endif 45*7f2fe78bSCy Schubert 46*7f2fe78bSCy Schubert /** 47*7f2fe78bSCy Schubert * Provides a platform-specific name for a GSSAPI name as interpreted by a 48*7f2fe78bSCy Schubert * given mechanism. 49*7f2fe78bSCy Schubert * 50*7f2fe78bSCy Schubert * @param [out] minor Minor status code 51*7f2fe78bSCy Schubert * @param [in] name The gss name resulting from accept_sec_context 52*7f2fe78bSCy Schubert * @param [in] mech_type The mechanism that will be asked to map @a name to a 53*7f2fe78bSCy Schubert * local name 54*7f2fe78bSCy Schubert * @param [out] localname Caller-allocated buffer to be filled in with the 55*7f2fe78bSCy Schubert * local name on success 56*7f2fe78bSCy Schubert */ 57*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 58*7f2fe78bSCy Schubert gss_localname 59*7f2fe78bSCy Schubert (OM_uint32 *minor, 60*7f2fe78bSCy Schubert const gss_name_t name, 61*7f2fe78bSCy Schubert gss_const_OID mech_type, 62*7f2fe78bSCy Schubert gss_buffer_t localname); 63*7f2fe78bSCy Schubert 64*7f2fe78bSCy Schubert /** 65*7f2fe78bSCy Schubert * Determine whether a mechanism name is authorized to act as a username. 66*7f2fe78bSCy Schubert * 67*7f2fe78bSCy Schubert * @param [in] name Mechanism name 68*7f2fe78bSCy Schubert * @param [in] username System username 69*7f2fe78bSCy Schubert * 70*7f2fe78bSCy Schubert * This is a simple wrapper around gss_authorize_localname(). It only supports 71*7f2fe78bSCy Schubert * system usernames as local names, and cannot distinguish between lack of 72*7f2fe78bSCy Schubert * authorization and other errors. 73*7f2fe78bSCy Schubert * 74*7f2fe78bSCy Schubert * @retval 1 @a name is authorized to act as @a username 75*7f2fe78bSCy Schubert * @retval 0 @a name is not authorized or an error occurred 76*7f2fe78bSCy Schubert */ 77*7f2fe78bSCy Schubert int KRB5_CALLCONV 78*7f2fe78bSCy Schubert gss_userok(const gss_name_t name, 79*7f2fe78bSCy Schubert const char *username); 80*7f2fe78bSCy Schubert 81*7f2fe78bSCy Schubert /** 82*7f2fe78bSCy Schubert * Determine whether a mechanism name is authorized to act as a local name. 83*7f2fe78bSCy Schubert * 84*7f2fe78bSCy Schubert * @param [out] minor Minor status code 85*7f2fe78bSCy Schubert * @param [in] name Mechanism name 86*7f2fe78bSCy Schubert * @param [in] user Local name 87*7f2fe78bSCy Schubert * 88*7f2fe78bSCy Schubert * @a name is a mechanism name, typically the result of a completed 89*7f2fe78bSCy Schubert * gss_accept_sec_context(). @a user is an internal name representing a local 90*7f2fe78bSCy Schubert * name, such as a name imported by gss_import_name() with an @a 91*7f2fe78bSCy Schubert * input_name_type of @c GSS_C_NT_USER_NAME. 92*7f2fe78bSCy Schubert * 93*7f2fe78bSCy Schubert * @return Return GSS_S_COMPLETE if @a name is authorized to act as @a user, 94*7f2fe78bSCy Schubert * GSS_S_UNAUTHORIZED if not, or an appropriate GSS error code if an error 95*7f2fe78bSCy Schubert * occurred. 96*7f2fe78bSCy Schubert * 97*7f2fe78bSCy Schubert * @sa gss_userok 98*7f2fe78bSCy Schubert */ 99*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 100*7f2fe78bSCy Schubert gss_authorize_localname(OM_uint32 *minor, 101*7f2fe78bSCy Schubert const gss_name_t name, 102*7f2fe78bSCy Schubert const gss_name_t user); 103*7f2fe78bSCy Schubert 104*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 105*7f2fe78bSCy Schubert gss_acquire_cred_with_password( 106*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 107*7f2fe78bSCy Schubert const gss_name_t, /* desired_name */ 108*7f2fe78bSCy Schubert const gss_buffer_t, /* password */ 109*7f2fe78bSCy Schubert OM_uint32, /* time_req */ 110*7f2fe78bSCy Schubert const gss_OID_set, /* desired_mechs */ 111*7f2fe78bSCy Schubert gss_cred_usage_t, /* cred_usage */ 112*7f2fe78bSCy Schubert gss_cred_id_t *, /* output_cred_handle */ 113*7f2fe78bSCy Schubert gss_OID_set *, /* actual_mechs */ 114*7f2fe78bSCy Schubert OM_uint32 *); /* time_rec */ 115*7f2fe78bSCy Schubert 116*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 117*7f2fe78bSCy Schubert gss_add_cred_with_password( 118*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 119*7f2fe78bSCy Schubert const gss_cred_id_t,/* input_cred_handle */ 120*7f2fe78bSCy Schubert const gss_name_t, /* desired_name */ 121*7f2fe78bSCy Schubert const gss_OID, /* desired_mech */ 122*7f2fe78bSCy Schubert const gss_buffer_t, /* password */ 123*7f2fe78bSCy Schubert gss_cred_usage_t, /* cred_usage */ 124*7f2fe78bSCy Schubert OM_uint32, /* initiator_time_req */ 125*7f2fe78bSCy Schubert OM_uint32, /* acceptor_time_req */ 126*7f2fe78bSCy Schubert gss_cred_id_t *, /* output_cred_handle */ 127*7f2fe78bSCy Schubert gss_OID_set *, /* actual_mechs */ 128*7f2fe78bSCy Schubert OM_uint32 *, /* initiator_time_rec */ 129*7f2fe78bSCy Schubert OM_uint32 *); /* acceptor_time_rec */ 130*7f2fe78bSCy Schubert 131*7f2fe78bSCy Schubert /* 132*7f2fe78bSCy Schubert * GGF extensions 133*7f2fe78bSCy Schubert */ 134*7f2fe78bSCy Schubert typedef struct gss_buffer_set_desc_struct { 135*7f2fe78bSCy Schubert size_t count; 136*7f2fe78bSCy Schubert gss_buffer_desc *elements; 137*7f2fe78bSCy Schubert } gss_buffer_set_desc, *gss_buffer_set_t; 138*7f2fe78bSCy Schubert 139*7f2fe78bSCy Schubert #define GSS_C_NO_BUFFER_SET ((gss_buffer_set_t) 0) 140*7f2fe78bSCy Schubert 141*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_create_empty_buffer_set 142*7f2fe78bSCy Schubert (OM_uint32 * /*minor_status*/, 143*7f2fe78bSCy Schubert gss_buffer_set_t * /*buffer_set*/); 144*7f2fe78bSCy Schubert 145*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_add_buffer_set_member 146*7f2fe78bSCy Schubert (OM_uint32 * /*minor_status*/, 147*7f2fe78bSCy Schubert const gss_buffer_t /*member_buffer*/, 148*7f2fe78bSCy Schubert gss_buffer_set_t * /*buffer_set*/); 149*7f2fe78bSCy Schubert 150*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_release_buffer_set 151*7f2fe78bSCy Schubert (OM_uint32 * /*minor_status*/, 152*7f2fe78bSCy Schubert gss_buffer_set_t * /*buffer_set*/); 153*7f2fe78bSCy Schubert 154*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_inquire_sec_context_by_oid 155*7f2fe78bSCy Schubert (OM_uint32 * /*minor_status*/, 156*7f2fe78bSCy Schubert const gss_ctx_id_t /*context_handle*/, 157*7f2fe78bSCy Schubert const gss_OID /*desired_object*/, 158*7f2fe78bSCy Schubert gss_buffer_set_t * /*data_set*/); 159*7f2fe78bSCy Schubert 160*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_inquire_cred_by_oid 161*7f2fe78bSCy Schubert (OM_uint32 * /*minor_status*/, 162*7f2fe78bSCy Schubert const gss_cred_id_t /*cred_handle*/, 163*7f2fe78bSCy Schubert const gss_OID /*desired_object*/, 164*7f2fe78bSCy Schubert gss_buffer_set_t * /*data_set*/); 165*7f2fe78bSCy Schubert 166*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_set_sec_context_option 167*7f2fe78bSCy Schubert (OM_uint32 * /*minor_status*/, 168*7f2fe78bSCy Schubert gss_ctx_id_t * /*cred_handle*/, 169*7f2fe78bSCy Schubert const gss_OID /*desired_object*/, 170*7f2fe78bSCy Schubert const gss_buffer_t /*value*/); 171*7f2fe78bSCy Schubert 172*7f2fe78bSCy Schubert /* 173*7f2fe78bSCy Schubert * Export import cred extensions from GGF, but using Heimdal's signatures 174*7f2fe78bSCy Schubert */ 175*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_export_cred 176*7f2fe78bSCy Schubert (OM_uint32 * /* minor_status */, 177*7f2fe78bSCy Schubert gss_cred_id_t /* cred_handle */, 178*7f2fe78bSCy Schubert gss_buffer_t /* token */); 179*7f2fe78bSCy Schubert 180*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_import_cred 181*7f2fe78bSCy Schubert (OM_uint32 * /* minor_status */, 182*7f2fe78bSCy Schubert gss_buffer_t /* token */, 183*7f2fe78bSCy Schubert gss_cred_id_t * /* cred_handle */); 184*7f2fe78bSCy Schubert 185*7f2fe78bSCy Schubert /* 186*7f2fe78bSCy Schubert * Heimdal extension 187*7f2fe78bSCy Schubert */ 188*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_set_cred_option 189*7f2fe78bSCy Schubert (OM_uint32 * /*minor_status*/, 190*7f2fe78bSCy Schubert gss_cred_id_t * /*cred*/, 191*7f2fe78bSCy Schubert const gss_OID /*desired_object*/, 192*7f2fe78bSCy Schubert const gss_buffer_t /*value*/); 193*7f2fe78bSCy Schubert 194*7f2fe78bSCy Schubert /* 195*7f2fe78bSCy Schubert * Call the given method on the given mechanism 196*7f2fe78bSCy Schubert */ 197*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gssspi_mech_invoke 198*7f2fe78bSCy Schubert (OM_uint32 * /*minor_status*/, 199*7f2fe78bSCy Schubert const gss_OID /*desired_mech*/, 200*7f2fe78bSCy Schubert const gss_OID /*desired_object*/, 201*7f2fe78bSCy Schubert gss_buffer_t /*value*/); 202*7f2fe78bSCy Schubert 203*7f2fe78bSCy Schubert /* 204*7f2fe78bSCy Schubert * AEAD extensions 205*7f2fe78bSCy Schubert */ 206*7f2fe78bSCy Schubert 207*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_wrap_aead 208*7f2fe78bSCy Schubert (OM_uint32 * /*minor_status*/, 209*7f2fe78bSCy Schubert gss_ctx_id_t /*context_handle*/, 210*7f2fe78bSCy Schubert int /*conf_req_flag*/, 211*7f2fe78bSCy Schubert gss_qop_t /*qop_req*/, 212*7f2fe78bSCy Schubert gss_buffer_t /*input_assoc_buffer*/, 213*7f2fe78bSCy Schubert gss_buffer_t /*input_payload_buffer*/, 214*7f2fe78bSCy Schubert int * /*conf_state*/, 215*7f2fe78bSCy Schubert gss_buffer_t /*output_message_buffer*/); 216*7f2fe78bSCy Schubert 217*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_unwrap_aead 218*7f2fe78bSCy Schubert (OM_uint32 * /*minor_status*/, 219*7f2fe78bSCy Schubert gss_ctx_id_t /*context_handle*/, 220*7f2fe78bSCy Schubert gss_buffer_t /*input_message_buffer*/, 221*7f2fe78bSCy Schubert gss_buffer_t /*input_assoc_buffer*/, 222*7f2fe78bSCy Schubert gss_buffer_t /*output_payload_buffer*/, 223*7f2fe78bSCy Schubert int * /*conf_state*/, 224*7f2fe78bSCy Schubert gss_qop_t * /*qop_state*/); 225*7f2fe78bSCy Schubert 226*7f2fe78bSCy Schubert /* 227*7f2fe78bSCy Schubert * SSPI extensions 228*7f2fe78bSCy Schubert */ 229*7f2fe78bSCy Schubert #define GSS_C_DCE_STYLE 0x1000 230*7f2fe78bSCy Schubert #define GSS_C_IDENTIFY_FLAG 0x2000 231*7f2fe78bSCy Schubert #define GSS_C_EXTENDED_ERROR_FLAG 0x4000 232*7f2fe78bSCy Schubert 233*7f2fe78bSCy Schubert /* 234*7f2fe78bSCy Schubert * Returns a buffer set with the first member containing the 235*7f2fe78bSCy Schubert * session key for SSPI compatibility. The optional second 236*7f2fe78bSCy Schubert * member contains an OID identifying the session key type. 237*7f2fe78bSCy Schubert */ 238*7f2fe78bSCy Schubert GSS_DLLIMP extern gss_OID GSS_C_INQ_SSPI_SESSION_KEY; 239*7f2fe78bSCy Schubert 240*7f2fe78bSCy Schubert /* 241*7f2fe78bSCy Schubert * Returns a buffer set with the first member containing the ticket session key 242*7f2fe78bSCy Schubert * for ODBC compatibility. The optional second member contains an OID 243*7f2fe78bSCy Schubert * identifying the session key type. 244*7f2fe78bSCy Schubert */ 245*7f2fe78bSCy Schubert GSS_DLLIMP extern gss_OID GSS_C_INQ_ODBC_SESSION_KEY; 246*7f2fe78bSCy Schubert 247*7f2fe78bSCy Schubert GSS_DLLIMP extern gss_OID GSS_C_INQ_NEGOEX_KEY; 248*7f2fe78bSCy Schubert GSS_DLLIMP extern gss_OID GSS_C_INQ_NEGOEX_VERIFY_KEY; 249*7f2fe78bSCy Schubert 250*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_complete_auth_token 251*7f2fe78bSCy Schubert (OM_uint32 *minor_status, 252*7f2fe78bSCy Schubert const gss_ctx_id_t context_handle, 253*7f2fe78bSCy Schubert gss_buffer_t input_message_buffer); 254*7f2fe78bSCy Schubert 255*7f2fe78bSCy Schubert typedef struct gss_iov_buffer_desc_struct { 256*7f2fe78bSCy Schubert OM_uint32 type; 257*7f2fe78bSCy Schubert gss_buffer_desc buffer; 258*7f2fe78bSCy Schubert } gss_iov_buffer_desc, *gss_iov_buffer_t; 259*7f2fe78bSCy Schubert 260*7f2fe78bSCy Schubert #define GSS_C_NO_IOV_BUFFER ((gss_iov_buffer_t)0) 261*7f2fe78bSCy Schubert 262*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_TYPE_EMPTY 0 263*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_TYPE_DATA 1 /* Packet data */ 264*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_TYPE_HEADER 2 /* Mechanism header */ 265*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_TYPE_MECH_PARAMS 3 /* Mechanism specific parameters */ 266*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_TYPE_TRAILER 7 /* Mechanism trailer */ 267*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_TYPE_PADDING 9 /* Padding */ 268*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_TYPE_STREAM 10 /* Complete wrap token */ 269*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_TYPE_SIGN_ONLY 11 /* Sign only packet data */ 270*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_TYPE_MIC_TOKEN 12 /* MIC token destination */ 271*7f2fe78bSCy Schubert 272*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_FLAG_MASK 0xFFFF0000 273*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_FLAG_ALLOCATE 0x00010000 /* indicates GSS should allocate */ 274*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_FLAG_ALLOCATED 0x00020000 /* indicates caller should free */ 275*7f2fe78bSCy Schubert 276*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_TYPE(_type) ((_type) & ~(GSS_IOV_BUFFER_FLAG_MASK)) 277*7f2fe78bSCy Schubert #define GSS_IOV_BUFFER_FLAGS(_type) ((_type) & GSS_IOV_BUFFER_FLAG_MASK) 278*7f2fe78bSCy Schubert 279*7f2fe78bSCy Schubert /* 280*7f2fe78bSCy Schubert * Sign and optionally encrypt a sequence of buffers. The buffers 281*7f2fe78bSCy Schubert * shall be ordered HEADER | DATA | PADDING | TRAILER. Suitable 282*7f2fe78bSCy Schubert * space for the header, padding and trailer should be provided 283*7f2fe78bSCy Schubert * by calling gss_wrap_iov_length(), or the ALLOCATE flag should 284*7f2fe78bSCy Schubert * be set on those buffers. 285*7f2fe78bSCy Schubert * 286*7f2fe78bSCy Schubert * Encryption is in-place. SIGN_ONLY buffers are untouched. Only 287*7f2fe78bSCy Schubert * a single PADDING buffer should be provided. The order of the 288*7f2fe78bSCy Schubert * buffers in memory does not matter. Buffers in the IOV should 289*7f2fe78bSCy Schubert * be arranged in the order above, and in the case of multiple 290*7f2fe78bSCy Schubert * DATA buffers the sender and receiver should agree on the 291*7f2fe78bSCy Schubert * order. 292*7f2fe78bSCy Schubert * 293*7f2fe78bSCy Schubert * With GSS_C_DCE_STYLE it is acceptable to not provide PADDING 294*7f2fe78bSCy Schubert * and TRAILER, but the caller must guarantee the plaintext data 295*7f2fe78bSCy Schubert * being encrypted is correctly padded, otherwise an error will 296*7f2fe78bSCy Schubert * be returned. 297*7f2fe78bSCy Schubert * 298*7f2fe78bSCy Schubert * While applications that have knowledge of the underlying 299*7f2fe78bSCy Schubert * cryptosystem may request a specific configuration of data 300*7f2fe78bSCy Schubert * buffers, the only generally supported configurations are: 301*7f2fe78bSCy Schubert * 302*7f2fe78bSCy Schubert * HEADER | DATA | PADDING | TRAILER 303*7f2fe78bSCy Schubert * 304*7f2fe78bSCy Schubert * which will emit GSS_Wrap() compatible tokens, and: 305*7f2fe78bSCy Schubert * 306*7f2fe78bSCy Schubert * HEADER | SIGN_ONLY | DATA | PADDING | TRAILER 307*7f2fe78bSCy Schubert * 308*7f2fe78bSCy Schubert * for AEAD. 309*7f2fe78bSCy Schubert * 310*7f2fe78bSCy Schubert * The typical (special cased) usage for DCE is as follows: 311*7f2fe78bSCy Schubert * 312*7f2fe78bSCy Schubert * SIGN_ONLY_1 | DATA | SIGN_ONLY_2 | HEADER 313*7f2fe78bSCy Schubert */ 314*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_wrap_iov 315*7f2fe78bSCy Schubert ( 316*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 317*7f2fe78bSCy Schubert gss_ctx_id_t, /* context_handle */ 318*7f2fe78bSCy Schubert int, /* conf_req_flag */ 319*7f2fe78bSCy Schubert gss_qop_t, /* qop_req */ 320*7f2fe78bSCy Schubert int *, /* conf_state */ 321*7f2fe78bSCy Schubert gss_iov_buffer_desc *, /* iov */ 322*7f2fe78bSCy Schubert int); /* iov_count */ 323*7f2fe78bSCy Schubert 324*7f2fe78bSCy Schubert /* 325*7f2fe78bSCy Schubert * Verify and optionally decrypt a sequence of buffers. To process 326*7f2fe78bSCy Schubert * a GSS-API message without separate buffer, pass STREAM | DATA. 327*7f2fe78bSCy Schubert * Upon return DATA will contain the decrypted or integrity 328*7f2fe78bSCy Schubert * protected message. Only a single DATA buffer may be provided 329*7f2fe78bSCy Schubert * with this usage. DATA by default will point into STREAM, but if 330*7f2fe78bSCy Schubert * the ALLOCATE flag is set a copy will be returned. 331*7f2fe78bSCy Schubert * 332*7f2fe78bSCy Schubert * Otherwise, decryption is in-place. SIGN_ONLY buffers are 333*7f2fe78bSCy Schubert * untouched. 334*7f2fe78bSCy Schubert */ 335*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_unwrap_iov 336*7f2fe78bSCy Schubert ( 337*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 338*7f2fe78bSCy Schubert gss_ctx_id_t, /* context_handle */ 339*7f2fe78bSCy Schubert int *, /* conf_state */ 340*7f2fe78bSCy Schubert gss_qop_t *, /* qop_state */ 341*7f2fe78bSCy Schubert gss_iov_buffer_desc *, /* iov */ 342*7f2fe78bSCy Schubert int); /* iov_count */ 343*7f2fe78bSCy Schubert 344*7f2fe78bSCy Schubert /* 345*7f2fe78bSCy Schubert * Query HEADER, PADDING and TRAILER buffer lengths. DATA buffers 346*7f2fe78bSCy Schubert * should be provided so the correct padding length can be determined. 347*7f2fe78bSCy Schubert */ 348*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_wrap_iov_length 349*7f2fe78bSCy Schubert ( 350*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 351*7f2fe78bSCy Schubert gss_ctx_id_t, /* context_handle */ 352*7f2fe78bSCy Schubert int, /* conf_req_flag */ 353*7f2fe78bSCy Schubert gss_qop_t, /* qop_req */ 354*7f2fe78bSCy Schubert int *, /* conf_state */ 355*7f2fe78bSCy Schubert gss_iov_buffer_desc *, /* iov */ 356*7f2fe78bSCy Schubert int); /* iov_count */ 357*7f2fe78bSCy Schubert 358*7f2fe78bSCy Schubert /* 359*7f2fe78bSCy Schubert * Produce a GSSAPI MIC token for a sequence of buffers. All SIGN_ONLY and 360*7f2fe78bSCy Schubert * DATA buffers will be signed, in the order they appear. One MIC_TOKEN buffer 361*7f2fe78bSCy Schubert * must be included for the result. Suitable space should be provided for the 362*7f2fe78bSCy Schubert * MIC_TOKEN buffer by calling gss_get_mic_iov_length, or the ALLOCATE flag 363*7f2fe78bSCy Schubert * should be set on that buffer. If the ALLOCATE flag is used, use 364*7f2fe78bSCy Schubert * gss_release_iov_buffer to free the allocated buffer within the iov list when 365*7f2fe78bSCy Schubert * it is no longer needed. 366*7f2fe78bSCy Schubert */ 367*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_get_mic_iov 368*7f2fe78bSCy Schubert ( 369*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 370*7f2fe78bSCy Schubert gss_ctx_id_t, /* context_handle */ 371*7f2fe78bSCy Schubert gss_qop_t, /* qop_req */ 372*7f2fe78bSCy Schubert gss_iov_buffer_desc *, /* iov */ 373*7f2fe78bSCy Schubert int); /* iov_count */ 374*7f2fe78bSCy Schubert 375*7f2fe78bSCy Schubert /* 376*7f2fe78bSCy Schubert * Query the MIC_TOKEN buffer length within the iov list. 377*7f2fe78bSCy Schubert */ 378*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_get_mic_iov_length( 379*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 380*7f2fe78bSCy Schubert gss_ctx_id_t, /* context_handle */ 381*7f2fe78bSCy Schubert gss_qop_t, /* qop_req */ 382*7f2fe78bSCy Schubert gss_iov_buffer_desc *, /* iov */ 383*7f2fe78bSCy Schubert int); /* iov_count */ 384*7f2fe78bSCy Schubert 385*7f2fe78bSCy Schubert /* 386*7f2fe78bSCy Schubert * Verify the MIC_TOKEN buffer within the iov list against the SIGN_ONLY and 387*7f2fe78bSCy Schubert * DATA buffers in the order they appear. Return values are the same as for 388*7f2fe78bSCy Schubert * gss_verify_mic. 389*7f2fe78bSCy Schubert */ 390*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_verify_mic_iov 391*7f2fe78bSCy Schubert ( 392*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 393*7f2fe78bSCy Schubert gss_ctx_id_t, /* context_handle */ 394*7f2fe78bSCy Schubert gss_qop_t *, /* qop_state */ 395*7f2fe78bSCy Schubert gss_iov_buffer_desc *, /* iov */ 396*7f2fe78bSCy Schubert int); /* iov_count */ 397*7f2fe78bSCy Schubert 398*7f2fe78bSCy Schubert /* 399*7f2fe78bSCy Schubert * Release buffers that have the ALLOCATED flag set. 400*7f2fe78bSCy Schubert */ 401*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_release_iov_buffer 402*7f2fe78bSCy Schubert ( 403*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 404*7f2fe78bSCy Schubert gss_iov_buffer_desc *, /* iov */ 405*7f2fe78bSCy Schubert int); /* iov_count */ 406*7f2fe78bSCy Schubert 407*7f2fe78bSCy Schubert /* 408*7f2fe78bSCy Schubert * Protocol transition 409*7f2fe78bSCy Schubert */ 410*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 411*7f2fe78bSCy Schubert gss_acquire_cred_impersonate_name( 412*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 413*7f2fe78bSCy Schubert const gss_cred_id_t, /* impersonator_cred_handle */ 414*7f2fe78bSCy Schubert const gss_name_t, /* desired_name */ 415*7f2fe78bSCy Schubert OM_uint32, /* time_req */ 416*7f2fe78bSCy Schubert const gss_OID_set, /* desired_mechs */ 417*7f2fe78bSCy Schubert gss_cred_usage_t, /* cred_usage */ 418*7f2fe78bSCy Schubert gss_cred_id_t *, /* output_cred_handle */ 419*7f2fe78bSCy Schubert gss_OID_set *, /* actual_mechs */ 420*7f2fe78bSCy Schubert OM_uint32 *); /* time_rec */ 421*7f2fe78bSCy Schubert 422*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 423*7f2fe78bSCy Schubert gss_add_cred_impersonate_name( 424*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 425*7f2fe78bSCy Schubert gss_cred_id_t, /* input_cred_handle */ 426*7f2fe78bSCy Schubert const gss_cred_id_t, /* impersonator_cred_handle */ 427*7f2fe78bSCy Schubert const gss_name_t, /* desired_name */ 428*7f2fe78bSCy Schubert const gss_OID, /* desired_mech */ 429*7f2fe78bSCy Schubert gss_cred_usage_t, /* cred_usage */ 430*7f2fe78bSCy Schubert OM_uint32, /* initiator_time_req */ 431*7f2fe78bSCy Schubert OM_uint32, /* acceptor_time_req */ 432*7f2fe78bSCy Schubert gss_cred_id_t *, /* output_cred_handle */ 433*7f2fe78bSCy Schubert gss_OID_set *, /* actual_mechs */ 434*7f2fe78bSCy Schubert OM_uint32 *, /* initiator_time_rec */ 435*7f2fe78bSCy Schubert OM_uint32 *); /* acceptor_time_rec */ 436*7f2fe78bSCy Schubert 437*7f2fe78bSCy Schubert /* 438*7f2fe78bSCy Schubert * Naming extensions 439*7f2fe78bSCy Schubert */ 440*7f2fe78bSCy Schubert GSS_DLLIMP extern gss_buffer_t GSS_C_ATTR_LOCAL_LOGIN_USER; 441*7f2fe78bSCy Schubert GSS_DLLIMP extern gss_OID GSS_C_NT_COMPOSITE_EXPORT; 442*7f2fe78bSCy Schubert 443*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_display_name_ext 444*7f2fe78bSCy Schubert ( 445*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 446*7f2fe78bSCy Schubert gss_name_t, /* name */ 447*7f2fe78bSCy Schubert gss_OID, /* display_as_name_type */ 448*7f2fe78bSCy Schubert gss_buffer_t /* display_name */ 449*7f2fe78bSCy Schubert ); 450*7f2fe78bSCy Schubert 451*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_inquire_name 452*7f2fe78bSCy Schubert ( 453*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 454*7f2fe78bSCy Schubert gss_name_t, /* name */ 455*7f2fe78bSCy Schubert int *, /* name_is_MN */ 456*7f2fe78bSCy Schubert gss_OID *, /* MN_mech */ 457*7f2fe78bSCy Schubert gss_buffer_set_t * /* attrs */ 458*7f2fe78bSCy Schubert ); 459*7f2fe78bSCy Schubert 460*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_get_name_attribute 461*7f2fe78bSCy Schubert ( 462*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 463*7f2fe78bSCy Schubert gss_name_t, /* name */ 464*7f2fe78bSCy Schubert gss_buffer_t, /* attr */ 465*7f2fe78bSCy Schubert int *, /* authenticated */ 466*7f2fe78bSCy Schubert int *, /* complete */ 467*7f2fe78bSCy Schubert gss_buffer_t, /* value */ 468*7f2fe78bSCy Schubert gss_buffer_t, /* display_value */ 469*7f2fe78bSCy Schubert int * /* more */ 470*7f2fe78bSCy Schubert ); 471*7f2fe78bSCy Schubert 472*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_set_name_attribute 473*7f2fe78bSCy Schubert ( 474*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 475*7f2fe78bSCy Schubert gss_name_t, /* name */ 476*7f2fe78bSCy Schubert int, /* complete */ 477*7f2fe78bSCy Schubert gss_buffer_t, /* attr */ 478*7f2fe78bSCy Schubert gss_buffer_t /* value */ 479*7f2fe78bSCy Schubert ); 480*7f2fe78bSCy Schubert 481*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_delete_name_attribute 482*7f2fe78bSCy Schubert ( 483*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 484*7f2fe78bSCy Schubert gss_name_t, /* name */ 485*7f2fe78bSCy Schubert gss_buffer_t /* attr */ 486*7f2fe78bSCy Schubert ); 487*7f2fe78bSCy Schubert 488*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_export_name_composite 489*7f2fe78bSCy Schubert ( 490*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 491*7f2fe78bSCy Schubert gss_name_t, /* name */ 492*7f2fe78bSCy Schubert gss_buffer_t /* exp_composite_name */ 493*7f2fe78bSCy Schubert ); 494*7f2fe78bSCy Schubert 495*7f2fe78bSCy Schubert typedef struct gss_any *gss_any_t; 496*7f2fe78bSCy Schubert 497*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_map_name_to_any 498*7f2fe78bSCy Schubert ( 499*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 500*7f2fe78bSCy Schubert gss_name_t, /* name */ 501*7f2fe78bSCy Schubert int, /* authenticated */ 502*7f2fe78bSCy Schubert gss_buffer_t, /* type_id */ 503*7f2fe78bSCy Schubert gss_any_t * /* output */ 504*7f2fe78bSCy Schubert ); 505*7f2fe78bSCy Schubert 506*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_release_any_name_mapping 507*7f2fe78bSCy Schubert ( 508*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 509*7f2fe78bSCy Schubert gss_name_t, /* name */ 510*7f2fe78bSCy Schubert gss_buffer_t, /* type_id */ 511*7f2fe78bSCy Schubert gss_any_t * /* input */ 512*7f2fe78bSCy Schubert ); 513*7f2fe78bSCy Schubert 514*7f2fe78bSCy Schubert /* draft-josefsson-gss-capsulate */ 515*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_encapsulate_token 516*7f2fe78bSCy Schubert ( 517*7f2fe78bSCy Schubert gss_const_buffer_t, /* input_token */ 518*7f2fe78bSCy Schubert gss_const_OID, /* token_oid */ 519*7f2fe78bSCy Schubert gss_buffer_t /* output_token */ 520*7f2fe78bSCy Schubert ); 521*7f2fe78bSCy Schubert 522*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV gss_decapsulate_token 523*7f2fe78bSCy Schubert ( 524*7f2fe78bSCy Schubert gss_const_buffer_t, /* input_token */ 525*7f2fe78bSCy Schubert gss_const_OID, /* token_oid */ 526*7f2fe78bSCy Schubert gss_buffer_t /* output_token */ 527*7f2fe78bSCy Schubert ); 528*7f2fe78bSCy Schubert 529*7f2fe78bSCy Schubert int KRB5_CALLCONV gss_oid_equal 530*7f2fe78bSCy Schubert ( 531*7f2fe78bSCy Schubert gss_const_OID, /* first_oid */ 532*7f2fe78bSCy Schubert gss_const_OID /* second_oid */ 533*7f2fe78bSCy Schubert ); 534*7f2fe78bSCy Schubert 535*7f2fe78bSCy Schubert /* Credential store extensions */ 536*7f2fe78bSCy Schubert 537*7f2fe78bSCy Schubert struct gss_key_value_element_struct { 538*7f2fe78bSCy Schubert const char *key; 539*7f2fe78bSCy Schubert const char *value; 540*7f2fe78bSCy Schubert }; 541*7f2fe78bSCy Schubert typedef struct gss_key_value_element_struct gss_key_value_element_desc; 542*7f2fe78bSCy Schubert 543*7f2fe78bSCy Schubert struct gss_key_value_set_struct { 544*7f2fe78bSCy Schubert OM_uint32 count; 545*7f2fe78bSCy Schubert gss_key_value_element_desc *elements; 546*7f2fe78bSCy Schubert }; 547*7f2fe78bSCy Schubert typedef struct gss_key_value_set_struct gss_key_value_set_desc; 548*7f2fe78bSCy Schubert typedef const gss_key_value_set_desc *gss_const_key_value_set_t; 549*7f2fe78bSCy Schubert 550*7f2fe78bSCy Schubert #define GSS_C_NO_CRED_STORE ((gss_const_key_value_set_t) 0) 551*7f2fe78bSCy Schubert 552*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 553*7f2fe78bSCy Schubert gss_acquire_cred_from( 554*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 555*7f2fe78bSCy Schubert gss_name_t, /* desired_name */ 556*7f2fe78bSCy Schubert OM_uint32, /* time_req */ 557*7f2fe78bSCy Schubert gss_OID_set, /* desired_mechs */ 558*7f2fe78bSCy Schubert gss_cred_usage_t, /* cred_usage */ 559*7f2fe78bSCy Schubert gss_const_key_value_set_t, /* cred_store */ 560*7f2fe78bSCy Schubert gss_cred_id_t *, /* output_cred_handle */ 561*7f2fe78bSCy Schubert gss_OID_set *, /* actual_mechs */ 562*7f2fe78bSCy Schubert OM_uint32 *); /* time_rec */ 563*7f2fe78bSCy Schubert 564*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 565*7f2fe78bSCy Schubert gss_add_cred_from( 566*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 567*7f2fe78bSCy Schubert gss_cred_id_t, /* input_cred_handle */ 568*7f2fe78bSCy Schubert gss_name_t, /* desired_name */ 569*7f2fe78bSCy Schubert gss_OID, /* desired_mech */ 570*7f2fe78bSCy Schubert gss_cred_usage_t, /* cred_usage */ 571*7f2fe78bSCy Schubert OM_uint32, /* initiator_time_req */ 572*7f2fe78bSCy Schubert OM_uint32, /* acceptor_time_req */ 573*7f2fe78bSCy Schubert gss_const_key_value_set_t, /* cred_store */ 574*7f2fe78bSCy Schubert gss_cred_id_t *, /* output_cred_handle */ 575*7f2fe78bSCy Schubert gss_OID_set *, /* actual_mechs */ 576*7f2fe78bSCy Schubert OM_uint32 *, /* initiator_time_rec */ 577*7f2fe78bSCy Schubert OM_uint32 *); /* acceptor_time_rec */ 578*7f2fe78bSCy Schubert 579*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 580*7f2fe78bSCy Schubert gss_store_cred_into( 581*7f2fe78bSCy Schubert OM_uint32 *, /* minor_status */ 582*7f2fe78bSCy Schubert gss_cred_id_t, /* input_cred_handle */ 583*7f2fe78bSCy Schubert gss_cred_usage_t, /* input_usage */ 584*7f2fe78bSCy Schubert gss_OID, /* desired_mech */ 585*7f2fe78bSCy Schubert OM_uint32, /* overwrite_cred */ 586*7f2fe78bSCy Schubert OM_uint32, /* default_cred */ 587*7f2fe78bSCy Schubert gss_const_key_value_set_t, /* cred_store */ 588*7f2fe78bSCy Schubert gss_OID_set *, /* elements_stored */ 589*7f2fe78bSCy Schubert gss_cred_usage_t *); /* cred_usage_stored */ 590*7f2fe78bSCy Schubert 591*7f2fe78bSCy Schubert /* 592*7f2fe78bSCy Schubert * A mech can make itself negotiable via NegoEx (draft-zhu-negoex) by 593*7f2fe78bSCy Schubert * implementing the following three SPIs, and also implementing 594*7f2fe78bSCy Schubert * gss_inquire_sec_context_by_oid() and answering the GSS_C_INQ_NEGOEX_KEY and 595*7f2fe78bSCy Schubert * GSS_C_INQ_NEGOEX_VERIFY_KEY OIDs. The answer must be in two buffers: the 596*7f2fe78bSCy Schubert * first contains the key contents, and the second contains the key enctype as 597*7f2fe78bSCy Schubert * a four-byte little-endian integer. 598*7f2fe78bSCy Schubert * 599*7f2fe78bSCy Schubert * By default, NegoEx mechanisms will not be directly negotiated via SPNEGO. 600*7f2fe78bSCy Schubert * If direct SPNEGO negotiation is required for interoperability, implement 601*7f2fe78bSCy Schubert * gss_inquire_attrs_for_mech() and assert the GSS_C_MA_NEGOEX_AND_SPNEGO 602*7f2fe78bSCy Schubert * attribute (along with any applicable RFC 5587 attributes). 603*7f2fe78bSCy Schubert */ 604*7f2fe78bSCy Schubert 605*7f2fe78bSCy Schubert #define GSS_C_CHANNEL_BOUND_FLAG 2048 /* 0x00000800 */ 606*7f2fe78bSCy Schubert 607*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 608*7f2fe78bSCy Schubert gssspi_query_meta_data( 609*7f2fe78bSCy Schubert OM_uint32 *minor_status, 610*7f2fe78bSCy Schubert gss_const_OID mech_oid, 611*7f2fe78bSCy Schubert gss_cred_id_t cred_handle, 612*7f2fe78bSCy Schubert gss_ctx_id_t *context_handle, 613*7f2fe78bSCy Schubert const gss_name_t targ_name, 614*7f2fe78bSCy Schubert OM_uint32 req_flags, 615*7f2fe78bSCy Schubert gss_buffer_t meta_data); 616*7f2fe78bSCy Schubert 617*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 618*7f2fe78bSCy Schubert gssspi_exchange_meta_data( 619*7f2fe78bSCy Schubert OM_uint32 *minor_status, 620*7f2fe78bSCy Schubert gss_const_OID mech_oid, 621*7f2fe78bSCy Schubert gss_cred_id_t cred_handle, 622*7f2fe78bSCy Schubert gss_ctx_id_t *context_handle, 623*7f2fe78bSCy Schubert const gss_name_t targ_name, 624*7f2fe78bSCy Schubert OM_uint32 req_flags, 625*7f2fe78bSCy Schubert gss_const_buffer_t meta_data); 626*7f2fe78bSCy Schubert 627*7f2fe78bSCy Schubert OM_uint32 KRB5_CALLCONV 628*7f2fe78bSCy Schubert gssspi_query_mechanism_info( 629*7f2fe78bSCy Schubert OM_uint32 *minor_status, 630*7f2fe78bSCy Schubert gss_const_OID mech_oid, 631*7f2fe78bSCy Schubert unsigned char auth_scheme[16]); 632*7f2fe78bSCy Schubert 633*7f2fe78bSCy Schubert GSS_DLLIMP extern gss_const_OID GSS_C_MA_NEGOEX_AND_SPNEGO; 634*7f2fe78bSCy Schubert 635*7f2fe78bSCy Schubert #ifdef __cplusplus 636*7f2fe78bSCy Schubert } 637*7f2fe78bSCy Schubert #endif 638*7f2fe78bSCy Schubert 639*7f2fe78bSCy Schubert /* 640*7f2fe78bSCy Schubert * When used with gss_inquire_sec_context_by_oid(), return a buffer set with 641*7f2fe78bSCy Schubert * the first member containing an unsigned 32-bit integer in network byte 642*7f2fe78bSCy Schubert * order. This is the Security Strength Factor (SSF) associated with the 643*7f2fe78bSCy Schubert * secure channel established by the security context. NOTE: This value is 644*7f2fe78bSCy Schubert * made available solely as an indication for use by APIs like Cyrus SASL that 645*7f2fe78bSCy Schubert * classify the strength of a secure channel via this number. The strength of 646*7f2fe78bSCy Schubert * a channel cannot necessarily be represented by a simple number. 647*7f2fe78bSCy Schubert */ 648*7f2fe78bSCy Schubert GSS_DLLIMP extern gss_OID GSS_C_SEC_CONTEXT_SASL_SSF; 649*7f2fe78bSCy Schubert 650*7f2fe78bSCy Schubert #endif /* GSSAPI_EXT_H_ */ 651