1a9148abdSDoug Rabson /* 2a9148abdSDoug Rabson * Copyright (C) The Internet Society (2000). All Rights Reserved. 3a9148abdSDoug Rabson * 4a9148abdSDoug Rabson * This document and translations of it may be copied and furnished to 5a9148abdSDoug Rabson * others, and derivative works that comment on or otherwise explain it 6a9148abdSDoug Rabson * or assist in its implementation may be prepared, copied, published 7a9148abdSDoug Rabson * and distributed, in whole or in part, without restriction of any 8a9148abdSDoug Rabson * kind, provided that the above copyright notice and this paragraph are 9a9148abdSDoug Rabson * included on all such copies and derivative works. However, this 10a9148abdSDoug Rabson * document itself may not be modified in any way, such as by removing 11a9148abdSDoug Rabson * the copyright notice or references to the Internet Society or other 12a9148abdSDoug Rabson * Internet organizations, except as needed for the purpose of 13a9148abdSDoug Rabson * developing Internet standards in which case the procedures for 14a9148abdSDoug Rabson * copyrights defined in the Internet Standards process must be 15a9148abdSDoug Rabson * followed, or as required to translate it into languages other than 16a9148abdSDoug Rabson * English. 17a9148abdSDoug Rabson * 18a9148abdSDoug Rabson * The limited permissions granted above are perpetual and will not be 19a9148abdSDoug Rabson * revoked by the Internet Society or its successors or assigns. 20a9148abdSDoug Rabson * 21a9148abdSDoug Rabson * This document and the information contained herein is provided on an 22a9148abdSDoug Rabson * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING 23a9148abdSDoug Rabson * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 24a9148abdSDoug Rabson * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION 25a9148abdSDoug Rabson * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF 26a9148abdSDoug Rabson * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 27a9148abdSDoug Rabson */ 28a9148abdSDoug Rabson 29a9148abdSDoug Rabson #ifndef _KGSSAPI_GSSAPI_H_ 30a9148abdSDoug Rabson #define _KGSSAPI_GSSAPI_H_ 31a9148abdSDoug Rabson 32a9148abdSDoug Rabson /* 33a9148abdSDoug Rabson * A cut-down version of the GSS-API for in-kernel use 34a9148abdSDoug Rabson */ 35a9148abdSDoug Rabson 36a9148abdSDoug Rabson /* 37a9148abdSDoug Rabson * Now define the three implementation-dependent types. 38a9148abdSDoug Rabson */ 39a9148abdSDoug Rabson typedef struct _gss_ctx_id_t *gss_ctx_id_t; 40a9148abdSDoug Rabson typedef struct _gss_cred_id_t *gss_cred_id_t; 41a9148abdSDoug Rabson typedef struct _gss_name_t *gss_name_t; 42a9148abdSDoug Rabson 43a9148abdSDoug Rabson /* 44a9148abdSDoug Rabson * We can't use X/Open definitions, so roll our own. 45a9148abdSDoug Rabson */ 46a9148abdSDoug Rabson typedef uint32_t OM_uint32; 47a9148abdSDoug Rabson typedef uint64_t OM_uint64; 48a9148abdSDoug Rabson 49a9148abdSDoug Rabson typedef struct gss_OID_desc_struct { 50a9148abdSDoug Rabson OM_uint32 length; 51a9148abdSDoug Rabson void *elements; 52a9148abdSDoug Rabson } gss_OID_desc, *gss_OID; 53a9148abdSDoug Rabson 54a9148abdSDoug Rabson typedef struct gss_OID_set_desc_struct { 55a9148abdSDoug Rabson size_t count; 56a9148abdSDoug Rabson gss_OID elements; 57a9148abdSDoug Rabson } gss_OID_set_desc, *gss_OID_set; 58a9148abdSDoug Rabson 59a9148abdSDoug Rabson typedef struct gss_buffer_desc_struct { 60a9148abdSDoug Rabson size_t length; 61a9148abdSDoug Rabson void *value; 62a9148abdSDoug Rabson } gss_buffer_desc, *gss_buffer_t; 63a9148abdSDoug Rabson 64a9148abdSDoug Rabson typedef struct gss_channel_bindings_struct { 65a9148abdSDoug Rabson OM_uint32 initiator_addrtype; 66a9148abdSDoug Rabson gss_buffer_desc initiator_address; 67a9148abdSDoug Rabson OM_uint32 acceptor_addrtype; 68a9148abdSDoug Rabson gss_buffer_desc acceptor_address; 69a9148abdSDoug Rabson gss_buffer_desc application_data; 70a9148abdSDoug Rabson } *gss_channel_bindings_t; 71a9148abdSDoug Rabson 72a9148abdSDoug Rabson /* 73a9148abdSDoug Rabson * For now, define a QOP-type as an OM_uint32 74a9148abdSDoug Rabson */ 75a9148abdSDoug Rabson typedef OM_uint32 gss_qop_t; 76a9148abdSDoug Rabson 77a9148abdSDoug Rabson typedef int gss_cred_usage_t; 78a9148abdSDoug Rabson 79a9148abdSDoug Rabson /* 80a9148abdSDoug Rabson * Flag bits for context-level services. 81a9148abdSDoug Rabson */ 82a9148abdSDoug Rabson #define GSS_C_DELEG_FLAG 1 83a9148abdSDoug Rabson #define GSS_C_MUTUAL_FLAG 2 84a9148abdSDoug Rabson #define GSS_C_REPLAY_FLAG 4 85a9148abdSDoug Rabson #define GSS_C_SEQUENCE_FLAG 8 86a9148abdSDoug Rabson #define GSS_C_CONF_FLAG 16 87a9148abdSDoug Rabson #define GSS_C_INTEG_FLAG 32 88a9148abdSDoug Rabson #define GSS_C_ANON_FLAG 64 89a9148abdSDoug Rabson #define GSS_C_PROT_READY_FLAG 128 90a9148abdSDoug Rabson #define GSS_C_TRANS_FLAG 256 91a9148abdSDoug Rabson 92a9148abdSDoug Rabson /* 93a9148abdSDoug Rabson * Credential usage options 94a9148abdSDoug Rabson */ 95a9148abdSDoug Rabson #define GSS_C_BOTH 0 96a9148abdSDoug Rabson #define GSS_C_INITIATE 1 97a9148abdSDoug Rabson #define GSS_C_ACCEPT 2 98a9148abdSDoug Rabson 99a9148abdSDoug Rabson /* 100a9148abdSDoug Rabson * Status code types for gss_display_status 101a9148abdSDoug Rabson */ 102a9148abdSDoug Rabson #define GSS_C_GSS_CODE 1 103a9148abdSDoug Rabson #define GSS_C_MECH_CODE 2 104a9148abdSDoug Rabson 105a9148abdSDoug Rabson /* 106a9148abdSDoug Rabson * The constant definitions for channel-bindings address families 107a9148abdSDoug Rabson */ 108a9148abdSDoug Rabson #define GSS_C_AF_UNSPEC 0 109a9148abdSDoug Rabson #define GSS_C_AF_LOCAL 1 110a9148abdSDoug Rabson #define GSS_C_AF_INET 2 111a9148abdSDoug Rabson #define GSS_C_AF_IMPLINK 3 112a9148abdSDoug Rabson #define GSS_C_AF_PUP 4 113a9148abdSDoug Rabson #define GSS_C_AF_CHAOS 5 114a9148abdSDoug Rabson #define GSS_C_AF_NS 6 115a9148abdSDoug Rabson #define GSS_C_AF_NBS 7 116a9148abdSDoug Rabson #define GSS_C_AF_ECMA 8 117a9148abdSDoug Rabson #define GSS_C_AF_DATAKIT 9 118a9148abdSDoug Rabson #define GSS_C_AF_CCITT 10 119a9148abdSDoug Rabson #define GSS_C_AF_SNA 11 120a9148abdSDoug Rabson #define GSS_C_AF_DECnet 12 121a9148abdSDoug Rabson #define GSS_C_AF_DLI 13 122a9148abdSDoug Rabson #define GSS_C_AF_LAT 14 123a9148abdSDoug Rabson #define GSS_C_AF_HYLINK 15 124a9148abdSDoug Rabson #define GSS_C_AF_APPLETALK 16 125a9148abdSDoug Rabson #define GSS_C_AF_BSC 17 126a9148abdSDoug Rabson #define GSS_C_AF_DSS 18 127a9148abdSDoug Rabson #define GSS_C_AF_OSI 19 128a9148abdSDoug Rabson #define GSS_C_AF_X25 21 129a9148abdSDoug Rabson #define GSS_C_AF_NULLADDR 255 130a9148abdSDoug Rabson 131a9148abdSDoug Rabson /* 132a9148abdSDoug Rabson * Various Null values 133a9148abdSDoug Rabson */ 134a9148abdSDoug Rabson #define GSS_C_NO_NAME ((gss_name_t) 0) 135a9148abdSDoug Rabson #define GSS_C_NO_BUFFER ((gss_buffer_t) 0) 136a9148abdSDoug Rabson #define GSS_C_NO_OID ((gss_OID) 0) 137a9148abdSDoug Rabson #define GSS_C_NO_OID_SET ((gss_OID_set) 0) 138a9148abdSDoug Rabson #define GSS_C_NO_CONTEXT ((gss_ctx_id_t) 0) 139a9148abdSDoug Rabson #define GSS_C_NO_CREDENTIAL ((gss_cred_id_t) 0) 140a9148abdSDoug Rabson #define GSS_C_NO_CHANNEL_BINDINGS ((gss_channel_bindings_t) 0) 141a9148abdSDoug Rabson #define GSS_C_EMPTY_BUFFER {0, NULL} 142a9148abdSDoug Rabson 143a9148abdSDoug Rabson /* 144a9148abdSDoug Rabson * Some alternate names for a couple of the above 145a9148abdSDoug Rabson * values. These are defined for V1 compatibility. 146a9148abdSDoug Rabson */ 147a9148abdSDoug Rabson #define GSS_C_NULL_OID GSS_C_NO_OID 148a9148abdSDoug Rabson #define GSS_C_NULL_OID_SET GSS_C_NO_OID_SET 149a9148abdSDoug Rabson 150a9148abdSDoug Rabson /* 151a9148abdSDoug Rabson * Define the default Quality of Protection for per-message 152a9148abdSDoug Rabson * services. Note that an implementation that offers multiple 153a9148abdSDoug Rabson * levels of QOP may define GSS_C_QOP_DEFAULT to be either zero 154a9148abdSDoug Rabson * (as done here) to mean "default protection", or to a specific 155a9148abdSDoug Rabson * explicit QOP value. However, a value of 0 should always be 156a9148abdSDoug Rabson * interpreted by a GSS-API implementation as a request for the 157a9148abdSDoug Rabson * default protection level. 158a9148abdSDoug Rabson */ 159a9148abdSDoug Rabson #define GSS_C_QOP_DEFAULT 0 160a9148abdSDoug Rabson 161a9148abdSDoug Rabson /* 162a9148abdSDoug Rabson * Expiration time of 2^32-1 seconds means infinite lifetime for a 163a9148abdSDoug Rabson * credential or security context 164a9148abdSDoug Rabson */ 165a9148abdSDoug Rabson #define GSS_C_INDEFINITE 0xfffffffful 166a9148abdSDoug Rabson 167a9148abdSDoug Rabson /* 168a9148abdSDoug Rabson * The implementation must reserve static storage for a 169a9148abdSDoug Rabson * gss_OID_desc object containing the value 170a9148abdSDoug Rabson * {10, (void *)"\x2a\x86\x48\x86\xf7\x12" 171a9148abdSDoug Rabson * "\x01\x02\x01\x01"}, 172a9148abdSDoug Rabson * corresponding to an object-identifier value of 173a9148abdSDoug Rabson * {iso(1) member-body(2) United States(840) mit(113554) 174a9148abdSDoug Rabson * infosys(1) gssapi(2) generic(1) user_name(1)}. The constant 175a9148abdSDoug Rabson * GSS_C_NT_USER_NAME should be initialized to point 176a9148abdSDoug Rabson * to that gss_OID_desc. 177a9148abdSDoug Rabson */ 178a9148abdSDoug Rabson extern gss_OID GSS_C_NT_USER_NAME; 179a9148abdSDoug Rabson 180a9148abdSDoug Rabson /* 181a9148abdSDoug Rabson * The implementation must reserve static storage for a 182a9148abdSDoug Rabson * gss_OID_desc object containing the value 183a9148abdSDoug Rabson * {10, (void *)"\x2a\x86\x48\x86\xf7\x12" 184a9148abdSDoug Rabson * "\x01\x02\x01\x02"}, 185a9148abdSDoug Rabson * corresponding to an object-identifier value of 186a9148abdSDoug Rabson * {iso(1) member-body(2) United States(840) mit(113554) 187a9148abdSDoug Rabson * infosys(1) gssapi(2) generic(1) machine_uid_name(2)}. 188a9148abdSDoug Rabson * The constant GSS_C_NT_MACHINE_UID_NAME should be 189a9148abdSDoug Rabson * initialized to point to that gss_OID_desc. 190a9148abdSDoug Rabson */ 191a9148abdSDoug Rabson extern gss_OID GSS_C_NT_MACHINE_UID_NAME; 192a9148abdSDoug Rabson 193a9148abdSDoug Rabson /* 194a9148abdSDoug Rabson * The implementation must reserve static storage for a 195a9148abdSDoug Rabson * gss_OID_desc object containing the value 196a9148abdSDoug Rabson * {10, (void *)"\x2a\x86\x48\x86\xf7\x12" 197a9148abdSDoug Rabson * "\x01\x02\x01\x03"}, 198a9148abdSDoug Rabson * corresponding to an object-identifier value of 199a9148abdSDoug Rabson * {iso(1) member-body(2) United States(840) mit(113554) 200a9148abdSDoug Rabson * infosys(1) gssapi(2) generic(1) string_uid_name(3)}. 201a9148abdSDoug Rabson * The constant GSS_C_NT_STRING_UID_NAME should be 202a9148abdSDoug Rabson * initialized to point to that gss_OID_desc. 203a9148abdSDoug Rabson */ 204a9148abdSDoug Rabson extern gss_OID GSS_C_NT_STRING_UID_NAME; 205a9148abdSDoug Rabson 206a9148abdSDoug Rabson /* 207a9148abdSDoug Rabson * The implementation must reserve static storage for a 208a9148abdSDoug Rabson * gss_OID_desc object containing the value 209a9148abdSDoug Rabson * {6, (void *)"\x2b\x06\x01\x05\x06\x02"}, 210a9148abdSDoug Rabson * corresponding to an object-identifier value of 211a9148abdSDoug Rabson * {iso(1) org(3) dod(6) internet(1) security(5) 212a9148abdSDoug Rabson * nametypes(6) gss-host-based-services(2)). The constant 213a9148abdSDoug Rabson * GSS_C_NT_HOSTBASED_SERVICE_X should be initialized to point 214a9148abdSDoug Rabson * to that gss_OID_desc. This is a deprecated OID value, and 215a9148abdSDoug Rabson * implementations wishing to support hostbased-service names 216a9148abdSDoug Rabson * should instead use the GSS_C_NT_HOSTBASED_SERVICE OID, 217a9148abdSDoug Rabson * defined below, to identify such names; 218a9148abdSDoug Rabson * GSS_C_NT_HOSTBASED_SERVICE_X should be accepted a synonym 219a9148abdSDoug Rabson * for GSS_C_NT_HOSTBASED_SERVICE when presented as an input 220a9148abdSDoug Rabson * parameter, but should not be emitted by GSS-API 221a9148abdSDoug Rabson * implementations 222a9148abdSDoug Rabson */ 223a9148abdSDoug Rabson extern gss_OID GSS_C_NT_HOSTBASED_SERVICE_X; 224a9148abdSDoug Rabson 225a9148abdSDoug Rabson /* 226a9148abdSDoug Rabson * The implementation must reserve static storage for a 227a9148abdSDoug Rabson * gss_OID_desc object containing the value 228a9148abdSDoug Rabson * {10, (void *)"\x2a\x86\x48\x86\xf7\x12" 229a9148abdSDoug Rabson * "\x01\x02\x01\x04"}, corresponding to an 230a9148abdSDoug Rabson * object-identifier value of {iso(1) member-body(2) 231a9148abdSDoug Rabson * Unites States(840) mit(113554) infosys(1) gssapi(2) 232a9148abdSDoug Rabson * generic(1) service_name(4)}. The constant 233a9148abdSDoug Rabson * GSS_C_NT_HOSTBASED_SERVICE should be initialized 234a9148abdSDoug Rabson * to point to that gss_OID_desc. 235a9148abdSDoug Rabson */ 236a9148abdSDoug Rabson extern gss_OID GSS_C_NT_HOSTBASED_SERVICE; 237a9148abdSDoug Rabson 238a9148abdSDoug Rabson /* 239a9148abdSDoug Rabson * The implementation must reserve static storage for a 240a9148abdSDoug Rabson * gss_OID_desc object containing the value 241a9148abdSDoug Rabson * {6, (void *)"\x2b\x06\01\x05\x06\x03"}, 242a9148abdSDoug Rabson * corresponding to an object identifier value of 243a9148abdSDoug Rabson * {1(iso), 3(org), 6(dod), 1(internet), 5(security), 244a9148abdSDoug Rabson * 6(nametypes), 3(gss-anonymous-name)}. The constant 245a9148abdSDoug Rabson * and GSS_C_NT_ANONYMOUS should be initialized to point 246a9148abdSDoug Rabson * to that gss_OID_desc. 247a9148abdSDoug Rabson */ 248a9148abdSDoug Rabson extern gss_OID GSS_C_NT_ANONYMOUS; 249a9148abdSDoug Rabson 250a9148abdSDoug Rabson /* 251a9148abdSDoug Rabson * The implementation must reserve static storage for a 252a9148abdSDoug Rabson * gss_OID_desc object containing the value 253a9148abdSDoug Rabson * {6, (void *)"\x2b\x06\x01\x05\x06\x04"}, 254a9148abdSDoug Rabson * corresponding to an object-identifier value of 255a9148abdSDoug Rabson * {1(iso), 3(org), 6(dod), 1(internet), 5(security), 256a9148abdSDoug Rabson * 6(nametypes), 4(gss-api-exported-name)}. The constant 257a9148abdSDoug Rabson * GSS_C_NT_EXPORT_NAME should be initialized to point 258a9148abdSDoug Rabson * to that gss_OID_desc. 259a9148abdSDoug Rabson */ 260a9148abdSDoug Rabson extern gss_OID GSS_C_NT_EXPORT_NAME; 261a9148abdSDoug Rabson 262a9148abdSDoug Rabson /* 263a9148abdSDoug Rabson * This name form shall be represented by the Object Identifier {iso(1) 264a9148abdSDoug Rabson * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) 265a9148abdSDoug Rabson * krb5(2) krb5_name(1)}. The recommended symbolic name for this type 266a9148abdSDoug Rabson * is "GSS_KRB5_NT_PRINCIPAL_NAME". 267a9148abdSDoug Rabson */ 268a9148abdSDoug Rabson extern gss_OID GSS_KRB5_NT_PRINCIPAL_NAME; 269a9148abdSDoug Rabson 270a9148abdSDoug Rabson /* 271a9148abdSDoug Rabson * This name form shall be represented by the Object Identifier {iso(1) 272a9148abdSDoug Rabson * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) 273a9148abdSDoug Rabson * generic(1) user_name(1)}. The recommended symbolic name for this 274a9148abdSDoug Rabson * type is "GSS_KRB5_NT_USER_NAME". 275a9148abdSDoug Rabson */ 276a9148abdSDoug Rabson extern gss_OID GSS_KRB5_NT_USER_NAME; 277a9148abdSDoug Rabson 278a9148abdSDoug Rabson /* 279a9148abdSDoug Rabson * This name form shall be represented by the Object Identifier {iso(1) 280a9148abdSDoug Rabson * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) 281a9148abdSDoug Rabson * generic(1) machine_uid_name(2)}. The recommended symbolic name for 282a9148abdSDoug Rabson * this type is "GSS_KRB5_NT_MACHINE_UID_NAME". 283a9148abdSDoug Rabson */ 284a9148abdSDoug Rabson extern gss_OID GSS_KRB5_NT_MACHINE_UID_NAME; 285a9148abdSDoug Rabson 286a9148abdSDoug Rabson /* 287a9148abdSDoug Rabson * This name form shall be represented by the Object Identifier {iso(1) 288a9148abdSDoug Rabson * member-body(2) United States(840) mit(113554) infosys(1) gssapi(2) 289a9148abdSDoug Rabson * generic(1) string_uid_name(3)}. The recommended symbolic name for 290a9148abdSDoug Rabson * this type is "GSS_KRB5_NT_STRING_UID_NAME". 291a9148abdSDoug Rabson */ 292a9148abdSDoug Rabson extern gss_OID GSS_KRB5_NT_STRING_UID_NAME; 293a9148abdSDoug Rabson 294a9148abdSDoug Rabson /* Major status codes */ 295a9148abdSDoug Rabson 296a9148abdSDoug Rabson #define GSS_S_COMPLETE 0 297a9148abdSDoug Rabson 298a9148abdSDoug Rabson /* 299a9148abdSDoug Rabson * Some "helper" definitions to make the status code macros obvious. 300a9148abdSDoug Rabson */ 301a9148abdSDoug Rabson #define GSS_C_CALLING_ERROR_OFFSET 24 302a9148abdSDoug Rabson #define GSS_C_ROUTINE_ERROR_OFFSET 16 303a9148abdSDoug Rabson #define GSS_C_SUPPLEMENTARY_OFFSET 0 304a9148abdSDoug Rabson #define GSS_C_CALLING_ERROR_MASK 0377ul 305a9148abdSDoug Rabson #define GSS_C_ROUTINE_ERROR_MASK 0377ul 306a9148abdSDoug Rabson #define GSS_C_SUPPLEMENTARY_MASK 0177777ul 307a9148abdSDoug Rabson 308a9148abdSDoug Rabson /* 309a9148abdSDoug Rabson * The macros that test status codes for error conditions. 310a9148abdSDoug Rabson * Note that the GSS_ERROR() macro has changed slightly from 311a9148abdSDoug Rabson * the V1 GSS-API so that it now evaluates its argument 312a9148abdSDoug Rabson * only once. 313a9148abdSDoug Rabson */ 314a9148abdSDoug Rabson #define GSS_CALLING_ERROR(x) \ 315a9148abdSDoug Rabson (x & (GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET)) 316a9148abdSDoug Rabson #define GSS_ROUTINE_ERROR(x) \ 317a9148abdSDoug Rabson (x & (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET)) 318a9148abdSDoug Rabson #define GSS_SUPPLEMENTARY_INFO(x) \ 319a9148abdSDoug Rabson (x & (GSS_C_SUPPLEMENTARY_MASK << GSS_C_SUPPLEMENTARY_OFFSET)) 320a9148abdSDoug Rabson #define GSS_ERROR(x) \ 321a9148abdSDoug Rabson (x & ((GSS_C_CALLING_ERROR_MASK << GSS_C_CALLING_ERROR_OFFSET) | \ 322a9148abdSDoug Rabson (GSS_C_ROUTINE_ERROR_MASK << GSS_C_ROUTINE_ERROR_OFFSET))) 323a9148abdSDoug Rabson 324a9148abdSDoug Rabson /* 325a9148abdSDoug Rabson * Now the actual status code definitions 326a9148abdSDoug Rabson */ 327a9148abdSDoug Rabson 328a9148abdSDoug Rabson /* 329a9148abdSDoug Rabson * Calling errors: 330a9148abdSDoug Rabson */ 331a9148abdSDoug Rabson #define GSS_S_CALL_INACCESSIBLE_READ \ 332a9148abdSDoug Rabson (1ul << GSS_C_CALLING_ERROR_OFFSET) 333a9148abdSDoug Rabson #define GSS_S_CALL_INACCESSIBLE_WRITE \ 334a9148abdSDoug Rabson (2ul << GSS_C_CALLING_ERROR_OFFSET) 335a9148abdSDoug Rabson #define GSS_S_CALL_BAD_STRUCTURE \ 336a9148abdSDoug Rabson (3ul << GSS_C_CALLING_ERROR_OFFSET) 337a9148abdSDoug Rabson 338a9148abdSDoug Rabson /* 339a9148abdSDoug Rabson * Routine errors: 340a9148abdSDoug Rabson */ 341a9148abdSDoug Rabson #define GSS_S_BAD_MECH (1ul << GSS_C_ROUTINE_ERROR_OFFSET) 342a9148abdSDoug Rabson #define GSS_S_BAD_NAME (2ul << GSS_C_ROUTINE_ERROR_OFFSET) 343a9148abdSDoug Rabson #define GSS_S_BAD_NAMETYPE (3ul << GSS_C_ROUTINE_ERROR_OFFSET) 344a9148abdSDoug Rabson #define GSS_S_BAD_BINDINGS (4ul << GSS_C_ROUTINE_ERROR_OFFSET) 345a9148abdSDoug Rabson #define GSS_S_BAD_STATUS (5ul << GSS_C_ROUTINE_ERROR_OFFSET) 346a9148abdSDoug Rabson #define GSS_S_BAD_SIG (6ul << GSS_C_ROUTINE_ERROR_OFFSET) 347a9148abdSDoug Rabson #define GSS_S_BAD_MIC GSS_S_BAD_SIG 348a9148abdSDoug Rabson #define GSS_S_NO_CRED (7ul << GSS_C_ROUTINE_ERROR_OFFSET) 349a9148abdSDoug Rabson #define GSS_S_NO_CONTEXT (8ul << GSS_C_ROUTINE_ERROR_OFFSET) 350a9148abdSDoug Rabson #define GSS_S_DEFECTIVE_TOKEN (9ul << GSS_C_ROUTINE_ERROR_OFFSET) 351a9148abdSDoug Rabson #define GSS_S_DEFECTIVE_CREDENTIAL (10ul << GSS_C_ROUTINE_ERROR_OFFSET) 352a9148abdSDoug Rabson #define GSS_S_CREDENTIALS_EXPIRED (11ul << GSS_C_ROUTINE_ERROR_OFFSET) 353a9148abdSDoug Rabson #define GSS_S_CONTEXT_EXPIRED (12ul << GSS_C_ROUTINE_ERROR_OFFSET) 354a9148abdSDoug Rabson #define GSS_S_FAILURE (13ul << GSS_C_ROUTINE_ERROR_OFFSET) 355a9148abdSDoug Rabson #define GSS_S_BAD_QOP (14ul << GSS_C_ROUTINE_ERROR_OFFSET) 356a9148abdSDoug Rabson #define GSS_S_UNAUTHORIZED (15ul << GSS_C_ROUTINE_ERROR_OFFSET) 357a9148abdSDoug Rabson #define GSS_S_UNAVAILABLE (16ul << GSS_C_ROUTINE_ERROR_OFFSET) 358a9148abdSDoug Rabson #define GSS_S_DUPLICATE_ELEMENT (17ul << GSS_C_ROUTINE_ERROR_OFFSET) 359a9148abdSDoug Rabson #define GSS_S_NAME_NOT_MN (18ul << GSS_C_ROUTINE_ERROR_OFFSET) 360a9148abdSDoug Rabson 361a9148abdSDoug Rabson /* 362a9148abdSDoug Rabson * Supplementary info bits: 363a9148abdSDoug Rabson */ 364a9148abdSDoug Rabson #define GSS_S_CONTINUE_NEEDED \ 365a9148abdSDoug Rabson (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 0)) 366a9148abdSDoug Rabson #define GSS_S_DUPLICATE_TOKEN \ 367a9148abdSDoug Rabson (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 1)) 368a9148abdSDoug Rabson #define GSS_S_OLD_TOKEN \ 369a9148abdSDoug Rabson (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 2)) 370a9148abdSDoug Rabson #define GSS_S_UNSEQ_TOKEN \ 371a9148abdSDoug Rabson (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 3)) 372a9148abdSDoug Rabson #define GSS_S_GAP_TOKEN \ 373a9148abdSDoug Rabson (1ul << (GSS_C_SUPPLEMENTARY_OFFSET + 4)) 374a9148abdSDoug Rabson 375*dd7d42a1SRick Macklem /* 376*dd7d42a1SRick Macklem * NI_MAXSERV and NI_MAXHOST. The srv_principal argument for 377*dd7d42a1SRick Macklem * rpc_gss_ip_to_srv_principal should point to at least 378*dd7d42a1SRick Macklem * NI_MAXSERV + NI_MAXHOST + 1 bytes of storage. The "+ 1" is for the '@'. 379*dd7d42a1SRick Macklem * The NI_MAXHOST limit is checked for gss_ip_to_dns(). 380*dd7d42a1SRick Macklem * These should be set to the same value as they are in <netdb.h>. 381*dd7d42a1SRick Macklem */ 382*dd7d42a1SRick Macklem #ifndef NI_MAXHOST 383*dd7d42a1SRick Macklem #define NI_MAXSERV 32 384*dd7d42a1SRick Macklem #define NI_MAXHOST 1025 385*dd7d42a1SRick Macklem #endif 386*dd7d42a1SRick Macklem 387a9148abdSDoug Rabson __BEGIN_DECLS 388a9148abdSDoug Rabson 389a9148abdSDoug Rabson /* 390a9148abdSDoug Rabson * Finally, function prototypes for the GSS-API routines. 391a9148abdSDoug Rabson */ 392a9148abdSDoug Rabson OM_uint32 gss_acquire_cred 393a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 394a9148abdSDoug Rabson const gss_name_t, /* desired_name */ 395a9148abdSDoug Rabson OM_uint32, /* time_req */ 396a9148abdSDoug Rabson const gss_OID_set, /* desired_mechs */ 397a9148abdSDoug Rabson gss_cred_usage_t, /* cred_usage */ 398a9148abdSDoug Rabson gss_cred_id_t *, /* output_cred_handle */ 399a9148abdSDoug Rabson gss_OID_set *, /* actual_mechs */ 400a9148abdSDoug Rabson OM_uint32 * /* time_rec */ 401a9148abdSDoug Rabson ); 402a9148abdSDoug Rabson 403a9148abdSDoug Rabson OM_uint32 gss_release_cred 404a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 405a9148abdSDoug Rabson gss_cred_id_t * /* cred_handle */ 406a9148abdSDoug Rabson ); 407a9148abdSDoug Rabson 408a9148abdSDoug Rabson OM_uint32 gss_init_sec_context 409a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 410a9148abdSDoug Rabson const gss_cred_id_t, /* initiator_cred_handle */ 411a9148abdSDoug Rabson gss_ctx_id_t *, /* context_handle */ 412a9148abdSDoug Rabson const gss_name_t, /* target_name */ 413a9148abdSDoug Rabson const gss_OID, /* mech_type */ 414a9148abdSDoug Rabson OM_uint32, /* req_flags */ 415a9148abdSDoug Rabson OM_uint32, /* time_req */ 416a9148abdSDoug Rabson const gss_channel_bindings_t, 417a9148abdSDoug Rabson /* input_chan_bindings */ 418a9148abdSDoug Rabson const gss_buffer_t, /* input_token */ 419a9148abdSDoug Rabson gss_OID *, /* actual_mech_type */ 420a9148abdSDoug Rabson gss_buffer_t, /* output_token */ 421a9148abdSDoug Rabson OM_uint32 *, /* ret_flags */ 422a9148abdSDoug Rabson OM_uint32 * /* time_rec */ 423a9148abdSDoug Rabson ); 424a9148abdSDoug Rabson 425a9148abdSDoug Rabson OM_uint32 gss_accept_sec_context 426a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 427a9148abdSDoug Rabson gss_ctx_id_t *, /* context_handle */ 428a9148abdSDoug Rabson const gss_cred_id_t, /* acceptor_cred_handle */ 429a9148abdSDoug Rabson const gss_buffer_t, /* input_token_buffer */ 430a9148abdSDoug Rabson const gss_channel_bindings_t, 431a9148abdSDoug Rabson /* input_chan_bindings */ 432a9148abdSDoug Rabson gss_name_t *, /* src_name */ 433a9148abdSDoug Rabson gss_OID *, /* mech_type */ 434a9148abdSDoug Rabson gss_buffer_t, /* output_token */ 435a9148abdSDoug Rabson OM_uint32 *, /* ret_flags */ 436a9148abdSDoug Rabson OM_uint32 *, /* time_rec */ 437a9148abdSDoug Rabson gss_cred_id_t * /* delegated_cred_handle */ 438a9148abdSDoug Rabson ); 439a9148abdSDoug Rabson 440a9148abdSDoug Rabson OM_uint32 gss_delete_sec_context 441a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 442a9148abdSDoug Rabson gss_ctx_id_t *, /* context_handle */ 443a9148abdSDoug Rabson gss_buffer_t /* output_token */ 444a9148abdSDoug Rabson ); 445a9148abdSDoug Rabson 446a9148abdSDoug Rabson OM_uint32 gss_get_mic 447a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 448a9148abdSDoug Rabson const gss_ctx_id_t, /* context_handle */ 449a9148abdSDoug Rabson gss_qop_t, /* qop_req */ 450a9148abdSDoug Rabson const gss_buffer_t, /* message_buffer */ 451a9148abdSDoug Rabson gss_buffer_t /* message_token */ 452a9148abdSDoug Rabson ); 453a9148abdSDoug Rabson 454a9148abdSDoug Rabson OM_uint32 gss_verify_mic 455a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 456a9148abdSDoug Rabson const gss_ctx_id_t, /* context_handle */ 457a9148abdSDoug Rabson const gss_buffer_t, /* message_buffer */ 458a9148abdSDoug Rabson const gss_buffer_t, /* token_buffer */ 459a9148abdSDoug Rabson gss_qop_t * /* qop_state */ 460a9148abdSDoug Rabson ); 461a9148abdSDoug Rabson 462a9148abdSDoug Rabson OM_uint32 gss_wrap 463a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 464a9148abdSDoug Rabson const gss_ctx_id_t, /* context_handle */ 465a9148abdSDoug Rabson int, /* conf_req_flag */ 466a9148abdSDoug Rabson gss_qop_t, /* qop_req */ 467a9148abdSDoug Rabson const gss_buffer_t, /* input_message_buffer */ 468a9148abdSDoug Rabson int *, /* conf_state */ 469a9148abdSDoug Rabson gss_buffer_t /* output_message_buffer */ 470a9148abdSDoug Rabson ); 471a9148abdSDoug Rabson 472a9148abdSDoug Rabson OM_uint32 gss_unwrap 473a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 474a9148abdSDoug Rabson const gss_ctx_id_t, /* context_handle */ 475a9148abdSDoug Rabson const gss_buffer_t, /* input_message_buffer */ 476a9148abdSDoug Rabson gss_buffer_t, /* output_message_buffer */ 477a9148abdSDoug Rabson int *, /* conf_state */ 478a9148abdSDoug Rabson gss_qop_t * /* qop_state */ 479a9148abdSDoug Rabson ); 480a9148abdSDoug Rabson 481a9148abdSDoug Rabson OM_uint32 gss_display_status 482a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 483a9148abdSDoug Rabson OM_uint32, /* status_value */ 484a9148abdSDoug Rabson int, /* status_type */ 485a9148abdSDoug Rabson const gss_OID, /* mech_type */ 486a9148abdSDoug Rabson OM_uint32 *, /* message_context */ 487a9148abdSDoug Rabson gss_buffer_t /* status_string */ 488a9148abdSDoug Rabson ); 489a9148abdSDoug Rabson 490a9148abdSDoug Rabson OM_uint32 gss_import_name 491a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 492a9148abdSDoug Rabson const gss_buffer_t, /* input_name_buffer */ 493a9148abdSDoug Rabson const gss_OID, /* input_name_type */ 494a9148abdSDoug Rabson gss_name_t * /* output_name */ 495a9148abdSDoug Rabson ); 496a9148abdSDoug Rabson 497a9148abdSDoug Rabson OM_uint32 gss_export_name 498a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 499a9148abdSDoug Rabson const gss_name_t, /* input_name */ 500a9148abdSDoug Rabson gss_buffer_t /* exported_name */ 501a9148abdSDoug Rabson ); 502a9148abdSDoug Rabson 503a9148abdSDoug Rabson OM_uint32 gss_release_name 504a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 505a9148abdSDoug Rabson gss_name_t * /* input_name */ 506a9148abdSDoug Rabson ); 507a9148abdSDoug Rabson 508a9148abdSDoug Rabson OM_uint32 gss_release_buffer 509a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 510a9148abdSDoug Rabson gss_buffer_t /* buffer */ 511a9148abdSDoug Rabson ); 512a9148abdSDoug Rabson 513a9148abdSDoug Rabson OM_uint32 gss_release_oid_set 514a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 515a9148abdSDoug Rabson gss_OID_set * /* set */ 516a9148abdSDoug Rabson ); 517a9148abdSDoug Rabson 518a9148abdSDoug Rabson OM_uint32 gss_wrap_size_limit ( 519a9148abdSDoug Rabson OM_uint32 *, /* minor_status */ 520a9148abdSDoug Rabson const gss_ctx_id_t, /* context_handle */ 521a9148abdSDoug Rabson int, /* conf_req_flag */ 522a9148abdSDoug Rabson gss_qop_t, /* qop_req */ 523a9148abdSDoug Rabson OM_uint32, /* req_output_size */ 524a9148abdSDoug Rabson OM_uint32 * /* max_input_size */ 525a9148abdSDoug Rabson ); 526a9148abdSDoug Rabson 527a9148abdSDoug Rabson OM_uint32 gss_create_empty_oid_set ( 528a9148abdSDoug Rabson OM_uint32 *, /* minor_status */ 529a9148abdSDoug Rabson gss_OID_set * /* oid_set */ 530a9148abdSDoug Rabson ); 531a9148abdSDoug Rabson 532a9148abdSDoug Rabson OM_uint32 gss_add_oid_set_member ( 533a9148abdSDoug Rabson OM_uint32 *, /* minor_status */ 534a9148abdSDoug Rabson const gss_OID, /* member_oid */ 535a9148abdSDoug Rabson gss_OID_set * /* oid_set */ 536a9148abdSDoug Rabson ); 537a9148abdSDoug Rabson 538a9148abdSDoug Rabson OM_uint32 gss_test_oid_set_member ( 539a9148abdSDoug Rabson OM_uint32 *, /* minor_status */ 540a9148abdSDoug Rabson const gss_OID, /* member */ 541a9148abdSDoug Rabson const gss_OID_set, /* set */ 542a9148abdSDoug Rabson int * /* present */ 543a9148abdSDoug Rabson ); 544a9148abdSDoug Rabson 545a9148abdSDoug Rabson OM_uint32 gss_canonicalize_name ( 546a9148abdSDoug Rabson OM_uint32 *, /* minor_status */ 547a9148abdSDoug Rabson const gss_name_t, /* input_name */ 548a9148abdSDoug Rabson const gss_OID, /* mech_type */ 549a9148abdSDoug Rabson gss_name_t * /* output_name */ 550a9148abdSDoug Rabson ); 551a9148abdSDoug Rabson 552a9148abdSDoug Rabson /* 553a9148abdSDoug Rabson * Other extensions and helper functions. 554a9148abdSDoug Rabson */ 555a9148abdSDoug Rabson 556a9148abdSDoug Rabson OM_uint32 gss_set_cred_option 557a9148abdSDoug Rabson (OM_uint32 *, /* minor status */ 558a9148abdSDoug Rabson gss_cred_id_t *, /* cred */ 559a9148abdSDoug Rabson const gss_OID, /* option to set */ 560a9148abdSDoug Rabson const gss_buffer_t /* option value */ 561a9148abdSDoug Rabson ); 562a9148abdSDoug Rabson 563a9148abdSDoug Rabson OM_uint32 gss_pname_to_uid 564a9148abdSDoug Rabson (OM_uint32 *, /* minor status */ 565a9148abdSDoug Rabson const gss_name_t pname, /* principal name */ 566a9148abdSDoug Rabson const gss_OID mech, /* mechanism to query */ 567a9148abdSDoug Rabson uid_t *uidp /* pointer to UID for result */ 568a9148abdSDoug Rabson ); 569a9148abdSDoug Rabson 570a9148abdSDoug Rabson /* 571a9148abdSDoug Rabson * On entry, *numgroups is set to the maximum number of groups to return. On exit, *numgroups is set to the actual number of groups returned. 572a9148abdSDoug Rabson */ 573a9148abdSDoug Rabson OM_uint32 gss_pname_to_unix_cred 574a9148abdSDoug Rabson (OM_uint32 *, /* minor status */ 575a9148abdSDoug Rabson const gss_name_t pname, /* principal name */ 576a9148abdSDoug Rabson const gss_OID mech, /* mechanism to query */ 577a9148abdSDoug Rabson uid_t *uidp, /* pointer to UID for result */ 578a9148abdSDoug Rabson gid_t *gidp, /* pointer to GID for result */ 579a9148abdSDoug Rabson int *numgroups, /* number of groups */ 580a9148abdSDoug Rabson gid_t *groups /* pointer to group list */ 581a9148abdSDoug Rabson ); 582a9148abdSDoug Rabson 583*dd7d42a1SRick Macklem OM_uint32 gss_ip_to_dns 584*dd7d42a1SRick Macklem (OM_uint32 *, /* minor status */ 585*dd7d42a1SRick Macklem char *ip_addr, /* IP host address string */ 586*dd7d42a1SRick Macklem char *dns_name /* pointer to dns_name for result */ 587*dd7d42a1SRick Macklem ); 588*dd7d42a1SRick Macklem 589a9148abdSDoug Rabson /* 590a9148abdSDoug Rabson * Mbuf oriented message signing and encryption. 591a9148abdSDoug Rabson * 592a9148abdSDoug Rabson * Get_mic allocates an mbuf to hold the message checksum. Verify_mic 593a9148abdSDoug Rabson * may modify the passed-in mic but will not free it. 594a9148abdSDoug Rabson * 595a9148abdSDoug Rabson * Wrap and unwrap 596a9148abdSDoug Rabson * consume the message and generate a new mbuf chain with the 597a9148abdSDoug Rabson * result. The original message is freed on error. 598a9148abdSDoug Rabson */ 599a9148abdSDoug Rabson struct mbuf; 600a9148abdSDoug Rabson OM_uint32 gss_get_mic_mbuf 601a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 602a9148abdSDoug Rabson const gss_ctx_id_t, /* context_handle */ 603a9148abdSDoug Rabson gss_qop_t, /* qop_req */ 604a9148abdSDoug Rabson struct mbuf *, /* message_buffer */ 605a9148abdSDoug Rabson struct mbuf ** /* message_token */ 606a9148abdSDoug Rabson ); 607a9148abdSDoug Rabson 608a9148abdSDoug Rabson OM_uint32 gss_verify_mic_mbuf 609a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 610a9148abdSDoug Rabson const gss_ctx_id_t, /* context_handle */ 611a9148abdSDoug Rabson struct mbuf *, /* message_buffer */ 612a9148abdSDoug Rabson struct mbuf *, /* token_buffer */ 613a9148abdSDoug Rabson gss_qop_t * /* qop_state */ 614a9148abdSDoug Rabson ); 615a9148abdSDoug Rabson 616a9148abdSDoug Rabson OM_uint32 gss_wrap_mbuf 617a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 618a9148abdSDoug Rabson const gss_ctx_id_t, /* context_handle */ 619a9148abdSDoug Rabson int, /* conf_req_flag */ 620a9148abdSDoug Rabson gss_qop_t, /* qop_req */ 621a9148abdSDoug Rabson struct mbuf **, /* message_buffer */ 622a9148abdSDoug Rabson int * /* conf_state */ 623a9148abdSDoug Rabson ); 624a9148abdSDoug Rabson 625a9148abdSDoug Rabson OM_uint32 gss_unwrap_mbuf 626a9148abdSDoug Rabson (OM_uint32 *, /* minor_status */ 627a9148abdSDoug Rabson const gss_ctx_id_t, /* context_handle */ 628a9148abdSDoug Rabson struct mbuf **, /* message_buffer */ 629a9148abdSDoug Rabson int *, /* conf_state */ 630a9148abdSDoug Rabson gss_qop_t * /* qop_state */ 631a9148abdSDoug Rabson ); 632a9148abdSDoug Rabson 633a9148abdSDoug Rabson __END_DECLS 634a9148abdSDoug Rabson 635a9148abdSDoug Rabson #endif /* _KGSSAPI_GSSAPI_H_ */ 636