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