1 1.1 elric /* $NetBSD: krb5.h,v 1.4 2023/06/19 21:41:44 christos Exp $ */ 2 1.1 elric 3 1.1 elric /* 4 1.1 elric * Copyright (c) 1997 - 2007 Kungliga Tekniska Hgskolan 5 1.1 elric * (Royal Institute of Technology, Stockholm, Sweden). 6 1.1 elric * All rights reserved. 7 1.1 elric * 8 1.1 elric * Portions Copyright (c) 2009 Apple Inc. All rights reserved. 9 1.1 elric * 10 1.1 elric * Redistribution and use in source and binary forms, with or without 11 1.1 elric * modification, are permitted provided that the following conditions 12 1.1 elric * are met: 13 1.1 elric * 14 1.1 elric * 1. Redistributions of source code must retain the above copyright 15 1.1 elric * notice, this list of conditions and the following disclaimer. 16 1.1 elric * 17 1.1 elric * 2. Redistributions in binary form must reproduce the above copyright 18 1.1 elric * notice, this list of conditions and the following disclaimer in the 19 1.1 elric * documentation and/or other materials provided with the distribution. 20 1.1 elric * 21 1.1 elric * 3. Neither the name of the Institute nor the names of its contributors 22 1.1 elric * may be used to endorse or promote products derived from this software 23 1.1 elric * without specific prior written permission. 24 1.1 elric * 25 1.1 elric * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 26 1.1 elric * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 1.1 elric * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28 1.1 elric * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 29 1.1 elric * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 1.1 elric * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31 1.1 elric * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32 1.1 elric * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33 1.1 elric * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34 1.1 elric * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35 1.1 elric * SUCH DAMAGE. 36 1.1 elric */ 37 1.1 elric 38 1.2 christos /* Id */ 39 1.1 elric 40 1.1 elric #ifndef __KRB5_H__ 41 1.1 elric #define __KRB5_H__ 42 1.1 elric 43 1.1 elric #include <time.h> 44 1.1 elric #include <krb5/krb5-types.h> 45 1.1 elric 46 1.1 elric #include <krb5/asn1_err.h> 47 1.1 elric #include <krb5/krb5_err.h> 48 1.1 elric #include <krb5/heim_err.h> 49 1.1 elric #include <krb5/k524_err.h> 50 1.1 elric 51 1.1 elric #include <krb5/krb5_asn1.h> 52 1.1 elric 53 1.1 elric /* name confusion with MIT */ 54 1.1 elric #ifndef KRB5KDC_ERR_KEY_EXP 55 1.1 elric #define KRB5KDC_ERR_KEY_EXP KRB5KDC_ERR_KEY_EXPIRED 56 1.1 elric #endif 57 1.1 elric 58 1.1 elric #ifdef _WIN32 59 1.1 elric #define KRB5_CALLCONV __stdcall 60 1.1 elric #else 61 1.1 elric #define KRB5_CALLCONV 62 1.1 elric #endif 63 1.1 elric 64 1.1 elric /* simple constants */ 65 1.1 elric 66 1.1 elric #ifndef TRUE 67 1.1 elric #define TRUE 1 68 1.1 elric #define FALSE 0 69 1.1 elric #endif 70 1.1 elric 71 1.1 elric typedef int krb5_boolean; 72 1.1 elric 73 1.1 elric typedef int32_t krb5_error_code; 74 1.1 elric 75 1.1 elric typedef int32_t krb5_kvno; 76 1.1 elric 77 1.1 elric typedef uint32_t krb5_flags; 78 1.1 elric 79 1.1 elric typedef void *krb5_pointer; 80 1.1 elric typedef const void *krb5_const_pointer; 81 1.1 elric 82 1.1 elric struct krb5_crypto_data; 83 1.1 elric typedef struct krb5_crypto_data *krb5_crypto; 84 1.1 elric 85 1.1 elric struct krb5_get_creds_opt_data; 86 1.1 elric typedef struct krb5_get_creds_opt_data *krb5_get_creds_opt; 87 1.1 elric 88 1.1 elric struct krb5_digest_data; 89 1.1 elric typedef struct krb5_digest_data *krb5_digest; 90 1.1 elric struct krb5_ntlm_data; 91 1.1 elric typedef struct krb5_ntlm_data *krb5_ntlm; 92 1.1 elric 93 1.1 elric struct krb5_pac_data; 94 1.1 elric typedef struct krb5_pac_data *krb5_pac; 95 1.1 elric 96 1.1 elric typedef struct krb5_rd_req_in_ctx_data *krb5_rd_req_in_ctx; 97 1.1 elric typedef struct krb5_rd_req_out_ctx_data *krb5_rd_req_out_ctx; 98 1.1 elric 99 1.1 elric typedef CKSUMTYPE krb5_cksumtype; 100 1.1 elric 101 1.1 elric typedef Checksum krb5_checksum; 102 1.1 elric 103 1.1 elric typedef ENCTYPE krb5_enctype; 104 1.1 elric 105 1.1 elric typedef struct krb5_get_init_creds_ctx *krb5_init_creds_context; 106 1.1 elric 107 1.1 elric typedef heim_octet_string krb5_data; 108 1.1 elric 109 1.1 elric /* PKINIT related forward declarations */ 110 1.1 elric struct ContentInfo; 111 1.1 elric struct krb5_pk_identity; 112 1.1 elric struct krb5_pk_cert; 113 1.1 elric 114 1.1 elric /* krb5_enc_data is a mit compat structure */ 115 1.1 elric typedef struct krb5_enc_data { 116 1.1 elric krb5_enctype enctype; 117 1.1 elric krb5_kvno kvno; 118 1.1 elric krb5_data ciphertext; 119 1.1 elric } krb5_enc_data; 120 1.1 elric 121 1.1 elric /* alternative names */ 122 1.4 christos #define ENCTYPE_NULL KRB5_ENCTYPE_NULL 123 1.4 christos #define ENCTYPE_DES_CBC_CRC KRB5_ENCTYPE_DES_CBC_CRC 124 1.4 christos #define ENCTYPE_DES_CBC_MD4 KRB5_ENCTYPE_DES_CBC_MD4 125 1.4 christos #define ENCTYPE_DES_CBC_MD5 KRB5_ENCTYPE_DES_CBC_MD5 126 1.4 christos #define ENCTYPE_DES3_CBC_MD5 KRB5_ENCTYPE_DES3_CBC_MD5 127 1.4 christos #define ENCTYPE_OLD_DES3_CBC_SHA1 KRB5_ENCTYPE_OLD_DES3_CBC_SHA1 128 1.4 christos #define ENCTYPE_SIGN_DSA_GENERATE KRB5_ENCTYPE_SIGN_DSA_GENERATE 129 1.4 christos #define ENCTYPE_ENCRYPT_RSA_PRIV KRB5_ENCTYPE_ENCRYPT_RSA_PRIV 130 1.4 christos #define ENCTYPE_ENCRYPT_RSA_PUB KRB5_ENCTYPE_ENCRYPT_RSA_PUB 131 1.4 christos #define ENCTYPE_DES3_CBC_SHA1 KRB5_ENCTYPE_DES3_CBC_SHA1 132 1.4 christos #define ENCTYPE_AES128_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES128_CTS_HMAC_SHA1_96 133 1.4 christos #define ENCTYPE_AES256_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES256_CTS_HMAC_SHA1_96 134 1.4 christos #define ENCTYPE_ARCFOUR_HMAC KRB5_ENCTYPE_ARCFOUR_HMAC_MD5 135 1.4 christos #define ENCTYPE_ARCFOUR_HMAC_MD5 KRB5_ENCTYPE_ARCFOUR_HMAC_MD5 136 1.4 christos #define ENCTYPE_ARCFOUR_HMAC_MD5_56 KRB5_ENCTYPE_ARCFOUR_HMAC_MD5_56 137 1.4 christos #define ENCTYPE_ENCTYPE_PK_CROSS KRB5_ENCTYPE_ENCTYPE_PK_CROSS 138 1.4 christos #define ENCTYPE_DES_CBC_NONE KRB5_ENCTYPE_DES_CBC_NONE 139 1.4 christos #define ENCTYPE_DES3_CBC_NONE KRB5_ENCTYPE_DES3_CBC_NONE 140 1.4 christos #define ENCTYPE_DES_CFB64_NONE KRB5_ENCTYPE_DES_CFB64_NONE 141 1.4 christos #define ENCTYPE_DES_PCBC_NONE KRB5_ENCTYPE_DES_PCBC_NONE 142 1.4 christos #define ETYPE_NULL KRB5_ENCTYPE_NULL 143 1.4 christos #define ETYPE_DES_CBC_CRC KRB5_ENCTYPE_DES_CBC_CRC 144 1.4 christos #define ETYPE_DES_CBC_MD4 KRB5_ENCTYPE_DES_CBC_MD4 145 1.4 christos #define ETYPE_DES_CBC_MD5 KRB5_ENCTYPE_DES_CBC_MD5 146 1.4 christos #define ETYPE_DES3_CBC_MD5 KRB5_ENCTYPE_DES3_CBC_MD5 147 1.4 christos #define ETYPE_OLD_DES3_CBC_SHA1 KRB5_ENCTYPE_OLD_DES3_CBC_SHA1 148 1.4 christos #define ETYPE_SIGN_DSA_GENERATE KRB5_ENCTYPE_SIGN_DSA_GENERATE 149 1.4 christos #define ETYPE_ENCRYPT_RSA_PRIV KRB5_ENCTYPE_ENCRYPT_RSA_PRIV 150 1.4 christos #define ETYPE_ENCRYPT_RSA_PUB KRB5_ENCTYPE_ENCRYPT_RSA_PUB 151 1.4 christos #define ETYPE_DES3_CBC_SHA1 KRB5_ENCTYPE_DES3_CBC_SHA1 152 1.4 christos #define ETYPE_AES128_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES128_CTS_HMAC_SHA1_96 153 1.4 christos #define ETYPE_AES256_CTS_HMAC_SHA1_96 KRB5_ENCTYPE_AES256_CTS_HMAC_SHA1_96 154 1.4 christos #define ETYPE_AES128_CTS_HMAC_SHA256_128 KRB5_ENCTYPE_AES128_CTS_HMAC_SHA256_128 155 1.4 christos #define ETYPE_AES256_CTS_HMAC_SHA384_192 KRB5_ENCTYPE_AES256_CTS_HMAC_SHA384_192 156 1.4 christos #define ETYPE_ARCFOUR_HMAC_MD5 KRB5_ENCTYPE_ARCFOUR_HMAC_MD5 157 1.4 christos #define ETYPE_ARCFOUR_HMAC_MD5_56 KRB5_ENCTYPE_ARCFOUR_HMAC_MD5_56 158 1.4 christos #define ETYPE_ENCTYPE_PK_CROSS KRB5_ENCTYPE_ENCTYPE_PK_CROSS 159 1.4 christos #define ETYPE_ARCFOUR_MD4 KRB5_ENCTYPE_ARCFOUR_MD4 160 1.4 christos #define ETYPE_ARCFOUR_HMAC_OLD KRB5_ENCTYPE_ARCFOUR_HMAC_OLD 161 1.4 christos #define ETYPE_ARCFOUR_HMAC_OLD_EXP KRB5_ENCTYPE_ARCFOUR_HMAC_OLD_EXP 162 1.4 christos #define ETYPE_DES_CBC_NONE KRB5_ENCTYPE_DES_CBC_NONE 163 1.4 christos #define ETYPE_DES3_CBC_NONE KRB5_ENCTYPE_DES3_CBC_NONE 164 1.4 christos #define ETYPE_DES_CFB64_NONE KRB5_ENCTYPE_DES_CFB64_NONE 165 1.4 christos #define ETYPE_DES_PCBC_NONE KRB5_ENCTYPE_DES_PCBC_NONE 166 1.4 christos #define ETYPE_DIGEST_MD5_NONE KRB5_ENCTYPE_DIGEST_MD5_NONE 167 1.4 christos #define ETYPE_CRAM_MD5_NONE KRB5_ENCTYPE_CRAM_MD5_NONE 168 1.2 christos 169 1.2 christos /* PDU types */ 170 1.2 christos typedef enum krb5_pdu { 171 1.2 christos KRB5_PDU_ERROR = 0, 172 1.2 christos KRB5_PDU_TICKET = 1, 173 1.2 christos KRB5_PDU_AS_REQUEST = 2, 174 1.2 christos KRB5_PDU_AS_REPLY = 3, 175 1.2 christos KRB5_PDU_TGS_REQUEST = 4, 176 1.2 christos KRB5_PDU_TGS_REPLY = 5, 177 1.2 christos KRB5_PDU_AP_REQUEST = 6, 178 1.2 christos KRB5_PDU_AP_REPLY = 7, 179 1.2 christos KRB5_PDU_KRB_SAFE = 8, 180 1.2 christos KRB5_PDU_KRB_PRIV = 9, 181 1.2 christos KRB5_PDU_KRB_CRED = 10, 182 1.2 christos KRB5_PDU_NONE = 11 /* See krb5_get_permitted_enctypes() */ 183 1.2 christos } krb5_pdu; 184 1.1 elric 185 1.1 elric typedef PADATA_TYPE krb5_preauthtype; 186 1.1 elric 187 1.1 elric typedef enum krb5_key_usage { 188 1.1 elric KRB5_KU_PA_ENC_TIMESTAMP = 1, 189 1.1 elric /* AS-REQ PA-ENC-TIMESTAMP padata timestamp, encrypted with the 190 1.1 elric client key (section 5.4.1) */ 191 1.1 elric KRB5_KU_TICKET = 2, 192 1.1 elric /* AS-REP Ticket and TGS-REP Ticket (includes tgs session key or 193 1.1 elric application session key), encrypted with the service key 194 1.1 elric (section 5.4.2) */ 195 1.1 elric KRB5_KU_AS_REP_ENC_PART = 3, 196 1.1 elric /* AS-REP encrypted part (includes tgs session key or application 197 1.1 elric session key), encrypted with the client key (section 5.4.2) */ 198 1.1 elric KRB5_KU_TGS_REQ_AUTH_DAT_SESSION = 4, 199 1.1 elric /* TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the tgs 200 1.1 elric session key (section 5.4.1) */ 201 1.1 elric KRB5_KU_TGS_REQ_AUTH_DAT_SUBKEY = 5, 202 1.1 elric /* TGS-REQ KDC-REQ-BODY AuthorizationData, encrypted with the tgs 203 1.1 elric authenticator subkey (section 5.4.1) */ 204 1.1 elric KRB5_KU_TGS_REQ_AUTH_CKSUM = 6, 205 1.1 elric /* TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator cksum, keyed 206 1.1 elric with the tgs session key (sections 5.3.2, 5.4.1) */ 207 1.1 elric KRB5_KU_TGS_REQ_AUTH = 7, 208 1.1 elric /* TGS-REQ PA-TGS-REQ padata AP-REQ Authenticator (includes tgs 209 1.1 elric authenticator subkey), encrypted with the tgs session key 210 1.1 elric (section 5.3.2) */ 211 1.1 elric KRB5_KU_TGS_REP_ENC_PART_SESSION = 8, 212 1.1 elric /* TGS-REP encrypted part (includes application session key), 213 1.1 elric encrypted with the tgs session key (section 5.4.2) */ 214 1.1 elric KRB5_KU_TGS_REP_ENC_PART_SUB_KEY = 9, 215 1.1 elric /* TGS-REP encrypted part (includes application session key), 216 1.1 elric encrypted with the tgs authenticator subkey (section 5.4.2) */ 217 1.1 elric KRB5_KU_AP_REQ_AUTH_CKSUM = 10, 218 1.1 elric /* AP-REQ Authenticator cksum, keyed with the application session 219 1.1 elric key (section 5.3.2) */ 220 1.1 elric KRB5_KU_AP_REQ_AUTH = 11, 221 1.1 elric /* AP-REQ Authenticator (includes application authenticator 222 1.1 elric subkey), encrypted with the application session key (section 223 1.1 elric 5.3.2) */ 224 1.1 elric KRB5_KU_AP_REQ_ENC_PART = 12, 225 1.1 elric /* AP-REP encrypted part (includes application session subkey), 226 1.1 elric encrypted with the application session key (section 5.5.2) */ 227 1.1 elric KRB5_KU_KRB_PRIV = 13, 228 1.1 elric /* KRB-PRIV encrypted part, encrypted with a key chosen by the 229 1.1 elric application (section 5.7.1) */ 230 1.1 elric KRB5_KU_KRB_CRED = 14, 231 1.1 elric /* KRB-CRED encrypted part, encrypted with a key chosen by the 232 1.1 elric application (section 5.8.1) */ 233 1.1 elric KRB5_KU_KRB_SAFE_CKSUM = 15, 234 1.1 elric /* KRB-SAFE cksum, keyed with a key chosen by the application 235 1.1 elric (section 5.6.1) */ 236 1.1 elric KRB5_KU_OTHER_ENCRYPTED = 16, 237 1.1 elric /* Data which is defined in some specification outside of 238 1.1 elric Kerberos to be encrypted using an RFC1510 encryption type. */ 239 1.1 elric KRB5_KU_OTHER_CKSUM = 17, 240 1.1 elric /* Data which is defined in some specification outside of 241 1.1 elric Kerberos to be checksummed using an RFC1510 checksum type. */ 242 1.1 elric KRB5_KU_KRB_ERROR = 18, 243 1.1 elric /* Krb-error checksum */ 244 1.1 elric KRB5_KU_AD_KDC_ISSUED = 19, 245 1.1 elric /* AD-KDCIssued checksum */ 246 1.1 elric KRB5_KU_MANDATORY_TICKET_EXTENSION = 20, 247 1.1 elric /* Checksum for Mandatory Ticket Extensions */ 248 1.1 elric KRB5_KU_AUTH_DATA_TICKET_EXTENSION = 21, 249 1.1 elric /* Checksum in Authorization Data in Ticket Extensions */ 250 1.1 elric KRB5_KU_USAGE_SEAL = 22, 251 1.1 elric /* seal in GSSAPI krb5 mechanism */ 252 1.1 elric KRB5_KU_USAGE_SIGN = 23, 253 1.1 elric /* sign in GSSAPI krb5 mechanism */ 254 1.1 elric KRB5_KU_USAGE_SEQ = 24, 255 1.1 elric /* SEQ in GSSAPI krb5 mechanism */ 256 1.1 elric KRB5_KU_USAGE_ACCEPTOR_SEAL = 22, 257 1.1 elric /* acceptor sign in GSSAPI CFX krb5 mechanism */ 258 1.1 elric KRB5_KU_USAGE_ACCEPTOR_SIGN = 23, 259 1.1 elric /* acceptor seal in GSSAPI CFX krb5 mechanism */ 260 1.1 elric KRB5_KU_USAGE_INITIATOR_SEAL = 24, 261 1.1 elric /* initiator sign in GSSAPI CFX krb5 mechanism */ 262 1.1 elric KRB5_KU_USAGE_INITIATOR_SIGN = 25, 263 1.1 elric /* initiator seal in GSSAPI CFX krb5 mechanism */ 264 1.1 elric KRB5_KU_PA_SERVER_REFERRAL_DATA = 22, 265 1.1 elric /* encrypted server referral data */ 266 1.1 elric KRB5_KU_SAM_CHECKSUM = 25, 267 1.1 elric /* Checksum for the SAM-CHECKSUM field */ 268 1.1 elric KRB5_KU_SAM_ENC_TRACK_ID = 26, 269 1.1 elric /* Encryption of the SAM-TRACK-ID field */ 270 1.1 elric KRB5_KU_PA_SERVER_REFERRAL = 26, 271 1.1 elric /* Keyusage for the server referral in a TGS req */ 272 1.1 elric KRB5_KU_SAM_ENC_NONCE_SAD = 27, 273 1.1 elric /* Encryption of the SAM-NONCE-OR-SAD field */ 274 1.1 elric KRB5_KU_PA_PKINIT_KX = 44, 275 1.1 elric /* Encryption type of the kdc session contribution in pk-init */ 276 1.1 elric KRB5_KU_AS_REQ = 56, 277 1.1 elric /* Checksum of over the AS-REQ send by the KDC in PA-REQ-ENC-PA-REP */ 278 1.2 christos KRB5_KU_FAST_REQ_CHKSUM = 50, 279 1.2 christos /* FAST armor checksum */ 280 1.2 christos KRB5_KU_FAST_ENC = 51, 281 1.2 christos /* FAST armor encryption */ 282 1.2 christos KRB5_KU_FAST_REP = 52, 283 1.2 christos /* FAST armor reply */ 284 1.2 christos KRB5_KU_FAST_FINISHED = 53, 285 1.2 christos /* FAST finished checksum */ 286 1.2 christos KRB5_KU_ENC_CHALLENGE_CLIENT = 54, 287 1.2 christos /* fast challenge from client */ 288 1.2 christos KRB5_KU_ENC_CHALLENGE_KDC = 55, 289 1.2 christos /* fast challenge from kdc */ 290 1.1 elric KRB5_KU_DIGEST_ENCRYPT = -18, 291 1.1 elric /* Encryption key usage used in the digest encryption field */ 292 1.1 elric KRB5_KU_DIGEST_OPAQUE = -19, 293 1.1 elric /* Checksum key usage used in the digest opaque field */ 294 1.1 elric KRB5_KU_KRB5SIGNEDPATH = -21, 295 1.1 elric /* Checksum key usage on KRB5SignedPath */ 296 1.2 christos KRB5_KU_CANONICALIZED_NAMES = -23, 297 1.1 elric /* Checksum key usage on PA-CANONICALIZED */ 298 1.2 christos KRB5_KU_H5L_COOKIE = -25 299 1.2 christos /* encrypted foo */ 300 1.1 elric } krb5_key_usage; 301 1.1 elric 302 1.1 elric typedef krb5_key_usage krb5_keyusage; 303 1.1 elric 304 1.1 elric typedef enum krb5_salttype { 305 1.1 elric KRB5_PW_SALT = KRB5_PADATA_PW_SALT, 306 1.1 elric KRB5_AFS3_SALT = KRB5_PADATA_AFS3_SALT 307 1.1 elric }krb5_salttype; 308 1.1 elric 309 1.1 elric typedef struct krb5_salt { 310 1.1 elric krb5_salttype salttype; 311 1.1 elric krb5_data saltvalue; 312 1.1 elric } krb5_salt; 313 1.1 elric 314 1.1 elric typedef ETYPE_INFO krb5_preauthinfo; 315 1.1 elric 316 1.1 elric typedef struct { 317 1.1 elric krb5_preauthtype type; 318 1.1 elric krb5_preauthinfo info; /* list of preauthinfo for this type */ 319 1.1 elric } krb5_preauthdata_entry; 320 1.1 elric 321 1.1 elric typedef struct krb5_preauthdata { 322 1.1 elric unsigned len; 323 1.1 elric krb5_preauthdata_entry *val; 324 1.1 elric }krb5_preauthdata; 325 1.1 elric 326 1.1 elric typedef enum krb5_address_type { 327 1.1 elric KRB5_ADDRESS_INET = 2, 328 1.1 elric KRB5_ADDRESS_NETBIOS = 20, 329 1.1 elric KRB5_ADDRESS_INET6 = 24, 330 1.1 elric KRB5_ADDRESS_ADDRPORT = 256, 331 1.1 elric KRB5_ADDRESS_IPPORT = 257 332 1.1 elric } krb5_address_type; 333 1.1 elric 334 1.1 elric enum { 335 1.1 elric AP_OPTS_USE_SESSION_KEY = 1, 336 1.1 elric AP_OPTS_MUTUAL_REQUIRED = 2, 337 1.1 elric AP_OPTS_USE_SUBKEY = 4 /* library internal */ 338 1.1 elric }; 339 1.1 elric 340 1.1 elric typedef HostAddress krb5_address; 341 1.1 elric 342 1.1 elric typedef HostAddresses krb5_addresses; 343 1.1 elric 344 1.2 christos typedef krb5_enctype krb5_keytype; 345 1.2 christos 346 1.2 christos enum krb5_keytype_old { 347 1.1 elric KEYTYPE_NULL = ETYPE_NULL, 348 1.1 elric KEYTYPE_DES = ETYPE_DES_CBC_CRC, 349 1.1 elric KEYTYPE_DES3 = ETYPE_OLD_DES3_CBC_SHA1, 350 1.1 elric KEYTYPE_AES128 = ETYPE_AES128_CTS_HMAC_SHA1_96, 351 1.1 elric KEYTYPE_AES256 = ETYPE_AES256_CTS_HMAC_SHA1_96, 352 1.1 elric KEYTYPE_ARCFOUR = ETYPE_ARCFOUR_HMAC_MD5, 353 1.1 elric KEYTYPE_ARCFOUR_56 = ETYPE_ARCFOUR_HMAC_MD5_56 354 1.2 christos }; 355 1.1 elric 356 1.1 elric typedef EncryptionKey krb5_keyblock; 357 1.1 elric 358 1.1 elric typedef AP_REQ krb5_ap_req; 359 1.1 elric 360 1.1 elric struct krb5_cc_ops; 361 1.1 elric 362 1.1 elric #ifdef _WIN32 363 1.1 elric #define KRB5_USE_PATH_TOKENS 1 364 1.1 elric #endif 365 1.1 elric 366 1.1 elric #ifdef KRB5_USE_PATH_TOKENS 367 1.1 elric #define KRB5_DEFAULT_CCFILE_ROOT "%{TEMP}/krb5cc_" 368 1.1 elric #else 369 1.1 elric #define KRB5_DEFAULT_CCFILE_ROOT "/tmp/krb5cc_" 370 1.1 elric #endif 371 1.1 elric 372 1.1 elric #define KRB5_DEFAULT_CCROOT "FILE:" KRB5_DEFAULT_CCFILE_ROOT 373 1.1 elric 374 1.1 elric #define KRB5_ACCEPT_NULL_ADDRESSES(C) \ 375 1.1 elric krb5_config_get_bool_default((C), NULL, TRUE, \ 376 1.1 elric "libdefaults", "accept_null_addresses", \ 377 1.1 elric NULL) 378 1.1 elric 379 1.1 elric typedef void *krb5_cc_cursor; 380 1.1 elric typedef struct krb5_cccol_cursor_data *krb5_cccol_cursor; 381 1.1 elric 382 1.1 elric typedef struct krb5_ccache_data { 383 1.1 elric const struct krb5_cc_ops *ops; 384 1.1 elric krb5_data data; 385 1.2 christos int initialized; /* if non-zero: krb5_cc_initialize() called, now empty */ 386 1.1 elric }krb5_ccache_data; 387 1.1 elric 388 1.1 elric typedef struct krb5_ccache_data *krb5_ccache; 389 1.1 elric 390 1.1 elric typedef struct krb5_context_data *krb5_context; 391 1.1 elric 392 1.1 elric typedef Realm krb5_realm; 393 1.1 elric typedef const char *krb5_const_realm; /* stupid language */ 394 1.1 elric 395 1.1 elric #define krb5_realm_length(r) strlen(r) 396 1.1 elric #define krb5_realm_data(r) (r) 397 1.1 elric 398 1.1 elric typedef Principal krb5_principal_data; 399 1.1 elric typedef struct Principal *krb5_principal; 400 1.1 elric typedef const struct Principal *krb5_const_principal; 401 1.1 elric typedef struct Principals *krb5_principals; 402 1.1 elric 403 1.1 elric typedef time_t krb5_deltat; 404 1.1 elric typedef time_t krb5_timestamp; 405 1.1 elric 406 1.1 elric typedef struct krb5_times { 407 1.1 elric krb5_timestamp authtime; 408 1.1 elric krb5_timestamp starttime; 409 1.1 elric krb5_timestamp endtime; 410 1.1 elric krb5_timestamp renew_till; 411 1.1 elric } krb5_times; 412 1.1 elric 413 1.1 elric typedef union { 414 1.1 elric TicketFlags b; 415 1.1 elric krb5_flags i; 416 1.1 elric } krb5_ticket_flags; 417 1.1 elric 418 1.1 elric /* options for krb5_get_in_tkt() */ 419 1.1 elric #define KDC_OPT_FORWARDABLE (1 << 1) 420 1.1 elric #define KDC_OPT_FORWARDED (1 << 2) 421 1.1 elric #define KDC_OPT_PROXIABLE (1 << 3) 422 1.1 elric #define KDC_OPT_PROXY (1 << 4) 423 1.1 elric #define KDC_OPT_ALLOW_POSTDATE (1 << 5) 424 1.1 elric #define KDC_OPT_POSTDATED (1 << 6) 425 1.1 elric #define KDC_OPT_RENEWABLE (1 << 8) 426 1.1 elric #define KDC_OPT_REQUEST_ANONYMOUS (1 << 14) 427 1.1 elric #define KDC_OPT_DISABLE_TRANSITED_CHECK (1 << 26) 428 1.1 elric #define KDC_OPT_RENEWABLE_OK (1 << 27) 429 1.1 elric #define KDC_OPT_ENC_TKT_IN_SKEY (1 << 28) 430 1.1 elric #define KDC_OPT_RENEW (1 << 30) 431 1.1 elric #define KDC_OPT_VALIDATE (1 << 31) 432 1.1 elric 433 1.1 elric typedef union { 434 1.1 elric KDCOptions b; 435 1.1 elric krb5_flags i; 436 1.1 elric } krb5_kdc_flags; 437 1.1 elric 438 1.1 elric /* flags for krb5_verify_ap_req */ 439 1.1 elric 440 1.1 elric #define KRB5_VERIFY_AP_REQ_IGNORE_INVALID (1 << 0) 441 1.1 elric 442 1.1 elric #define KRB5_GC_CACHED (1U << 0) 443 1.1 elric #define KRB5_GC_USER_USER (1U << 1) 444 1.1 elric #define KRB5_GC_EXPIRED_OK (1U << 2) 445 1.1 elric #define KRB5_GC_NO_STORE (1U << 3) 446 1.1 elric #define KRB5_GC_FORWARDABLE (1U << 4) 447 1.1 elric #define KRB5_GC_NO_TRANSIT_CHECK (1U << 5) 448 1.1 elric #define KRB5_GC_CONSTRAINED_DELEGATION (1U << 6) 449 1.1 elric #define KRB5_GC_CANONICALIZE (1U << 7) 450 1.3 christos #define KRB5_GC_ANONYMOUS (1U << 8) 451 1.1 elric 452 1.1 elric /* constants for compare_creds (and cc_retrieve_cred) */ 453 1.1 elric #define KRB5_TC_DONT_MATCH_REALM (1U << 31) 454 1.1 elric #define KRB5_TC_MATCH_KEYTYPE (1U << 30) 455 1.1 elric #define KRB5_TC_MATCH_KTYPE KRB5_TC_MATCH_KEYTYPE /* MIT name */ 456 1.1 elric #define KRB5_TC_MATCH_SRV_NAMEONLY (1 << 29) 457 1.1 elric #define KRB5_TC_MATCH_FLAGS_EXACT (1 << 28) 458 1.1 elric #define KRB5_TC_MATCH_FLAGS (1 << 27) 459 1.1 elric #define KRB5_TC_MATCH_TIMES_EXACT (1 << 26) 460 1.1 elric #define KRB5_TC_MATCH_TIMES (1 << 25) 461 1.1 elric #define KRB5_TC_MATCH_AUTHDATA (1 << 24) 462 1.1 elric #define KRB5_TC_MATCH_2ND_TKT (1 << 23) 463 1.1 elric #define KRB5_TC_MATCH_IS_SKEY (1 << 22) 464 1.1 elric 465 1.1 elric /* constants for get_flags and set_flags */ 466 1.1 elric #define KRB5_TC_OPENCLOSE 0x00000001 467 1.1 elric #define KRB5_TC_NOTICKET 0x00000002 468 1.1 elric 469 1.1 elric typedef AuthorizationData krb5_authdata; 470 1.1 elric 471 1.1 elric typedef KRB_ERROR krb5_error; 472 1.1 elric 473 1.1 elric typedef struct krb5_creds { 474 1.1 elric krb5_principal client; 475 1.1 elric krb5_principal server; 476 1.1 elric krb5_keyblock session; 477 1.1 elric krb5_times times; 478 1.1 elric krb5_data ticket; 479 1.1 elric krb5_data second_ticket; 480 1.1 elric krb5_authdata authdata; 481 1.1 elric krb5_addresses addresses; 482 1.1 elric krb5_ticket_flags flags; 483 1.1 elric } krb5_creds; 484 1.1 elric 485 1.1 elric typedef struct krb5_cc_cache_cursor_data *krb5_cc_cache_cursor; 486 1.1 elric 487 1.1 elric #define KRB5_CC_OPS_VERSION 3 488 1.1 elric 489 1.1 elric typedef struct krb5_cc_ops { 490 1.1 elric int version; 491 1.1 elric const char *prefix; 492 1.1 elric const char* (KRB5_CALLCONV * get_name)(krb5_context, krb5_ccache); 493 1.1 elric krb5_error_code (KRB5_CALLCONV * resolve)(krb5_context, krb5_ccache *, const char *); 494 1.1 elric krb5_error_code (KRB5_CALLCONV * gen_new)(krb5_context, krb5_ccache *); 495 1.1 elric krb5_error_code (KRB5_CALLCONV * init)(krb5_context, krb5_ccache, krb5_principal); 496 1.1 elric krb5_error_code (KRB5_CALLCONV * destroy)(krb5_context, krb5_ccache); 497 1.1 elric krb5_error_code (KRB5_CALLCONV * close)(krb5_context, krb5_ccache); 498 1.1 elric krb5_error_code (KRB5_CALLCONV * store)(krb5_context, krb5_ccache, krb5_creds*); 499 1.1 elric krb5_error_code (KRB5_CALLCONV * retrieve)(krb5_context, krb5_ccache, 500 1.1 elric krb5_flags, const krb5_creds*, krb5_creds *); 501 1.1 elric krb5_error_code (KRB5_CALLCONV * get_princ)(krb5_context, krb5_ccache, krb5_principal*); 502 1.1 elric krb5_error_code (KRB5_CALLCONV * get_first)(krb5_context, krb5_ccache, krb5_cc_cursor *); 503 1.1 elric krb5_error_code (KRB5_CALLCONV * get_next)(krb5_context, krb5_ccache, 504 1.1 elric krb5_cc_cursor*, krb5_creds*); 505 1.1 elric krb5_error_code (KRB5_CALLCONV * end_get)(krb5_context, krb5_ccache, krb5_cc_cursor*); 506 1.1 elric krb5_error_code (KRB5_CALLCONV * remove_cred)(krb5_context, krb5_ccache, 507 1.1 elric krb5_flags, krb5_creds*); 508 1.1 elric krb5_error_code (KRB5_CALLCONV * set_flags)(krb5_context, krb5_ccache, krb5_flags); 509 1.1 elric int (KRB5_CALLCONV * get_version)(krb5_context, krb5_ccache); 510 1.1 elric krb5_error_code (KRB5_CALLCONV * get_cache_first)(krb5_context, krb5_cc_cursor *); 511 1.1 elric krb5_error_code (KRB5_CALLCONV * get_cache_next)(krb5_context, krb5_cc_cursor, 512 1.1 elric krb5_ccache *); 513 1.1 elric krb5_error_code (KRB5_CALLCONV * end_cache_get)(krb5_context, krb5_cc_cursor); 514 1.1 elric krb5_error_code (KRB5_CALLCONV * move)(krb5_context, krb5_ccache, krb5_ccache); 515 1.1 elric krb5_error_code (KRB5_CALLCONV * get_default_name)(krb5_context, char **); 516 1.1 elric krb5_error_code (KRB5_CALLCONV * set_default)(krb5_context, krb5_ccache); 517 1.1 elric krb5_error_code (KRB5_CALLCONV * lastchange)(krb5_context, krb5_ccache, krb5_timestamp *); 518 1.1 elric krb5_error_code (KRB5_CALLCONV * set_kdc_offset)(krb5_context, krb5_ccache, krb5_deltat); 519 1.1 elric krb5_error_code (KRB5_CALLCONV * get_kdc_offset)(krb5_context, krb5_ccache, krb5_deltat *); 520 1.1 elric } krb5_cc_ops; 521 1.1 elric 522 1.1 elric struct krb5_log_facility; 523 1.1 elric 524 1.1 elric struct krb5_config_binding { 525 1.1 elric enum { krb5_config_string, krb5_config_list } type; 526 1.1 elric char *name; 527 1.1 elric struct krb5_config_binding *next; 528 1.1 elric union { 529 1.1 elric char *string; 530 1.1 elric struct krb5_config_binding *list; 531 1.1 elric void *generic; 532 1.1 elric } u; 533 1.1 elric }; 534 1.1 elric 535 1.1 elric typedef struct krb5_config_binding krb5_config_binding; 536 1.1 elric 537 1.1 elric typedef krb5_config_binding krb5_config_section; 538 1.1 elric 539 1.1 elric typedef struct krb5_ticket { 540 1.1 elric EncTicketPart ticket; 541 1.1 elric krb5_principal client; 542 1.1 elric krb5_principal server; 543 1.1 elric } krb5_ticket; 544 1.1 elric 545 1.1 elric typedef Authenticator krb5_authenticator_data; 546 1.1 elric 547 1.1 elric typedef krb5_authenticator_data *krb5_authenticator; 548 1.1 elric 549 1.1 elric struct krb5_rcache_data; 550 1.1 elric typedef struct krb5_rcache_data *krb5_rcache; 551 1.1 elric typedef Authenticator krb5_donot_replay; 552 1.1 elric 553 1.1 elric #define KRB5_STORAGE_HOST_BYTEORDER 0x01 /* old */ 554 1.1 elric #define KRB5_STORAGE_PRINCIPAL_WRONG_NUM_COMPONENTS 0x02 555 1.1 elric #define KRB5_STORAGE_PRINCIPAL_NO_NAME_TYPE 0x04 556 1.1 elric #define KRB5_STORAGE_KEYBLOCK_KEYTYPE_TWICE 0x08 557 1.1 elric #define KRB5_STORAGE_BYTEORDER_MASK 0x60 558 1.1 elric #define KRB5_STORAGE_BYTEORDER_BE 0x00 /* default */ 559 1.1 elric #define KRB5_STORAGE_BYTEORDER_LE 0x20 560 1.1 elric #define KRB5_STORAGE_BYTEORDER_HOST 0x40 561 1.1 elric #define KRB5_STORAGE_CREDS_FLAGS_WRONG_BITORDER 0x80 562 1.1 elric 563 1.1 elric struct krb5_storage_data; 564 1.1 elric typedef struct krb5_storage_data krb5_storage; 565 1.1 elric 566 1.1 elric typedef struct krb5_keytab_entry { 567 1.1 elric krb5_principal principal; 568 1.1 elric krb5_kvno vno; 569 1.1 elric krb5_keyblock keyblock; 570 1.1 elric uint32_t timestamp; 571 1.1 elric uint32_t flags; 572 1.1 elric krb5_principals aliases; 573 1.1 elric } krb5_keytab_entry; 574 1.1 elric 575 1.1 elric typedef struct krb5_kt_cursor { 576 1.1 elric int fd; 577 1.1 elric krb5_storage *sp; 578 1.1 elric void *data; 579 1.1 elric } krb5_kt_cursor; 580 1.1 elric 581 1.1 elric struct krb5_keytab_data; 582 1.1 elric 583 1.1 elric typedef struct krb5_keytab_data *krb5_keytab; 584 1.1 elric 585 1.1 elric #define KRB5_KT_PREFIX_MAX_LEN 30 586 1.1 elric 587 1.1 elric struct krb5_keytab_data { 588 1.1 elric const char *prefix; 589 1.1 elric krb5_error_code (KRB5_CALLCONV * resolve)(krb5_context, const char*, krb5_keytab); 590 1.1 elric krb5_error_code (KRB5_CALLCONV * get_name)(krb5_context, krb5_keytab, char*, size_t); 591 1.1 elric krb5_error_code (KRB5_CALLCONV * close)(krb5_context, krb5_keytab); 592 1.1 elric krb5_error_code (KRB5_CALLCONV * destroy)(krb5_context, krb5_keytab); 593 1.1 elric krb5_error_code (KRB5_CALLCONV * get)(krb5_context, krb5_keytab, krb5_const_principal, 594 1.1 elric krb5_kvno, krb5_enctype, krb5_keytab_entry*); 595 1.1 elric krb5_error_code (KRB5_CALLCONV * start_seq_get)(krb5_context, krb5_keytab, krb5_kt_cursor*); 596 1.1 elric krb5_error_code (KRB5_CALLCONV * next_entry)(krb5_context, krb5_keytab, 597 1.1 elric krb5_keytab_entry*, krb5_kt_cursor*); 598 1.1 elric krb5_error_code (KRB5_CALLCONV * end_seq_get)(krb5_context, krb5_keytab, krb5_kt_cursor*); 599 1.1 elric krb5_error_code (KRB5_CALLCONV * add)(krb5_context, krb5_keytab, krb5_keytab_entry*); 600 1.1 elric krb5_error_code (KRB5_CALLCONV * remove)(krb5_context, krb5_keytab, krb5_keytab_entry*); 601 1.1 elric void *data; 602 1.1 elric int32_t version; 603 1.1 elric }; 604 1.1 elric 605 1.1 elric typedef struct krb5_keytab_data krb5_kt_ops; 606 1.1 elric 607 1.1 elric struct krb5_keytab_key_proc_args { 608 1.1 elric krb5_keytab keytab; 609 1.1 elric krb5_principal principal; 610 1.1 elric }; 611 1.1 elric 612 1.1 elric typedef struct krb5_keytab_key_proc_args krb5_keytab_key_proc_args; 613 1.1 elric 614 1.1 elric typedef struct krb5_replay_data { 615 1.1 elric krb5_timestamp timestamp; 616 1.1 elric int32_t usec; 617 1.1 elric uint32_t seq; 618 1.1 elric } krb5_replay_data; 619 1.1 elric 620 1.1 elric /* flags for krb5_auth_con_setflags */ 621 1.1 elric enum { 622 1.1 elric KRB5_AUTH_CONTEXT_DO_TIME = 1, 623 1.1 elric KRB5_AUTH_CONTEXT_RET_TIME = 2, 624 1.1 elric KRB5_AUTH_CONTEXT_DO_SEQUENCE = 4, 625 1.1 elric KRB5_AUTH_CONTEXT_RET_SEQUENCE = 8, 626 1.1 elric KRB5_AUTH_CONTEXT_PERMIT_ALL = 16, 627 1.1 elric KRB5_AUTH_CONTEXT_USE_SUBKEY = 32, 628 1.1 elric KRB5_AUTH_CONTEXT_CLEAR_FORWARDED_CRED = 64 629 1.1 elric }; 630 1.1 elric 631 1.1 elric /* flags for krb5_auth_con_genaddrs */ 632 1.1 elric enum { 633 1.1 elric KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR = 1, 634 1.1 elric KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR = 3, 635 1.1 elric KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR = 4, 636 1.1 elric KRB5_AUTH_CONTEXT_GENERATE_REMOTE_FULL_ADDR = 12 637 1.1 elric }; 638 1.1 elric 639 1.1 elric typedef struct krb5_auth_context_data { 640 1.1 elric unsigned int flags; 641 1.1 elric 642 1.1 elric krb5_address *local_address; 643 1.1 elric krb5_address *remote_address; 644 1.1 elric int16_t local_port; 645 1.1 elric int16_t remote_port; 646 1.1 elric krb5_keyblock *keyblock; 647 1.1 elric krb5_keyblock *local_subkey; 648 1.1 elric krb5_keyblock *remote_subkey; 649 1.1 elric 650 1.1 elric uint32_t local_seqnumber; 651 1.1 elric uint32_t remote_seqnumber; 652 1.1 elric 653 1.1 elric krb5_authenticator authenticator; 654 1.1 elric 655 1.1 elric krb5_pointer i_vector; 656 1.1 elric 657 1.1 elric krb5_rcache rcache; 658 1.1 elric 659 1.1 elric krb5_keytype keytype; /* requested key type ? */ 660 1.1 elric krb5_cksumtype cksumtype; /* requested checksum type! */ 661 1.2 christos 662 1.2 christos AuthorizationData *auth_data; 663 1.1 elric 664 1.1 elric }krb5_auth_context_data, *krb5_auth_context; 665 1.1 elric 666 1.1 elric typedef struct { 667 1.1 elric KDC_REP kdc_rep; 668 1.1 elric EncKDCRepPart enc_part; 669 1.1 elric KRB_ERROR error; 670 1.1 elric } krb5_kdc_rep; 671 1.1 elric 672 1.1 elric extern const char *heimdal_version, *heimdal_long_version; 673 1.1 elric 674 1.1 elric typedef void (KRB5_CALLCONV * krb5_log_log_func_t)(const char*, const char*, void*); 675 1.1 elric typedef void (KRB5_CALLCONV * krb5_log_close_func_t)(void*); 676 1.1 elric 677 1.1 elric typedef struct krb5_log_facility { 678 1.1 elric char *program; 679 1.1 elric int len; 680 1.1 elric struct facility *val; 681 1.1 elric } krb5_log_facility; 682 1.1 elric 683 1.1 elric typedef EncAPRepPart krb5_ap_rep_enc_part; 684 1.1 elric 685 1.1 elric #define KRB5_RECVAUTH_IGNORE_VERSION 1 686 1.1 elric 687 1.1 elric #define KRB5_SENDAUTH_VERSION "KRB5_SENDAUTH_V1.0" 688 1.1 elric 689 1.1 elric #define KRB5_TGS_NAME_SIZE (6) 690 1.1 elric #define KRB5_TGS_NAME ("krbtgt") 691 1.1 elric #define KRB5_WELLKNOWN_NAME ("WELLKNOWN") 692 1.1 elric #define KRB5_ANON_NAME ("ANONYMOUS") 693 1.2 christos #define KRB5_ANON_REALM ("WELLKNOWN:ANONYMOUS") 694 1.2 christos #define KRB5_WELLKNOWN_ORG_H5L_REALM ("WELLKNOWN:ORG.H5L") 695 1.1 elric #define KRB5_DIGEST_NAME ("digest") 696 1.1 elric 697 1.2 christos 698 1.2 christos #define KRB5_PKU2U_REALM_NAME ("WELLKNOWN:PKU2U") 699 1.2 christos #define KRB5_LKDC_REALM_NAME ("WELLKNOWN:COM.APPLE.LKDC") 700 1.2 christos 701 1.2 christos #define KRB5_GSS_HOSTBASED_SERVICE_NAME ("WELLKNOWN:ORG.H5L.HOSTBASED-SERVICE") 702 1.2 christos #define KRB5_GSS_REFERALS_REALM_NAME ("WELLKNOWN:ORG.H5L.REFERALS-REALM") 703 1.2 christos 704 1.1 elric typedef enum { 705 1.1 elric KRB5_PROMPT_TYPE_PASSWORD = 0x1, 706 1.1 elric KRB5_PROMPT_TYPE_NEW_PASSWORD = 0x2, 707 1.1 elric KRB5_PROMPT_TYPE_NEW_PASSWORD_AGAIN = 0x3, 708 1.1 elric KRB5_PROMPT_TYPE_PREAUTH = 0x4, 709 1.1 elric KRB5_PROMPT_TYPE_INFO = 0x5 710 1.1 elric } krb5_prompt_type; 711 1.1 elric 712 1.1 elric typedef struct _krb5_prompt { 713 1.1 elric const char *prompt; 714 1.1 elric int hidden; 715 1.1 elric krb5_data *reply; 716 1.1 elric krb5_prompt_type type; 717 1.1 elric } krb5_prompt; 718 1.1 elric 719 1.1 elric typedef int (KRB5_CALLCONV * krb5_prompter_fct)(krb5_context /*context*/, 720 1.1 elric void * /*data*/, 721 1.1 elric const char * /*name*/, 722 1.1 elric const char * /*banner*/, 723 1.1 elric int /*num_prompts*/, 724 1.1 elric krb5_prompt /*prompts*/[]); 725 1.1 elric typedef krb5_error_code (KRB5_CALLCONV * krb5_key_proc)(krb5_context /*context*/, 726 1.1 elric krb5_enctype /*type*/, 727 1.1 elric krb5_salt /*salt*/, 728 1.1 elric krb5_const_pointer /*keyseed*/, 729 1.1 elric krb5_keyblock ** /*key*/); 730 1.1 elric typedef krb5_error_code (KRB5_CALLCONV * krb5_decrypt_proc)(krb5_context /*context*/, 731 1.1 elric krb5_keyblock * /*key*/, 732 1.1 elric krb5_key_usage /*usage*/, 733 1.1 elric krb5_const_pointer /*decrypt_arg*/, 734 1.1 elric krb5_kdc_rep * /*dec_rep*/); 735 1.1 elric typedef krb5_error_code (KRB5_CALLCONV * krb5_s2k_proc)(krb5_context /*context*/, 736 1.1 elric krb5_enctype /*type*/, 737 1.1 elric krb5_const_pointer /*keyseed*/, 738 1.1 elric krb5_salt /*salt*/, 739 1.1 elric krb5_data * /*s2kparms*/, 740 1.1 elric krb5_keyblock ** /*key*/); 741 1.1 elric 742 1.1 elric struct _krb5_get_init_creds_opt_private; 743 1.1 elric 744 1.1 elric struct _krb5_get_init_creds_opt { 745 1.1 elric krb5_flags flags; 746 1.1 elric krb5_deltat tkt_life; 747 1.1 elric krb5_deltat renew_life; 748 1.1 elric int forwardable; 749 1.1 elric int proxiable; 750 1.1 elric int anonymous; 751 1.2 christos int change_password_prompt; 752 1.1 elric krb5_enctype *etype_list; 753 1.1 elric int etype_list_length; 754 1.1 elric krb5_addresses *address_list; 755 1.1 elric /* XXX the next three should not be used, as they may be 756 1.1 elric removed later */ 757 1.1 elric krb5_preauthtype *preauth_list; 758 1.1 elric int preauth_list_length; 759 1.1 elric krb5_data *salt; 760 1.1 elric struct _krb5_get_init_creds_opt_private *opt_private; 761 1.1 elric }; 762 1.1 elric 763 1.1 elric typedef struct _krb5_get_init_creds_opt krb5_get_init_creds_opt; 764 1.1 elric 765 1.1 elric #define KRB5_GET_INIT_CREDS_OPT_TKT_LIFE 0x0001 766 1.1 elric #define KRB5_GET_INIT_CREDS_OPT_RENEW_LIFE 0x0002 767 1.1 elric #define KRB5_GET_INIT_CREDS_OPT_FORWARDABLE 0x0004 768 1.1 elric #define KRB5_GET_INIT_CREDS_OPT_PROXIABLE 0x0008 769 1.1 elric #define KRB5_GET_INIT_CREDS_OPT_ETYPE_LIST 0x0010 770 1.1 elric #define KRB5_GET_INIT_CREDS_OPT_ADDRESS_LIST 0x0020 771 1.1 elric #define KRB5_GET_INIT_CREDS_OPT_PREAUTH_LIST 0x0040 772 1.1 elric #define KRB5_GET_INIT_CREDS_OPT_SALT 0x0080 /* no supported */ 773 1.1 elric #define KRB5_GET_INIT_CREDS_OPT_ANONYMOUS 0x0100 774 1.1 elric #define KRB5_GET_INIT_CREDS_OPT_DISABLE_TRANSITED_CHECK 0x0200 775 1.2 christos #define KRB5_GET_INIT_CREDS_OPT_CHANGE_PASSWORD_PROMPT 0x0400 776 1.1 elric 777 1.1 elric /* krb5_init_creds_step flags argument */ 778 1.1 elric #define KRB5_INIT_CREDS_STEP_FLAG_CONTINUE 0x0001 779 1.1 elric 780 1.1 elric typedef struct _krb5_verify_init_creds_opt { 781 1.1 elric krb5_flags flags; 782 1.1 elric int ap_req_nofail; 783 1.1 elric } krb5_verify_init_creds_opt; 784 1.1 elric 785 1.1 elric #define KRB5_VERIFY_INIT_CREDS_OPT_AP_REQ_NOFAIL 0x0001 786 1.1 elric 787 1.1 elric typedef struct krb5_verify_opt { 788 1.1 elric unsigned int flags; 789 1.1 elric krb5_ccache ccache; 790 1.1 elric krb5_keytab keytab; 791 1.1 elric krb5_boolean secure; 792 1.1 elric const char *service; 793 1.1 elric } krb5_verify_opt; 794 1.1 elric 795 1.1 elric #define KRB5_VERIFY_LREALMS 1 796 1.1 elric #define KRB5_VERIFY_NO_ADDRESSES 2 797 1.1 elric 798 1.1 elric #define KRB5_KPASSWD_VERS_CHANGEPW 1 799 1.1 elric #define KRB5_KPASSWD_VERS_SETPW 0xff80 800 1.1 elric 801 1.1 elric #define KRB5_KPASSWD_SUCCESS 0 802 1.1 elric #define KRB5_KPASSWD_MALFORMED 1 803 1.1 elric #define KRB5_KPASSWD_HARDERROR 2 804 1.1 elric #define KRB5_KPASSWD_AUTHERROR 3 805 1.1 elric #define KRB5_KPASSWD_SOFTERROR 4 806 1.1 elric #define KRB5_KPASSWD_ACCESSDENIED 5 807 1.1 elric #define KRB5_KPASSWD_BAD_VERSION 6 808 1.1 elric #define KRB5_KPASSWD_INITIAL_FLAG_NEEDED 7 809 1.1 elric 810 1.1 elric #define KPASSWD_PORT 464 811 1.1 elric 812 1.1 elric /* types for the new krbhst interface */ 813 1.1 elric struct krb5_krbhst_data; 814 1.1 elric typedef struct krb5_krbhst_data *krb5_krbhst_handle; 815 1.1 elric 816 1.1 elric #define KRB5_KRBHST_KDC 1 817 1.1 elric #define KRB5_KRBHST_ADMIN 2 818 1.1 elric #define KRB5_KRBHST_CHANGEPW 3 819 1.1 elric #define KRB5_KRBHST_KRB524 4 820 1.1 elric #define KRB5_KRBHST_KCA 5 821 1.1 elric 822 1.1 elric typedef struct krb5_krbhst_info { 823 1.1 elric enum { KRB5_KRBHST_UDP, 824 1.1 elric KRB5_KRBHST_TCP, 825 1.1 elric KRB5_KRBHST_HTTP } proto; 826 1.1 elric unsigned short port; 827 1.1 elric unsigned short def_port; 828 1.1 elric struct addrinfo *ai; 829 1.1 elric struct krb5_krbhst_info *next; 830 1.1 elric char hostname[1]; /* has to come last */ 831 1.1 elric } krb5_krbhst_info; 832 1.1 elric 833 1.1 elric /* flags for krb5_krbhst_init_flags (and krb5_send_to_kdc_flags) */ 834 1.1 elric enum { 835 1.1 elric KRB5_KRBHST_FLAGS_MASTER = 1, 836 1.1 elric KRB5_KRBHST_FLAGS_LARGE_MSG = 2 837 1.1 elric }; 838 1.1 elric 839 1.2 christos typedef krb5_error_code (*krb5_sendto_prexmit)(krb5_context, int, void *, int, krb5_data *); 840 1.1 elric typedef krb5_error_code 841 1.1 elric (KRB5_CALLCONV * krb5_send_to_kdc_func)(krb5_context, void *, krb5_krbhst_info *, time_t, 842 1.1 elric const krb5_data *, krb5_data *); 843 1.1 elric 844 1.1 elric /** flags for krb5_parse_name_flags */ 845 1.1 elric enum { 846 1.1 elric KRB5_PRINCIPAL_PARSE_NO_REALM = 1, /**< Require that there are no realm */ 847 1.1 elric KRB5_PRINCIPAL_PARSE_REQUIRE_REALM = 2, /**< Require a realm present */ 848 1.2 christos KRB5_PRINCIPAL_PARSE_ENTERPRISE = 4, /**< Parse as a NT-ENTERPRISE name */ 849 1.2 christos KRB5_PRINCIPAL_PARSE_IGNORE_REALM = 8, /**< Ignore realm if present */ 850 1.2 christos KRB5_PRINCIPAL_PARSE_NO_DEF_REALM = 16 /**< Don't default the realm */ 851 1.1 elric }; 852 1.1 elric 853 1.1 elric /** flags for krb5_unparse_name_flags */ 854 1.1 elric enum { 855 1.1 elric KRB5_PRINCIPAL_UNPARSE_SHORT = 1, /**< No realm if it is the default realm */ 856 1.1 elric KRB5_PRINCIPAL_UNPARSE_NO_REALM = 2, /**< No realm */ 857 1.1 elric KRB5_PRINCIPAL_UNPARSE_DISPLAY = 4 /**< No quoting */ 858 1.1 elric }; 859 1.1 elric 860 1.1 elric typedef struct krb5_sendto_ctx_data *krb5_sendto_ctx; 861 1.1 elric 862 1.1 elric #define KRB5_SENDTO_DONE 0 863 1.2 christos #define KRB5_SENDTO_RESET 1 864 1.1 elric #define KRB5_SENDTO_CONTINUE 2 865 1.2 christos #define KRB5_SENDTO_TIMEOUT 3 866 1.2 christos #define KRB5_SENDTO_INITIAL 4 867 1.2 christos #define KRB5_SENDTO_FILTER 5 868 1.2 christos #define KRB5_SENDTO_FAILED 6 869 1.2 christos #define KRB5_SENDTO_KRBHST 7 870 1.1 elric 871 1.1 elric typedef krb5_error_code 872 1.1 elric (KRB5_CALLCONV * krb5_sendto_ctx_func)(krb5_context, krb5_sendto_ctx, void *, 873 1.1 elric const krb5_data *, int *); 874 1.1 elric 875 1.1 elric struct krb5_plugin; 876 1.1 elric enum krb5_plugin_type { 877 1.1 elric PLUGIN_TYPE_DATA = 1, 878 1.1 elric PLUGIN_TYPE_FUNC 879 1.1 elric }; 880 1.1 elric 881 1.2 christos #define KRB5_PLUGIN_INVOKE_ALL 1 882 1.2 christos 883 1.1 elric struct credentials; /* this is to keep the compiler happy */ 884 1.1 elric struct getargs; 885 1.1 elric struct sockaddr; 886 1.1 elric 887 1.1 elric /** 888 1.1 elric * Semi private, not stable yet 889 1.1 elric */ 890 1.1 elric 891 1.1 elric typedef struct krb5_crypto_iov { 892 1.1 elric unsigned int flags; 893 1.1 elric /* ignored */ 894 1.1 elric #define KRB5_CRYPTO_TYPE_EMPTY 0 895 1.1 elric /* OUT krb5_crypto_length(KRB5_CRYPTO_TYPE_HEADER) */ 896 1.1 elric #define KRB5_CRYPTO_TYPE_HEADER 1 897 1.1 elric /* IN and OUT */ 898 1.1 elric #define KRB5_CRYPTO_TYPE_DATA 2 899 1.1 elric /* IN */ 900 1.1 elric #define KRB5_CRYPTO_TYPE_SIGN_ONLY 3 901 1.1 elric /* (only for encryption) OUT krb5_crypto_length(KRB5_CRYPTO_TYPE_TRAILER) */ 902 1.1 elric #define KRB5_CRYPTO_TYPE_PADDING 4 903 1.1 elric /* OUT krb5_crypto_length(KRB5_CRYPTO_TYPE_TRAILER) */ 904 1.1 elric #define KRB5_CRYPTO_TYPE_TRAILER 5 905 1.1 elric /* OUT krb5_crypto_length(KRB5_CRYPTO_TYPE_CHECKSUM) */ 906 1.1 elric #define KRB5_CRYPTO_TYPE_CHECKSUM 6 907 1.1 elric krb5_data data; 908 1.1 elric } krb5_crypto_iov; 909 1.1 elric 910 1.1 elric 911 1.1 elric /* Glue for MIT */ 912 1.1 elric 913 1.1 elric typedef struct { 914 1.1 elric int32_t lr_type; 915 1.1 elric krb5_timestamp value; 916 1.1 elric } krb5_last_req_entry; 917 1.1 elric 918 1.1 elric typedef krb5_error_code 919 1.1 elric (KRB5_CALLCONV * krb5_gic_process_last_req)(krb5_context, krb5_last_req_entry **, void *); 920 1.1 elric 921 1.2 christos typedef struct { 922 1.2 christos krb5_enctype ks_enctype; 923 1.2 christos krb5int32 ks_salttype; 924 1.2 christos }krb5_key_salt_tuple; 925 1.2 christos 926 1.2 christos /* 927 1.2 christos * Name canonicalization rule options 928 1.2 christos */ 929 1.2 christos 930 1.2 christos typedef enum krb5_name_canon_rule_options { 931 1.2 christos KRB5_NCRO_GC_ONLY = 1 << 0, 932 1.2 christos KRB5_NCRO_USE_REFERRALS = 1 << 1, 933 1.2 christos KRB5_NCRO_NO_REFERRALS = 1 << 2, 934 1.2 christos KRB5_NCRO_USE_FAST = 1 << 3, 935 1.2 christos KRB5_NCRO_USE_DNSSEC = 1 << 4, 936 1.2 christos KRB5_NCRO_LOOKUP_REALM = 1 << 5 937 1.2 christos } krb5_name_canon_rule_options; 938 1.2 christos 939 1.2 christos typedef struct krb5_name_canon_rule_data *krb5_name_canon_rule; 940 1.2 christos typedef const struct krb5_name_canon_rule_data *krb5_const_name_canon_rule; 941 1.2 christos typedef struct krb5_name_canon_iterator_data *krb5_name_canon_iterator; 942 1.2 christos 943 1.1 elric /* 944 1.3 christos * krb5_get_init_creds_opt_set_pkinit flags 945 1.3 christos */ 946 1.3 christos 947 1.3 christos #define KRB5_GIC_OPT_PKINIT_USE_ENCKEY 2 /* use RSA, not DH */ 948 1.3 christos #define KRB5_GIC_OPT_PKINIT_ANONYMOUS 4 /* anonymous PKINIT */ 949 1.3 christos #define KRB5_GIC_OPT_PKINIT_BTMM 8 /* reserved by Apple */ 950 1.3 christos #define KRB5_GIC_OPT_PKINIT_NO_KDC_ANCHOR 16 /* do not authenticate KDC */ 951 1.3 christos 952 1.3 christos /* 953 1.3 christos * _krb5_principal_is_anonymous() flags 954 1.3 christos */ 955 1.3 christos #define KRB5_ANON_MATCH_AUTHENTICATED 1 /* authenticated with anon flag */ 956 1.3 christos #define KRB5_ANON_MATCH_UNAUTHENTICATED 2 /* anonymous PKINIT */ 957 1.4 christos #define KRB5_ANON_IGNORE_NAME_TYPE 4 /* don't check the name type */ 958 1.4 christos #define KRB5_ANON_MATCH_ANY ( KRB5_ANON_MATCH_AUTHENTICATED | \ 959 1.4 christos KRB5_ANON_MATCH_UNAUTHENTICATED ) 960 1.4 christos #define KRB5_ANON_MATCH_ANY_NONT ( KRB5_ANON_MATCH_ANY | \ 961 1.4 christos KRB5_ANON_IGNORE_NAME_TYPE ) 962 1.3 christos 963 1.3 christos /* 964 1.1 elric * 965 1.1 elric */ 966 1.1 elric 967 1.1 elric struct hx509_certs_data; 968 1.1 elric 969 1.1 elric #include <krb5/krb5-protos.h> 970 1.1 elric 971 1.1 elric /* variables */ 972 1.1 elric 973 1.1 elric extern KRB5_LIB_VARIABLE const char *krb5_config_file; 974 1.1 elric extern KRB5_LIB_VARIABLE const char *krb5_defkeyname; 975 1.1 elric 976 1.1 elric 977 1.1 elric extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_acc_ops; 978 1.2 christos extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_dcc_ops; 979 1.1 elric extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_fcc_ops; 980 1.1 elric extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_mcc_ops; 981 1.1 elric extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_kcm_ops; 982 1.1 elric extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_akcm_ops; 983 1.1 elric extern KRB5_LIB_VARIABLE const krb5_cc_ops krb5_scc_ops; 984 1.1 elric 985 1.1 elric extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_fkt_ops; 986 1.1 elric extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_wrfkt_ops; 987 1.1 elric extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_javakt_ops; 988 1.1 elric extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_mkt_ops; 989 1.1 elric extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_akf_ops; 990 1.1 elric extern KRB5_LIB_VARIABLE const krb5_kt_ops krb5_any_ops; 991 1.1 elric 992 1.1 elric extern KRB5_LIB_VARIABLE const char *krb5_cc_type_api; 993 1.1 elric extern KRB5_LIB_VARIABLE const char *krb5_cc_type_file; 994 1.1 elric extern KRB5_LIB_VARIABLE const char *krb5_cc_type_memory; 995 1.1 elric extern KRB5_LIB_VARIABLE const char *krb5_cc_type_kcm; 996 1.1 elric extern KRB5_LIB_VARIABLE const char *krb5_cc_type_scc; 997 1.2 christos extern KRB5_LIB_VARIABLE const char *krb5_cc_type_dcc; 998 1.1 elric 999 1.4 christos /* clang analyzer workarounds */ 1000 1.4 christos 1001 1.4 christos #ifdef __clang_analyzer__ 1002 1.4 christos /* 1003 1.4 christos * The clang analyzer (lint) can't know that krb5_enomem() always returns 1004 1.4 christos * non-zero, so code like: 1005 1.4 christos * 1006 1.4 christos * if ((x = malloc(...)) == NULL) 1007 1.4 christos * ret = krb5_enomem(context) 1008 1.4 christos * if (ret == 0) 1009 1.4 christos * *x = ...; 1010 1.4 christos * 1011 1.4 christos * causes false positives. 1012 1.4 christos * 1013 1.4 christos * The fix is to make krb5_enomem() a macro that always evaluates to ENOMEM. 1014 1.4 christos */ 1015 1.4 christos #define krb5_enomem(c) (krb5_enomem(c), ENOMEM) 1016 1.4 christos #endif 1017 1.4 christos 1018 1.1 elric #endif /* __KRB5_H__ */ 1019 1.1 elric 1020