xref: /freebsd/crypto/krb5/src/include/k5-int.h (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2*7f2fe78bSCy Schubert /*
3*7f2fe78bSCy Schubert  * Copyright (C) 1989,1990,1991,1992,1993,1994,1995,2000,2001,
4*7f2fe78bSCy Schubert  * 2003,2006,2007,2008,2009 by the Massachusetts Institute of Technology,
5*7f2fe78bSCy Schubert  * Cambridge, MA, USA.  All Rights Reserved.
6*7f2fe78bSCy Schubert  *
7*7f2fe78bSCy Schubert  * This software is being provided to you, the LICENSEE, by the
8*7f2fe78bSCy Schubert  * Massachusetts Institute of Technology (M.I.T.) under the following
9*7f2fe78bSCy Schubert  * license.  By obtaining, using and/or copying this software, you agree
10*7f2fe78bSCy Schubert  * that you have read, understood, and will comply with these terms and
11*7f2fe78bSCy Schubert  * conditions:
12*7f2fe78bSCy Schubert  *
13*7f2fe78bSCy Schubert  * Export of this software from the United States of America may
14*7f2fe78bSCy Schubert  * require a specific license from the United States Government.
15*7f2fe78bSCy Schubert  * It is the responsibility of any person or organization contemplating
16*7f2fe78bSCy Schubert  * export to obtain such a license before exporting.
17*7f2fe78bSCy Schubert  *
18*7f2fe78bSCy Schubert  * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute
19*7f2fe78bSCy Schubert  * this software and its documentation for any purpose and without fee or
20*7f2fe78bSCy Schubert  * royalty is hereby granted, provided that you agree to comply with the
21*7f2fe78bSCy Schubert  * following copyright notice and statements, including the disclaimer, and
22*7f2fe78bSCy Schubert  * that the same appear on ALL copies of the software and documentation,
23*7f2fe78bSCy Schubert  * including modifications that you make for internal use or for
24*7f2fe78bSCy Schubert  * distribution:
25*7f2fe78bSCy Schubert  *
26*7f2fe78bSCy Schubert  * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS
27*7f2fe78bSCy Schubert  * OR WARRANTIES, EXPRESS OR IMPLIED.  By way of example, but not
28*7f2fe78bSCy Schubert  * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF
29*7f2fe78bSCy Schubert  * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
30*7f2fe78bSCy Schubert  * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY
31*7f2fe78bSCy Schubert  * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
32*7f2fe78bSCy Schubert  *
33*7f2fe78bSCy Schubert  * The name of the Massachusetts Institute of Technology or M.I.T. may NOT
34*7f2fe78bSCy Schubert  * be used in advertising or publicity pertaining to distribution of the
35*7f2fe78bSCy Schubert  * software.  Title to copyright in this software and any associated
36*7f2fe78bSCy Schubert  * documentation shall at all times remain with M.I.T., and USER agrees to
37*7f2fe78bSCy Schubert  * preserve same.
38*7f2fe78bSCy Schubert  *
39*7f2fe78bSCy Schubert  * Furthermore if you modify this software you must label
40*7f2fe78bSCy Schubert  * your software as modified software and not distribute it in such a
41*7f2fe78bSCy Schubert  * fashion that it might be confused with the original M.I.T. software.
42*7f2fe78bSCy Schubert  */
43*7f2fe78bSCy Schubert /*
44*7f2fe78bSCy Schubert  * Copyright (C) 1998 by the FundsXpress, INC.
45*7f2fe78bSCy Schubert  *
46*7f2fe78bSCy Schubert  * All rights reserved.
47*7f2fe78bSCy Schubert  *
48*7f2fe78bSCy Schubert  * Export of this software from the United States of America may require
49*7f2fe78bSCy Schubert  * a specific license from the United States Government.  It is the
50*7f2fe78bSCy Schubert  * responsibility of any person or organization contemplating export to
51*7f2fe78bSCy Schubert  * obtain such a license before exporting.
52*7f2fe78bSCy Schubert  *
53*7f2fe78bSCy Schubert  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
54*7f2fe78bSCy Schubert  * distribute this software and its documentation for any purpose and
55*7f2fe78bSCy Schubert  * without fee is hereby granted, provided that the above copyright
56*7f2fe78bSCy Schubert  * notice appear in all copies and that both that copyright notice and
57*7f2fe78bSCy Schubert  * this permission notice appear in supporting documentation, and that
58*7f2fe78bSCy Schubert  * the name of FundsXpress. not be used in advertising or publicity pertaining
59*7f2fe78bSCy Schubert  * to distribution of the software without specific, written prior
60*7f2fe78bSCy Schubert  * permission.  FundsXpress makes no representations about the suitability of
61*7f2fe78bSCy Schubert  * this software for any purpose.  It is provided "as is" without express
62*7f2fe78bSCy Schubert  * or implied warranty.
63*7f2fe78bSCy Schubert  *
64*7f2fe78bSCy Schubert  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
65*7f2fe78bSCy Schubert  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
66*7f2fe78bSCy Schubert  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
67*7f2fe78bSCy Schubert  */
68*7f2fe78bSCy Schubert 
69*7f2fe78bSCy Schubert /*
70*7f2fe78bSCy Schubert  * This prototype for k5-int.h (Krb5 internals include file)
71*7f2fe78bSCy Schubert  * includes the user-visible definitions from krb5.h and then
72*7f2fe78bSCy Schubert  * includes other definitions that are not user-visible but are
73*7f2fe78bSCy Schubert  * required for compiling Kerberos internal routines.
74*7f2fe78bSCy Schubert  *
75*7f2fe78bSCy Schubert  * John Gilmore, Cygnus Support, Sat Jan 21 22:45:52 PST 1995
76*7f2fe78bSCy Schubert  */
77*7f2fe78bSCy Schubert 
78*7f2fe78bSCy Schubert #ifndef _KRB5_INT_H
79*7f2fe78bSCy Schubert #define _KRB5_INT_H
80*7f2fe78bSCy Schubert 
81*7f2fe78bSCy Schubert #ifdef KRB5_GENERAL__
82*7f2fe78bSCy Schubert #error krb5.h included before k5-int.h
83*7f2fe78bSCy Schubert #endif /* KRB5_GENERAL__ */
84*7f2fe78bSCy Schubert 
85*7f2fe78bSCy Schubert #include "osconf.h"
86*7f2fe78bSCy Schubert 
87*7f2fe78bSCy Schubert #if defined(__MACH__) && defined(__APPLE__)
88*7f2fe78bSCy Schubert #       include <TargetConditionals.h>
89*7f2fe78bSCy Schubert #    if TARGET_RT_MAC_CFM
90*7f2fe78bSCy Schubert #       error "Use KfM 4.0 SDK headers for CFM compilation."
91*7f2fe78bSCy Schubert #    endif
92*7f2fe78bSCy Schubert #endif
93*7f2fe78bSCy Schubert 
94*7f2fe78bSCy Schubert /*
95*7f2fe78bSCy Schubert  * Begin "k5-config.h"
96*7f2fe78bSCy Schubert  */
97*7f2fe78bSCy Schubert #ifndef KRB5_CONFIG__
98*7f2fe78bSCy Schubert #define KRB5_CONFIG__
99*7f2fe78bSCy Schubert 
100*7f2fe78bSCy Schubert /*
101*7f2fe78bSCy Schubert  * Machine-type definitions: PC Clone 386 running Microloss Windows
102*7f2fe78bSCy Schubert  */
103*7f2fe78bSCy Schubert 
104*7f2fe78bSCy Schubert #if defined(_MSDOS) || defined(_WIN32)
105*7f2fe78bSCy Schubert #include "win-mac.h"
106*7f2fe78bSCy Schubert 
107*7f2fe78bSCy Schubert /* Kerberos Windows initialization file */
108*7f2fe78bSCy Schubert #define KERBEROS_INI    "kerberos.ini"
109*7f2fe78bSCy Schubert #define INI_FILES       "Files"
110*7f2fe78bSCy Schubert #define INI_KRB_CCACHE  "krb5cc"        /* Location of the ccache */
111*7f2fe78bSCy Schubert #define INI_KRB5_CONF   "krb5.ini"      /* Location of krb5.conf file */
112*7f2fe78bSCy Schubert #endif
113*7f2fe78bSCy Schubert 
114*7f2fe78bSCy Schubert #include "autoconf.h"
115*7f2fe78bSCy Schubert 
116*7f2fe78bSCy Schubert #ifndef KRB5_SYSTYPES__
117*7f2fe78bSCy Schubert #define KRB5_SYSTYPES__
118*7f2fe78bSCy Schubert 
119*7f2fe78bSCy Schubert #ifdef HAVE_SYS_TYPES_H         /* From autoconf.h */
120*7f2fe78bSCy Schubert #include <sys/types.h>
121*7f2fe78bSCy Schubert #else /* HAVE_SYS_TYPES_H */
122*7f2fe78bSCy Schubert typedef unsigned long   u_long;
123*7f2fe78bSCy Schubert typedef unsigned int    u_int;
124*7f2fe78bSCy Schubert typedef unsigned short  u_short;
125*7f2fe78bSCy Schubert typedef unsigned char   u_char;
126*7f2fe78bSCy Schubert #endif /* HAVE_SYS_TYPES_H */
127*7f2fe78bSCy Schubert #endif /* KRB5_SYSTYPES__ */
128*7f2fe78bSCy Schubert 
129*7f2fe78bSCy Schubert 
130*7f2fe78bSCy Schubert #include "k5-platform.h"
131*7f2fe78bSCy Schubert 
132*7f2fe78bSCy Schubert #define KRB5_KDB_MAX_LIFE       (60*60*24) /* one day */
133*7f2fe78bSCy Schubert #define KRB5_KDB_MAX_RLIFE      (60*60*24*7) /* one week */
134*7f2fe78bSCy Schubert #define KRB5_KDB_EXPIRATION     2145830400 /* Thu Jan  1 00:00:00 2038 UTC */
135*7f2fe78bSCy Schubert 
136*7f2fe78bSCy Schubert /*
137*7f2fe78bSCy Schubert  * Windows requires a different api interface to each function. Here
138*7f2fe78bSCy Schubert  * just define it as NULL.
139*7f2fe78bSCy Schubert  */
140*7f2fe78bSCy Schubert #ifndef KRB5_CALLCONV
141*7f2fe78bSCy Schubert #define KRB5_CALLCONV
142*7f2fe78bSCy Schubert #define KRB5_CALLCONV_C
143*7f2fe78bSCy Schubert #endif
144*7f2fe78bSCy Schubert #ifndef O_BINARY
145*7f2fe78bSCy Schubert #define O_BINARY 0
146*7f2fe78bSCy Schubert #endif
147*7f2fe78bSCy Schubert 
148*7f2fe78bSCy Schubert /* #define KRB5_OLD_CRYPTO is done in krb5.h */
149*7f2fe78bSCy Schubert 
150*7f2fe78bSCy Schubert #endif /* KRB5_CONFIG__ */
151*7f2fe78bSCy Schubert 
152*7f2fe78bSCy Schubert /*
153*7f2fe78bSCy Schubert  * End "k5-config.h"
154*7f2fe78bSCy Schubert  */
155*7f2fe78bSCy Schubert 
156*7f2fe78bSCy Schubert /*
157*7f2fe78bSCy Schubert  * After loading the configuration definitions, load the Kerberos definitions.
158*7f2fe78bSCy Schubert  */
159*7f2fe78bSCy Schubert #include <errno.h>
160*7f2fe78bSCy Schubert #include "krb5.h"
161*7f2fe78bSCy Schubert #include <krb5/plugin.h>
162*7f2fe78bSCy Schubert #include "profile.h"
163*7f2fe78bSCy Schubert 
164*7f2fe78bSCy Schubert #include "port-sockets.h"
165*7f2fe78bSCy Schubert #include "socket-utils.h"
166*7f2fe78bSCy Schubert 
167*7f2fe78bSCy Schubert /* Get mutex support; currently used only for the replay cache.  */
168*7f2fe78bSCy Schubert #include "k5-thread.h"
169*7f2fe78bSCy Schubert 
170*7f2fe78bSCy Schubert /* Get error info support.  */
171*7f2fe78bSCy Schubert #include "k5-err.h"
172*7f2fe78bSCy Schubert 
173*7f2fe78bSCy Schubert /* Get string buffer support. */
174*7f2fe78bSCy Schubert #include "k5-buf.h"
175*7f2fe78bSCy Schubert 
176*7f2fe78bSCy Schubert /* Define tracing macros. */
177*7f2fe78bSCy Schubert #include "k5-trace.h"
178*7f2fe78bSCy Schubert 
179*7f2fe78bSCy Schubert /* Profile variables.  Constants are named KRB5_CONF_STRING, where STRING
180*7f2fe78bSCy Schubert  * matches the variable name.  Keep these alphabetized. */
181*7f2fe78bSCy Schubert #define KRB5_CONF_ACL_FILE                     "acl_file"
182*7f2fe78bSCy Schubert #define KRB5_CONF_ADMIN_SERVER                 "admin_server"
183*7f2fe78bSCy Schubert #define KRB5_CONF_ALLOW_DES3                   "allow_des3"
184*7f2fe78bSCy Schubert #define KRB5_CONF_ALLOW_RC4                    "allow_rc4"
185*7f2fe78bSCy Schubert #define KRB5_CONF_ALLOW_WEAK_CRYPTO            "allow_weak_crypto"
186*7f2fe78bSCy Schubert #define KRB5_CONF_AUTH_TO_LOCAL                "auth_to_local"
187*7f2fe78bSCy Schubert #define KRB5_CONF_AUTH_TO_LOCAL_NAMES          "auth_to_local_names"
188*7f2fe78bSCy Schubert #define KRB5_CONF_CANONICALIZE                 "canonicalize"
189*7f2fe78bSCy Schubert #define KRB5_CONF_CCACHE_TYPE                  "ccache_type"
190*7f2fe78bSCy Schubert #define KRB5_CONF_CLOCKSKEW                    "clockskew"
191*7f2fe78bSCy Schubert #define KRB5_CONF_DATABASE_NAME                "database_name"
192*7f2fe78bSCy Schubert #define KRB5_CONF_DB_MODULE_DIR                "db_module_dir"
193*7f2fe78bSCy Schubert #define KRB5_CONF_DEBUG                        "debug"
194*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT                      "default"
195*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT_CCACHE_NAME          "default_ccache_name"
196*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT_CLIENT_KEYTAB_NAME   "default_client_keytab_name"
197*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT_DOMAIN               "default_domain"
198*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT_KEYTAB_NAME          "default_keytab_name"
199*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT_PRINCIPAL_EXPIRATION "default_principal_expiration"
200*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT_PRINCIPAL_FLAGS      "default_principal_flags"
201*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT_RCACHE_NAME          "default_rcache_name"
202*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT_REALM                "default_realm"
203*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT_TGS_ENCTYPES         "default_tgs_enctypes"
204*7f2fe78bSCy Schubert #define KRB5_CONF_DEFAULT_TKT_ENCTYPES         "default_tkt_enctypes"
205*7f2fe78bSCy Schubert #define KRB5_CONF_DICT_FILE                    "dict_file"
206*7f2fe78bSCy Schubert #define KRB5_CONF_DISABLE                      "disable"
207*7f2fe78bSCy Schubert #define KRB5_CONF_DISABLE_ENCRYPTED_TIMESTAMP  "disable_encrypted_timestamp"
208*7f2fe78bSCy Schubert #define KRB5_CONF_DISABLE_LAST_SUCCESS         "disable_last_success"
209*7f2fe78bSCy Schubert #define KRB5_CONF_DISABLE_LOCKOUT              "disable_lockout"
210*7f2fe78bSCy Schubert #define KRB5_CONF_DISABLE_PAC                  "disable_pac"
211*7f2fe78bSCy Schubert #define KRB5_CONF_DNS_CANONICALIZE_HOSTNAME    "dns_canonicalize_hostname"
212*7f2fe78bSCy Schubert #define KRB5_CONF_DNS_FALLBACK                 "dns_fallback"
213*7f2fe78bSCy Schubert #define KRB5_CONF_DNS_LOOKUP_KDC               "dns_lookup_kdc"
214*7f2fe78bSCy Schubert #define KRB5_CONF_DNS_LOOKUP_REALM             "dns_lookup_realm"
215*7f2fe78bSCy Schubert #define KRB5_CONF_DNS_URI_LOOKUP               "dns_uri_lookup"
216*7f2fe78bSCy Schubert #define KRB5_CONF_DOMAIN_REALM                 "domain_realm"
217*7f2fe78bSCy Schubert #define KRB5_CONF_ENABLE_ONLY                  "enable_only"
218*7f2fe78bSCy Schubert #define KRB5_CONF_ENCRYPTED_CHALLENGE_INDICATOR "encrypted_challenge_indicator"
219*7f2fe78bSCy Schubert #define KRB5_CONF_ENFORCE_OK_AS_DELEGATE       "enforce_ok_as_delegate"
220*7f2fe78bSCy Schubert #define KRB5_CONF_ERR_FMT                      "err_fmt"
221*7f2fe78bSCy Schubert #define KRB5_CONF_EXTRA_ADDRESSES              "extra_addresses"
222*7f2fe78bSCy Schubert #define KRB5_CONF_FORWARDABLE                  "forwardable"
223*7f2fe78bSCy Schubert #define KRB5_CONF_HOST_BASED_SERVICES          "host_based_services"
224*7f2fe78bSCy Schubert #define KRB5_CONF_HTTP_ANCHORS                 "http_anchors"
225*7f2fe78bSCy Schubert #define KRB5_CONF_IGNORE_ACCEPTOR_HOSTNAME     "ignore_acceptor_hostname"
226*7f2fe78bSCy Schubert #define KRB5_CONF_IPROP_ENABLE                 "iprop_enable"
227*7f2fe78bSCy Schubert #define KRB5_CONF_IPROP_LISTEN                 "iprop_listen"
228*7f2fe78bSCy Schubert #define KRB5_CONF_IPROP_LOGFILE                "iprop_logfile"
229*7f2fe78bSCy Schubert #define KRB5_CONF_IPROP_MASTER_ULOGSIZE        "iprop_master_ulogsize"
230*7f2fe78bSCy Schubert #define KRB5_CONF_IPROP_PORT                   "iprop_port"
231*7f2fe78bSCy Schubert #define KRB5_CONF_IPROP_RESYNC_TIMEOUT         "iprop_resync_timeout"
232*7f2fe78bSCy Schubert #define KRB5_CONF_IPROP_REPLICA_POLL           "iprop_replica_poll"
233*7f2fe78bSCy Schubert #define KRB5_CONF_IPROP_SLAVE_POLL             "iprop_slave_poll"
234*7f2fe78bSCy Schubert #define KRB5_CONF_IPROP_ULOGSIZE               "iprop_ulogsize"
235*7f2fe78bSCy Schubert #define KRB5_CONF_K5LOGIN_AUTHORITATIVE        "k5login_authoritative"
236*7f2fe78bSCy Schubert #define KRB5_CONF_K5LOGIN_DIRECTORY            "k5login_directory"
237*7f2fe78bSCy Schubert #define KRB5_CONF_KADMIND_LISTEN               "kadmind_listen"
238*7f2fe78bSCy Schubert #define KRB5_CONF_KADMIND_PORT                 "kadmind_port"
239*7f2fe78bSCy Schubert #define KRB5_CONF_KCM_MACH_SERVICE             "kcm_mach_service"
240*7f2fe78bSCy Schubert #define KRB5_CONF_KCM_SOCKET                   "kcm_socket"
241*7f2fe78bSCy Schubert #define KRB5_CONF_KDC                          "kdc"
242*7f2fe78bSCy Schubert #define KRB5_CONF_KDCDEFAULTS                  "kdcdefaults"
243*7f2fe78bSCy Schubert #define KRB5_CONF_KDC_DEFAULT_OPTIONS          "kdc_default_options"
244*7f2fe78bSCy Schubert #define KRB5_CONF_KDC_LISTEN                   "kdc_listen"
245*7f2fe78bSCy Schubert #define KRB5_CONF_KDC_MAX_DGRAM_REPLY_SIZE     "kdc_max_dgram_reply_size"
246*7f2fe78bSCy Schubert #define KRB5_CONF_KDC_PORTS                    "kdc_ports"
247*7f2fe78bSCy Schubert #define KRB5_CONF_KDC_TCP_PORTS                "kdc_tcp_ports"
248*7f2fe78bSCy Schubert #define KRB5_CONF_KDC_TCP_LISTEN               "kdc_tcp_listen"
249*7f2fe78bSCy Schubert #define KRB5_CONF_KDC_TCP_LISTEN_BACKLOG       "kdc_tcp_listen_backlog"
250*7f2fe78bSCy Schubert #define KRB5_CONF_KDC_TIMESYNC                 "kdc_timesync"
251*7f2fe78bSCy Schubert #define KRB5_CONF_KEY_STASH_FILE               "key_stash_file"
252*7f2fe78bSCy Schubert #define KRB5_CONF_KPASSWD_LISTEN               "kpasswd_listen"
253*7f2fe78bSCy Schubert #define KRB5_CONF_KPASSWD_PORT                 "kpasswd_port"
254*7f2fe78bSCy Schubert #define KRB5_CONF_KPASSWD_SERVER               "kpasswd_server"
255*7f2fe78bSCy Schubert #define KRB5_CONF_KRB524_SERVER                "krb524_server"
256*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_CONNS_PER_SERVER        "ldap_conns_per_server"
257*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KADMIND_DN              "ldap_kadmind_dn"
258*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KADMIND_SASL_AUTHCID    "ldap_kadmind_sasl_authcid"
259*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KADMIND_SASL_AUTHZID    "ldap_kadmind_sasl_authzid"
260*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KADMIND_SASL_MECH       "ldap_kadmind_sasl_mech"
261*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KADMIND_SASL_REALM      "ldap_kadmind_sasl_realm"
262*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KDC_DN                  "ldap_kdc_dn"
263*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KDC_SASL_AUTHCID        "ldap_kdc_sasl_authcid"
264*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KDC_SASL_AUTHZID        "ldap_kdc_sasl_authzid"
265*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KDC_SASL_MECH           "ldap_kdc_sasl_mech"
266*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KDC_SASL_REALM          "ldap_kdc_sasl_realm"
267*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_KERBEROS_CONTAINER_DN   "ldap_kerberos_container_dn"
268*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_SERVERS                 "ldap_servers"
269*7f2fe78bSCy Schubert #define KRB5_CONF_LDAP_SERVICE_PASSWORD_FILE   "ldap_service_password_file"
270*7f2fe78bSCy Schubert #define KRB5_CONF_LIBDEFAULTS                  "libdefaults"
271*7f2fe78bSCy Schubert #define KRB5_CONF_LOGGING                      "logging"
272*7f2fe78bSCy Schubert #define KRB5_CONF_MAPSIZE                      "mapsize"
273*7f2fe78bSCy Schubert #define KRB5_CONF_MASTER_KDC                   "master_kdc"
274*7f2fe78bSCy Schubert #define KRB5_CONF_MASTER_KEY_NAME              "master_key_name"
275*7f2fe78bSCy Schubert #define KRB5_CONF_MASTER_KEY_TYPE              "master_key_type"
276*7f2fe78bSCy Schubert #define KRB5_CONF_MAX_LIFE                     "max_life"
277*7f2fe78bSCy Schubert #define KRB5_CONF_MAX_READERS                  "max_readers"
278*7f2fe78bSCy Schubert #define KRB5_CONF_MAX_RENEWABLE_LIFE           "max_renewable_life"
279*7f2fe78bSCy Schubert #define KRB5_CONF_MODULE                       "module"
280*7f2fe78bSCy Schubert #define KRB5_CONF_NOADDRESSES                  "noaddresses"
281*7f2fe78bSCy Schubert #define KRB5_CONF_NOSYNC                       "nosync"
282*7f2fe78bSCy Schubert #define KRB5_CONF_NO_HOST_REFERRAL             "no_host_referral"
283*7f2fe78bSCy Schubert #define KRB5_CONF_PERMITTED_ENCTYPES           "permitted_enctypes"
284*7f2fe78bSCy Schubert #define KRB5_CONF_PLUGINS                      "plugins"
285*7f2fe78bSCy Schubert #define KRB5_CONF_PLUGIN_BASE_DIR              "plugin_base_dir"
286*7f2fe78bSCy Schubert #define KRB5_CONF_PREFERRED_PREAUTH_TYPES      "preferred_preauth_types"
287*7f2fe78bSCy Schubert #define KRB5_CONF_PRIMARY_KDC                  "primary_kdc"
288*7f2fe78bSCy Schubert #define KRB5_CONF_PROXIABLE                    "proxiable"
289*7f2fe78bSCy Schubert #define KRB5_CONF_QUALIFY_SHORTNAME            "qualify_shortname"
290*7f2fe78bSCy Schubert #define KRB5_CONF_RDNS                         "rdns"
291*7f2fe78bSCy Schubert #define KRB5_CONF_REALMS                       "realms"
292*7f2fe78bSCy Schubert #define KRB5_CONF_REALM_TRY_DOMAINS            "realm_try_domains"
293*7f2fe78bSCy Schubert #define KRB5_CONF_REJECT_BAD_TRANSIT           "reject_bad_transit"
294*7f2fe78bSCy Schubert #define KRB5_CONF_RENEW_LIFETIME               "renew_lifetime"
295*7f2fe78bSCy Schubert #define KRB5_CONF_RESTRICT_ANONYMOUS_TO_TGT    "restrict_anonymous_to_tgt"
296*7f2fe78bSCy Schubert #define KRB5_CONF_SUPPORTED_ENCTYPES           "supported_enctypes"
297*7f2fe78bSCy Schubert #define KRB5_CONF_SPAKE_PREAUTH_INDICATOR      "spake_preauth_indicator"
298*7f2fe78bSCy Schubert #define KRB5_CONF_SPAKE_PREAUTH_KDC_CHALLENGE  "spake_preauth_kdc_challenge"
299*7f2fe78bSCy Schubert #define KRB5_CONF_SPAKE_PREAUTH_GROUPS         "spake_preauth_groups"
300*7f2fe78bSCy Schubert #define KRB5_CONF_TICKET_LIFETIME              "ticket_lifetime"
301*7f2fe78bSCy Schubert #define KRB5_CONF_UDP_PREFERENCE_LIMIT         "udp_preference_limit"
302*7f2fe78bSCy Schubert #define KRB5_CONF_UNLOCKITER                   "unlockiter"
303*7f2fe78bSCy Schubert #define KRB5_CONF_V4_INSTANCE_CONVERT          "v4_instance_convert"
304*7f2fe78bSCy Schubert #define KRB5_CONF_V4_REALM                     "v4_realm"
305*7f2fe78bSCy Schubert #define KRB5_CONF_VERIFY_AP_REQ_NOFAIL         "verify_ap_req_nofail"
306*7f2fe78bSCy Schubert #define KRB5_CONF_CLIENT_AWARE_GSS_BINDINGS    "client_aware_channel_bindings"
307*7f2fe78bSCy Schubert 
308*7f2fe78bSCy Schubert /* Cache configuration variables */
309*7f2fe78bSCy Schubert #define KRB5_CC_CONF_FAST_AVAIL                "fast_avail"
310*7f2fe78bSCy Schubert #define KRB5_CC_CONF_PA_CONFIG_DATA            "pa_config_data"
311*7f2fe78bSCy Schubert #define KRB5_CC_CONF_PA_TYPE                   "pa_type"
312*7f2fe78bSCy Schubert #define KRB5_CC_CONF_PROXY_IMPERSONATOR        "proxy_impersonator"
313*7f2fe78bSCy Schubert #define KRB5_CC_CONF_REFRESH_TIME              "refresh_time"
314*7f2fe78bSCy Schubert #define KRB5_CC_CONF_START_REALM               "start_realm"
315*7f2fe78bSCy Schubert 
316*7f2fe78bSCy Schubert /* Error codes used in KRB_ERROR protocol messages.
317*7f2fe78bSCy Schubert    Return values of library routines are based on a different error table
318*7f2fe78bSCy Schubert    (which allows non-ambiguous error codes between subsystems) */
319*7f2fe78bSCy Schubert 
320*7f2fe78bSCy Schubert /* KDC errors */
321*7f2fe78bSCy Schubert #define KDC_ERR_NONE                    0 /* No error */
322*7f2fe78bSCy Schubert #define KDC_ERR_NAME_EXP                1 /* Client's entry in DB expired */
323*7f2fe78bSCy Schubert #define KDC_ERR_SERVICE_EXP             2 /* Server's entry in DB expired */
324*7f2fe78bSCy Schubert #define KDC_ERR_BAD_PVNO                3 /* Requested pvno not supported */
325*7f2fe78bSCy Schubert #define KDC_ERR_C_OLD_MAST_KVNO         4 /* C's key encrypted in old master */
326*7f2fe78bSCy Schubert #define KDC_ERR_S_OLD_MAST_KVNO         5 /* S's key encrypted in old master */
327*7f2fe78bSCy Schubert #define KDC_ERR_C_PRINCIPAL_UNKNOWN     6 /* Client not found in Kerberos DB */
328*7f2fe78bSCy Schubert #define KDC_ERR_S_PRINCIPAL_UNKNOWN     7 /* Server not found in Kerberos DB */
329*7f2fe78bSCy Schubert #define KDC_ERR_PRINCIPAL_NOT_UNIQUE    8 /* Multiple entries in Kerberos DB */
330*7f2fe78bSCy Schubert #define KDC_ERR_NULL_KEY                9 /* The C or S has a null key */
331*7f2fe78bSCy Schubert #define KDC_ERR_CANNOT_POSTDATE         10 /* Tkt ineligible for postdating */
332*7f2fe78bSCy Schubert #define KDC_ERR_NEVER_VALID             11 /* Requested starttime > endtime */
333*7f2fe78bSCy Schubert #define KDC_ERR_POLICY                  12 /* KDC policy rejects request */
334*7f2fe78bSCy Schubert #define KDC_ERR_BADOPTION               13 /* KDC can't do requested opt. */
335*7f2fe78bSCy Schubert #define KDC_ERR_ENCTYPE_NOSUPP          14 /* No support for encryption type */
336*7f2fe78bSCy Schubert #define KDC_ERR_SUMTYPE_NOSUPP          15 /* No support for checksum type */
337*7f2fe78bSCy Schubert #define KDC_ERR_PADATA_TYPE_NOSUPP      16 /* No support for padata type */
338*7f2fe78bSCy Schubert #define KDC_ERR_TRTYPE_NOSUPP           17 /* No support for transited type */
339*7f2fe78bSCy Schubert #define KDC_ERR_CLIENT_REVOKED          18 /* C's creds have been revoked */
340*7f2fe78bSCy Schubert #define KDC_ERR_SERVICE_REVOKED         19 /* S's creds have been revoked */
341*7f2fe78bSCy Schubert #define KDC_ERR_TGT_REVOKED             20 /* TGT has been revoked */
342*7f2fe78bSCy Schubert #define KDC_ERR_CLIENT_NOTYET           21 /* C not yet valid */
343*7f2fe78bSCy Schubert #define KDC_ERR_SERVICE_NOTYET          22 /* S not yet valid */
344*7f2fe78bSCy Schubert #define KDC_ERR_KEY_EXP                 23 /* Password has expired */
345*7f2fe78bSCy Schubert #define KDC_ERR_PREAUTH_FAILED          24 /* Preauthentication failed */
346*7f2fe78bSCy Schubert #define KDC_ERR_PREAUTH_REQUIRED        25 /* Additional preauthentication */
347*7f2fe78bSCy Schubert                                            /* required */
348*7f2fe78bSCy Schubert #define KDC_ERR_SERVER_NOMATCH          26 /* Requested server and */
349*7f2fe78bSCy Schubert                                            /* ticket don't match*/
350*7f2fe78bSCy Schubert #define KDC_ERR_MUST_USE_USER2USER      27 /* Server principal valid for */
351*7f2fe78bSCy Schubert                                            /*   user2user only */
352*7f2fe78bSCy Schubert #define KDC_ERR_PATH_NOT_ACCEPTED       28 /* KDC policy rejected transited */
353*7f2fe78bSCy Schubert                                            /*   path */
354*7f2fe78bSCy Schubert #define KDC_ERR_SVC_UNAVAILABLE         29 /* A service is not
355*7f2fe78bSCy Schubert                                             * available that is
356*7f2fe78bSCy Schubert                                             * required to process the
357*7f2fe78bSCy Schubert                                             * request */
358*7f2fe78bSCy Schubert /* Application errors */
359*7f2fe78bSCy Schubert #define KRB_AP_ERR_BAD_INTEGRITY 31     /* Decrypt integrity check failed */
360*7f2fe78bSCy Schubert #define KRB_AP_ERR_TKT_EXPIRED  32      /* Ticket expired */
361*7f2fe78bSCy Schubert #define KRB_AP_ERR_TKT_NYV      33      /* Ticket not yet valid */
362*7f2fe78bSCy Schubert #define KRB_AP_ERR_REPEAT       34      /* Request is a replay */
363*7f2fe78bSCy Schubert #define KRB_AP_ERR_NOT_US       35      /* The ticket isn't for us */
364*7f2fe78bSCy Schubert #define KRB_AP_ERR_BADMATCH     36      /* Ticket/authenticator don't match */
365*7f2fe78bSCy Schubert #define KRB_AP_ERR_SKEW         37      /* Clock skew too great */
366*7f2fe78bSCy Schubert #define KRB_AP_ERR_BADADDR      38      /* Incorrect net address */
367*7f2fe78bSCy Schubert #define KRB_AP_ERR_BADVERSION   39      /* Protocol version mismatch */
368*7f2fe78bSCy Schubert #define KRB_AP_ERR_MSG_TYPE     40      /* Invalid message type */
369*7f2fe78bSCy Schubert #define KRB_AP_ERR_MODIFIED     41      /* Message stream modified */
370*7f2fe78bSCy Schubert #define KRB_AP_ERR_BADORDER     42      /* Message out of order */
371*7f2fe78bSCy Schubert #define KRB_AP_ERR_BADKEYVER    44      /* Key version is not available */
372*7f2fe78bSCy Schubert #define KRB_AP_ERR_NOKEY        45      /* Service key not available */
373*7f2fe78bSCy Schubert #define KRB_AP_ERR_MUT_FAIL     46      /* Mutual authentication failed */
374*7f2fe78bSCy Schubert #define KRB_AP_ERR_BADDIRECTION 47      /* Incorrect message direction */
375*7f2fe78bSCy Schubert #define KRB_AP_ERR_METHOD       48      /* Alternative authentication */
376*7f2fe78bSCy Schubert                                         /* method required */
377*7f2fe78bSCy Schubert #define KRB_AP_ERR_BADSEQ       49      /* Incorrect sequence numnber */
378*7f2fe78bSCy Schubert                                         /* in message */
379*7f2fe78bSCy Schubert #define KRB_AP_ERR_INAPP_CKSUM  50      /* Inappropriate type of */
380*7f2fe78bSCy Schubert                                         /* checksum in message */
381*7f2fe78bSCy Schubert #define KRB_AP_PATH_NOT_ACCEPTED 51     /* Policy rejects transited path */
382*7f2fe78bSCy Schubert #define KRB_ERR_RESPONSE_TOO_BIG 52     /* Response too big for UDP, */
383*7f2fe78bSCy Schubert                                         /*   retry with TCP */
384*7f2fe78bSCy Schubert 
385*7f2fe78bSCy Schubert /* other errors */
386*7f2fe78bSCy Schubert #define KRB_ERR_GENERIC         60      /* Generic error (description */
387*7f2fe78bSCy Schubert                                         /* in e-text) */
388*7f2fe78bSCy Schubert #define KRB_ERR_FIELD_TOOLONG   61      /* Field is too long for impl. */
389*7f2fe78bSCy Schubert 
390*7f2fe78bSCy Schubert /* PKINIT server-reported errors */
391*7f2fe78bSCy Schubert #define KDC_ERR_CLIENT_NOT_TRUSTED              62 /* client cert not trusted */
392*7f2fe78bSCy Schubert #define KDC_ERR_KDC_NOT_TRUSTED                 63
393*7f2fe78bSCy Schubert #define KDC_ERR_INVALID_SIG                     64 /* client signature verify failed */
394*7f2fe78bSCy Schubert #define KDC_ERR_DH_KEY_PARAMETERS_NOT_ACCEPTED  65 /* invalid Diffie-Hellman parameters */
395*7f2fe78bSCy Schubert #define KDC_ERR_CERTIFICATE_MISMATCH            66
396*7f2fe78bSCy Schubert #define KRB_AP_ERR_NO_TGT                       67
397*7f2fe78bSCy Schubert #define KDC_ERR_WRONG_REALM                     68
398*7f2fe78bSCy Schubert #define KRB_AP_ERR_USER_TO_USER_REQUIRED        69
399*7f2fe78bSCy Schubert #define KDC_ERR_CANT_VERIFY_CERTIFICATE         70 /* client cert not verifiable to */
400*7f2fe78bSCy Schubert                                                    /* trusted root cert */
401*7f2fe78bSCy Schubert #define KDC_ERR_INVALID_CERTIFICATE             71 /* client cert had invalid signature */
402*7f2fe78bSCy Schubert #define KDC_ERR_REVOKED_CERTIFICATE             72 /* client cert was revoked */
403*7f2fe78bSCy Schubert #define KDC_ERR_REVOCATION_STATUS_UNKNOWN       73 /* client cert revoked, reason unknown */
404*7f2fe78bSCy Schubert #define KDC_ERR_REVOCATION_STATUS_UNAVAILABLE   74
405*7f2fe78bSCy Schubert #define KDC_ERR_CLIENT_NAME_MISMATCH            75 /* mismatch between client cert and */
406*7f2fe78bSCy Schubert                                                    /* principal name */
407*7f2fe78bSCy Schubert #define KDC_ERR_INCONSISTENT_KEY_PURPOSE        77 /* bad extended key use */
408*7f2fe78bSCy Schubert #define KDC_ERR_DIGEST_IN_CERT_NOT_ACCEPTED     78 /* bad digest algorithm in client cert */
409*7f2fe78bSCy Schubert #define KDC_ERR_PA_CHECKSUM_MUST_BE_INCLUDED    79 /* missing paChecksum in PA-PK-AS-REQ */
410*7f2fe78bSCy Schubert #define KDC_ERR_DIGEST_IN_SIGNED_DATA_NOT_ACCEPTED 80 /* bad digest algorithm in SignedData */
411*7f2fe78bSCy Schubert #define KDC_ERR_PUBLIC_KEY_ENCRYPTION_NOT_SUPPORTED 81
412*7f2fe78bSCy Schubert #define KRB_AP_ERR_IAKERB_KDC_NOT_FOUND         85 /* The IAKERB proxy could
413*7f2fe78bSCy Schubert                                                       not find a KDC */
414*7f2fe78bSCy Schubert #define KRB_AP_ERR_IAKERB_KDC_NO_RESPONSE       86 /* The KDC did not respond
415*7f2fe78bSCy Schubert                                                       to the IAKERB proxy */
416*7f2fe78bSCy Schubert #define KDC_ERR_PREAUTH_EXPIRED                 90 /* RFC 6113 */
417*7f2fe78bSCy Schubert #define KDC_ERR_MORE_PREAUTH_DATA_REQUIRED      91 /* RFC 6113 */
418*7f2fe78bSCy Schubert #define KRB_ERR_MAX 127 /* err table base max offset for protocol err codes */
419*7f2fe78bSCy Schubert 
420*7f2fe78bSCy Schubert /*
421*7f2fe78bSCy Schubert  * A null-terminated array of this structure is returned by the KDC as
422*7f2fe78bSCy Schubert  * the data part of the ETYPE_INFO preauth type.  It informs the
423*7f2fe78bSCy Schubert  * client which encryption types are supported.
424*7f2fe78bSCy Schubert  * The  same data structure is used by both etype-info and etype-info2
425*7f2fe78bSCy Schubert  * but s2kparams must be null when encoding etype-info.
426*7f2fe78bSCy Schubert  */
427*7f2fe78bSCy Schubert typedef struct _krb5_etype_info_entry {
428*7f2fe78bSCy Schubert     krb5_magic      magic;
429*7f2fe78bSCy Schubert     krb5_enctype    etype;
430*7f2fe78bSCy Schubert     unsigned int    length;
431*7f2fe78bSCy Schubert     krb5_octet      *salt;
432*7f2fe78bSCy Schubert     krb5_data s2kparams;
433*7f2fe78bSCy Schubert } krb5_etype_info_entry;
434*7f2fe78bSCy Schubert 
435*7f2fe78bSCy Schubert /*
436*7f2fe78bSCy Schubert  *  This is essentially -1 without sign extension which can screw up
437*7f2fe78bSCy Schubert  *  comparisons on 64 bit machines. If the length is this value, then
438*7f2fe78bSCy Schubert  *  the salt data is not present. This is to distinguish between not
439*7f2fe78bSCy Schubert  *  being set and being of 0 length.
440*7f2fe78bSCy Schubert  */
441*7f2fe78bSCy Schubert #define KRB5_ETYPE_NO_SALT VALID_UINT_BITS
442*7f2fe78bSCy Schubert 
443*7f2fe78bSCy Schubert typedef krb5_etype_info_entry ** krb5_etype_info;
444*7f2fe78bSCy Schubert 
445*7f2fe78bSCy Schubert /* RFC 4537 */
446*7f2fe78bSCy Schubert typedef struct _krb5_etype_list {
447*7f2fe78bSCy Schubert     int             length;
448*7f2fe78bSCy Schubert     krb5_enctype    *etypes;
449*7f2fe78bSCy Schubert } krb5_etype_list;
450*7f2fe78bSCy Schubert 
451*7f2fe78bSCy Schubert /* sam_type values -- informational only */
452*7f2fe78bSCy Schubert #define PA_SAM_TYPE_ENIGMA     1   /*  Enigma Logic */
453*7f2fe78bSCy Schubert #define PA_SAM_TYPE_DIGI_PATH  2   /*  Digital Pathways */
454*7f2fe78bSCy Schubert #define PA_SAM_TYPE_SKEY_K0    3   /*  S/key where  KDC has key 0 */
455*7f2fe78bSCy Schubert #define PA_SAM_TYPE_SKEY       4   /*  Traditional S/Key */
456*7f2fe78bSCy Schubert #define PA_SAM_TYPE_SECURID    5   /*  Security Dynamics */
457*7f2fe78bSCy Schubert #define PA_SAM_TYPE_CRYPTOCARD 6   /*  CRYPTOCard */
458*7f2fe78bSCy Schubert #if 1 /* XXX need to figure out who has which numbers assigned */
459*7f2fe78bSCy Schubert #define PA_SAM_TYPE_ACTIVCARD_DEC  6   /*  ActivCard decimal mode */
460*7f2fe78bSCy Schubert #define PA_SAM_TYPE_ACTIVCARD_HEX  7   /*  ActivCard hex mode */
461*7f2fe78bSCy Schubert #define PA_SAM_TYPE_DIGI_PATH_HEX  8   /*  Digital Pathways hex mode */
462*7f2fe78bSCy Schubert #endif
463*7f2fe78bSCy Schubert #define PA_SAM_TYPE_EXP_BASE    128 /* experimental */
464*7f2fe78bSCy Schubert #define PA_SAM_TYPE_GRAIL               (PA_SAM_TYPE_EXP_BASE+0) /* testing */
465*7f2fe78bSCy Schubert #define PA_SAM_TYPE_SECURID_PREDICT     (PA_SAM_TYPE_EXP_BASE+1) /* special */
466*7f2fe78bSCy Schubert 
467*7f2fe78bSCy Schubert typedef struct _krb5_sam_challenge_2 {
468*7f2fe78bSCy Schubert     krb5_data       sam_challenge_2_body;
469*7f2fe78bSCy Schubert     krb5_checksum   **sam_cksum;            /* Array of checksums */
470*7f2fe78bSCy Schubert } krb5_sam_challenge_2;
471*7f2fe78bSCy Schubert 
472*7f2fe78bSCy Schubert typedef struct _krb5_sam_challenge_2_body {
473*7f2fe78bSCy Schubert     krb5_magic      magic;
474*7f2fe78bSCy Schubert     krb5_int32      sam_type; /* information */
475*7f2fe78bSCy Schubert     krb5_flags      sam_flags; /* KRB5_SAM_* values */
476*7f2fe78bSCy Schubert     krb5_data       sam_type_name;
477*7f2fe78bSCy Schubert     krb5_data       sam_track_id;
478*7f2fe78bSCy Schubert     krb5_data       sam_challenge_label;
479*7f2fe78bSCy Schubert     krb5_data       sam_challenge;
480*7f2fe78bSCy Schubert     krb5_data       sam_response_prompt;
481*7f2fe78bSCy Schubert     krb5_data       sam_pk_for_sad;
482*7f2fe78bSCy Schubert     krb5_int32      sam_nonce;
483*7f2fe78bSCy Schubert     krb5_enctype    sam_etype;
484*7f2fe78bSCy Schubert } krb5_sam_challenge_2_body;
485*7f2fe78bSCy Schubert 
486*7f2fe78bSCy Schubert typedef struct _krb5_sam_response_2 {
487*7f2fe78bSCy Schubert     krb5_magic      magic;
488*7f2fe78bSCy Schubert     krb5_int32      sam_type; /* informational */
489*7f2fe78bSCy Schubert     krb5_flags      sam_flags; /* KRB5_SAM_* values */
490*7f2fe78bSCy Schubert     krb5_data       sam_track_id; /* copied */
491*7f2fe78bSCy Schubert     krb5_enc_data   sam_enc_nonce_or_sad; /* krb5_enc_sam_response_enc */
492*7f2fe78bSCy Schubert     krb5_int32      sam_nonce;
493*7f2fe78bSCy Schubert } krb5_sam_response_2;
494*7f2fe78bSCy Schubert 
495*7f2fe78bSCy Schubert typedef struct _krb5_enc_sam_response_enc_2 {
496*7f2fe78bSCy Schubert     krb5_magic      magic;
497*7f2fe78bSCy Schubert     krb5_int32      sam_nonce;
498*7f2fe78bSCy Schubert     krb5_data       sam_sad;
499*7f2fe78bSCy Schubert } krb5_enc_sam_response_enc_2;
500*7f2fe78bSCy Schubert 
501*7f2fe78bSCy Schubert /*
502*7f2fe78bSCy Schubert  * Keep the pkinit definitions in a separate file so that the plugin
503*7f2fe78bSCy Schubert  * only has to include k5-int-pkinit.h rather than k5-int.h
504*7f2fe78bSCy Schubert  */
505*7f2fe78bSCy Schubert 
506*7f2fe78bSCy Schubert #include "k5-int-pkinit.h"
507*7f2fe78bSCy Schubert 
508*7f2fe78bSCy Schubert #define KRB5_OTP_FLAG_NEXTOTP        0x40000000
509*7f2fe78bSCy Schubert #define KRB5_OTP_FLAG_COMBINE        0x20000000
510*7f2fe78bSCy Schubert #define KRB5_OTP_FLAG_COLLECT_PIN    0x10000000
511*7f2fe78bSCy Schubert #define KRB5_OTP_FLAG_NO_COLLECT_PIN 0x08000000
512*7f2fe78bSCy Schubert #define KRB5_OTP_FLAG_ENCRYPT_NONCE  0x04000000
513*7f2fe78bSCy Schubert #define KRB5_OTP_FLAG_SEPARATE_PIN   0x02000000
514*7f2fe78bSCy Schubert #define KRB5_OTP_FLAG_CHECK_DIGIT    0x01000000
515*7f2fe78bSCy Schubert 
516*7f2fe78bSCy Schubert #define KRB5_OTP_FORMAT_DECIMAL      0x00000000
517*7f2fe78bSCy Schubert #define KRB5_OTP_FORMAT_HEXADECIMAL  0x00000001
518*7f2fe78bSCy Schubert #define KRB5_OTP_FORMAT_ALPHANUMERIC 0x00000002
519*7f2fe78bSCy Schubert #define KRB5_OTP_FORMAT_BINARY       0x00000003
520*7f2fe78bSCy Schubert #define KRB5_OTP_FORMAT_BASE64       0x00000004
521*7f2fe78bSCy Schubert 
522*7f2fe78bSCy Schubert typedef struct _krb5_otp_tokeninfo {
523*7f2fe78bSCy Schubert     krb5_flags flags;
524*7f2fe78bSCy Schubert     krb5_data vendor;
525*7f2fe78bSCy Schubert     krb5_data challenge;
526*7f2fe78bSCy Schubert     krb5_int32 length;          /* -1 for unspecified */
527*7f2fe78bSCy Schubert     krb5_int32 format;          /* -1 for unspecified */
528*7f2fe78bSCy Schubert     krb5_data token_id;
529*7f2fe78bSCy Schubert     krb5_data alg_id;
530*7f2fe78bSCy Schubert     krb5_algorithm_identifier **supported_hash_alg;
531*7f2fe78bSCy Schubert     krb5_int32 iteration_count; /* -1 for unspecified */
532*7f2fe78bSCy Schubert } krb5_otp_tokeninfo;
533*7f2fe78bSCy Schubert 
534*7f2fe78bSCy Schubert typedef struct _krb5_pa_otp_challenge {
535*7f2fe78bSCy Schubert     krb5_data nonce;
536*7f2fe78bSCy Schubert     krb5_data service;
537*7f2fe78bSCy Schubert     krb5_otp_tokeninfo **tokeninfo;
538*7f2fe78bSCy Schubert     krb5_data salt;
539*7f2fe78bSCy Schubert     krb5_data s2kparams;
540*7f2fe78bSCy Schubert } krb5_pa_otp_challenge;
541*7f2fe78bSCy Schubert 
542*7f2fe78bSCy Schubert typedef struct _krb5_pa_otp_req {
543*7f2fe78bSCy Schubert     krb5_int32 flags;
544*7f2fe78bSCy Schubert     krb5_data nonce;
545*7f2fe78bSCy Schubert     krb5_enc_data enc_data;
546*7f2fe78bSCy Schubert     krb5_algorithm_identifier *hash_alg;
547*7f2fe78bSCy Schubert     krb5_int32 iteration_count; /* -1 for unspecified */
548*7f2fe78bSCy Schubert     krb5_data otp_value;
549*7f2fe78bSCy Schubert     krb5_data pin;
550*7f2fe78bSCy Schubert     krb5_data challenge;
551*7f2fe78bSCy Schubert     krb5_timestamp time;
552*7f2fe78bSCy Schubert     krb5_data counter;
553*7f2fe78bSCy Schubert     krb5_int32 format;          /* -1 for unspecified */
554*7f2fe78bSCy Schubert     krb5_data token_id;
555*7f2fe78bSCy Schubert     krb5_data alg_id;
556*7f2fe78bSCy Schubert     krb5_data vendor;
557*7f2fe78bSCy Schubert } krb5_pa_otp_req;
558*7f2fe78bSCy Schubert 
559*7f2fe78bSCy Schubert typedef struct _krb5_kkdcp_message {
560*7f2fe78bSCy Schubert     krb5_data kerb_message;
561*7f2fe78bSCy Schubert     krb5_data target_domain;
562*7f2fe78bSCy Schubert     krb5_int32 dclocator_hint;
563*7f2fe78bSCy Schubert } krb5_kkdcp_message;
564*7f2fe78bSCy Schubert 
565*7f2fe78bSCy Schubert /* Plain text of an encrypted PA-FX-COOKIE value produced by the KDC. */
566*7f2fe78bSCy Schubert typedef struct _krb5_secure_cookie {
567*7f2fe78bSCy Schubert     time_t time;
568*7f2fe78bSCy Schubert     krb5_pa_data **data;
569*7f2fe78bSCy Schubert } krb5_secure_cookie;
570*7f2fe78bSCy Schubert 
571*7f2fe78bSCy Schubert typedef struct _krb5_pa_pac_options {
572*7f2fe78bSCy Schubert     krb5_flags options;
573*7f2fe78bSCy Schubert } krb5_pa_pac_options;
574*7f2fe78bSCy Schubert 
575*7f2fe78bSCy Schubert /* In PAC options, indicates Resource-Based Constrained Delegation support. */
576*7f2fe78bSCy Schubert #define KRB5_PA_PAC_OPTIONS_RBCD 0x10000000
577*7f2fe78bSCy Schubert 
578*7f2fe78bSCy Schubert #include <stdlib.h>
579*7f2fe78bSCy Schubert #include <string.h>
580*7f2fe78bSCy Schubert 
581*7f2fe78bSCy Schubert #ifndef HAVE_STRDUP
582*7f2fe78bSCy Schubert extern char *strdup (const char *);
583*7f2fe78bSCy Schubert #endif
584*7f2fe78bSCy Schubert 
585*7f2fe78bSCy Schubert #ifdef HAVE_UNISTD_H
586*7f2fe78bSCy Schubert #include <unistd.h>
587*7f2fe78bSCy Schubert #endif
588*7f2fe78bSCy Schubert 
589*7f2fe78bSCy Schubert #ifdef HAVE_SYS_TIME_H
590*7f2fe78bSCy Schubert #include <sys/time.h>
591*7f2fe78bSCy Schubert #endif
592*7f2fe78bSCy Schubert #include <time.h>
593*7f2fe78bSCy Schubert 
594*7f2fe78bSCy Schubert #ifdef HAVE_SYS_STAT_H
595*7f2fe78bSCy Schubert #include <sys/stat.h>                   /* struct stat, stat() */
596*7f2fe78bSCy Schubert #endif
597*7f2fe78bSCy Schubert 
598*7f2fe78bSCy Schubert #ifdef HAVE_SYS_PARAM_H
599*7f2fe78bSCy Schubert #include <sys/param.h>                  /* MAXPATHLEN */
600*7f2fe78bSCy Schubert #endif
601*7f2fe78bSCy Schubert 
602*7f2fe78bSCy Schubert #ifdef HAVE_SYS_FILE_H
603*7f2fe78bSCy Schubert #include <sys/file.h>                   /* prototypes for file-related
604*7f2fe78bSCy Schubert                                            syscalls; flags for open &
605*7f2fe78bSCy Schubert                                            friends */
606*7f2fe78bSCy Schubert #endif
607*7f2fe78bSCy Schubert 
608*7f2fe78bSCy Schubert #ifdef HAVE_FCNTL_H
609*7f2fe78bSCy Schubert #include <fcntl.h>
610*7f2fe78bSCy Schubert #endif
611*7f2fe78bSCy Schubert 
612*7f2fe78bSCy Schubert #include <stdio.h>
613*7f2fe78bSCy Schubert 
614*7f2fe78bSCy Schubert #include "k5-gmt_mktime.h"
615*7f2fe78bSCy Schubert 
616*7f2fe78bSCy Schubert /* libos.spec */
617*7f2fe78bSCy Schubert krb5_error_code krb5_lock_file(krb5_context, int, int);
618*7f2fe78bSCy Schubert krb5_error_code krb5_unlock_file(krb5_context, int);
619*7f2fe78bSCy Schubert krb5_error_code krb5_sendto_kdc(krb5_context, const krb5_data *,
620*7f2fe78bSCy Schubert                                 const krb5_data *, krb5_data *, int *, int);
621*7f2fe78bSCy Schubert 
622*7f2fe78bSCy Schubert krb5_error_code krb5int_init_context_kdc(krb5_context *);
623*7f2fe78bSCy Schubert 
624*7f2fe78bSCy Schubert struct derived_key {
625*7f2fe78bSCy Schubert     krb5_data constant;
626*7f2fe78bSCy Schubert     krb5_key dkey;
627*7f2fe78bSCy Schubert     struct derived_key *next;
628*7f2fe78bSCy Schubert };
629*7f2fe78bSCy Schubert 
630*7f2fe78bSCy Schubert /* Internal structure of an opaque key identifier */
631*7f2fe78bSCy Schubert struct krb5_key_st {
632*7f2fe78bSCy Schubert     krb5_keyblock keyblock;
633*7f2fe78bSCy Schubert     int refcount;
634*7f2fe78bSCy Schubert     struct derived_key *derived;
635*7f2fe78bSCy Schubert     /*
636*7f2fe78bSCy Schubert      * Cache of data private to the cipher implementation, which we
637*7f2fe78bSCy Schubert      * don't want to have to recompute for every operation.  This may
638*7f2fe78bSCy Schubert      * include key schedules, iteration counts, etc.
639*7f2fe78bSCy Schubert      *
640*7f2fe78bSCy Schubert      * The cipher implementation is responsible for setting this up
641*7f2fe78bSCy Schubert      * whenever needed, and the enc_provider key_cleanup method must
642*7f2fe78bSCy Schubert      * then be provided to dispose of it.
643*7f2fe78bSCy Schubert      */
644*7f2fe78bSCy Schubert     void *cache;
645*7f2fe78bSCy Schubert };
646*7f2fe78bSCy Schubert 
647*7f2fe78bSCy Schubert krb5_error_code
648*7f2fe78bSCy Schubert krb5int_arcfour_gsscrypt(const krb5_keyblock *keyblock, krb5_keyusage usage,
649*7f2fe78bSCy Schubert                          const krb5_data *kd_data, krb5_crypto_iov *data,
650*7f2fe78bSCy Schubert                          size_t num_data);
651*7f2fe78bSCy Schubert 
652*7f2fe78bSCy Schubert #define K5_SHA256_HASHLEN (256 / 8)
653*7f2fe78bSCy Schubert 
654*7f2fe78bSCy Schubert /* Write the SHA-256 hash of in (containing n elements) to out. */
655*7f2fe78bSCy Schubert krb5_error_code
656*7f2fe78bSCy Schubert k5_sha256(const krb5_data *in, size_t n, uint8_t out[K5_SHA256_HASHLEN]);
657*7f2fe78bSCy Schubert 
658*7f2fe78bSCy Schubert /* Convenience function: zap and free ptr if it is non-NULL. */
659*7f2fe78bSCy Schubert static inline void
zapfree(void * ptr,size_t len)660*7f2fe78bSCy Schubert zapfree(void *ptr, size_t len)
661*7f2fe78bSCy Schubert {
662*7f2fe78bSCy Schubert     if (ptr != NULL) {
663*7f2fe78bSCy Schubert         zap(ptr, len);
664*7f2fe78bSCy Schubert         free(ptr);
665*7f2fe78bSCy Schubert     }
666*7f2fe78bSCy Schubert }
667*7f2fe78bSCy Schubert 
668*7f2fe78bSCy Schubert /* Convenience function: zap and free zero-terminated str if it is non-NULL. */
669*7f2fe78bSCy Schubert static inline void
zapfreestr(void * str)670*7f2fe78bSCy Schubert zapfreestr(void *str)
671*7f2fe78bSCy Schubert {
672*7f2fe78bSCy Schubert     if (str != NULL) {
673*7f2fe78bSCy Schubert         zap(str, strlen((char *)str));
674*7f2fe78bSCy Schubert         free(str);
675*7f2fe78bSCy Schubert     }
676*7f2fe78bSCy Schubert }
677*7f2fe78bSCy Schubert 
678*7f2fe78bSCy Schubert /* Convenience function: zap and free krb5_data pointer if it is non-NULL. */
679*7f2fe78bSCy Schubert static inline void
zapfreedata(krb5_data * data)680*7f2fe78bSCy Schubert zapfreedata(krb5_data *data)
681*7f2fe78bSCy Schubert {
682*7f2fe78bSCy Schubert     if (data != NULL) {
683*7f2fe78bSCy Schubert         zapfree(data->data, data->length);
684*7f2fe78bSCy Schubert         free(data);
685*7f2fe78bSCy Schubert     }
686*7f2fe78bSCy Schubert }
687*7f2fe78bSCy Schubert 
688*7f2fe78bSCy Schubert void krb5int_c_free_keyblock(krb5_context, krb5_keyblock *key);
689*7f2fe78bSCy Schubert void krb5int_c_free_keyblock_contents(krb5_context, krb5_keyblock *);
690*7f2fe78bSCy Schubert krb5_error_code krb5int_c_init_keyblock(krb5_context, krb5_enctype enctype,
691*7f2fe78bSCy Schubert                                         size_t length, krb5_keyblock **out);
692*7f2fe78bSCy Schubert krb5_error_code krb5int_c_copy_keyblock(krb5_context context,
693*7f2fe78bSCy Schubert                                         const krb5_keyblock *from,
694*7f2fe78bSCy Schubert                                         krb5_keyblock **to);
695*7f2fe78bSCy Schubert krb5_error_code krb5int_c_copy_keyblock_contents(krb5_context context,
696*7f2fe78bSCy Schubert                                                  const krb5_keyblock *from,
697*7f2fe78bSCy Schubert                                                  krb5_keyblock *to);
698*7f2fe78bSCy Schubert 
699*7f2fe78bSCy Schubert krb5_error_code krb5_crypto_us_timeofday(krb5_timestamp *, krb5_int32 *);
700*7f2fe78bSCy Schubert 
701*7f2fe78bSCy Schubert /*
702*7f2fe78bSCy Schubert  * End "los-proto.h"
703*7f2fe78bSCy Schubert  */
704*7f2fe78bSCy Schubert 
705*7f2fe78bSCy Schubert typedef struct _krb5_os_context {
706*7f2fe78bSCy Schubert     krb5_magic              magic;
707*7f2fe78bSCy Schubert     krb5_int32              time_offset;
708*7f2fe78bSCy Schubert     krb5_int32              usec_offset;
709*7f2fe78bSCy Schubert     krb5_int32              os_flags;
710*7f2fe78bSCy Schubert     char *                  default_ccname;
711*7f2fe78bSCy Schubert } *krb5_os_context;
712*7f2fe78bSCy Schubert 
713*7f2fe78bSCy Schubert /*
714*7f2fe78bSCy Schubert  * Flags for the os_flags field
715*7f2fe78bSCy Schubert  *
716*7f2fe78bSCy Schubert  * KRB5_OS_TOFFSET_VALID means that the time offset fields are valid.
717*7f2fe78bSCy Schubert  * The intention is that this facility to correct the system clocks so
718*7f2fe78bSCy Schubert  * that they reflect the "real" time, for systems where for some
719*7f2fe78bSCy Schubert  * reason we can't set the system clock.  Instead we calculate the
720*7f2fe78bSCy Schubert  * offset between the system time and real time, and store the offset
721*7f2fe78bSCy Schubert  * in the os context so that we can correct the system clock as necessary.
722*7f2fe78bSCy Schubert  *
723*7f2fe78bSCy Schubert  * KRB5_OS_TOFFSET_TIME means that the time offset fields should be
724*7f2fe78bSCy Schubert  * returned as the time by the krb5 time routines.  This should only
725*7f2fe78bSCy Schubert  * be used for testing purposes (obviously!)
726*7f2fe78bSCy Schubert  */
727*7f2fe78bSCy Schubert #define KRB5_OS_TOFFSET_VALID   1
728*7f2fe78bSCy Schubert #define KRB5_OS_TOFFSET_TIME    2
729*7f2fe78bSCy Schubert 
730*7f2fe78bSCy Schubert /* lock mode flags */
731*7f2fe78bSCy Schubert #define KRB5_LOCKMODE_SHARED    0x0001
732*7f2fe78bSCy Schubert #define KRB5_LOCKMODE_EXCLUSIVE 0x0002
733*7f2fe78bSCy Schubert #define KRB5_LOCKMODE_DONTBLOCK 0x0004
734*7f2fe78bSCy Schubert #define KRB5_LOCKMODE_UNLOCK    0x0008
735*7f2fe78bSCy Schubert 
736*7f2fe78bSCy Schubert /*
737*7f2fe78bSCy Schubert  * Begin "preauth.h"
738*7f2fe78bSCy Schubert  *
739*7f2fe78bSCy Schubert  * (Originally written by Glen Machin at Sandia Labs.)
740*7f2fe78bSCy Schubert  */
741*7f2fe78bSCy Schubert /*
742*7f2fe78bSCy Schubert  * Sandia National Laboratories also makes no representations about the
743*7f2fe78bSCy Schubert  * suitability of the modifications, or additions to this software for
744*7f2fe78bSCy Schubert  * any purpose.  It is provided "as is" without express or implied warranty.
745*7f2fe78bSCy Schubert  */
746*7f2fe78bSCy Schubert #ifndef KRB5_PREAUTH__
747*7f2fe78bSCy Schubert #define KRB5_PREAUTH__
748*7f2fe78bSCy Schubert 
749*7f2fe78bSCy Schubert typedef struct _krb5_pa_enc_ts {
750*7f2fe78bSCy Schubert     krb5_timestamp      patimestamp;
751*7f2fe78bSCy Schubert     krb5_int32          pausec;
752*7f2fe78bSCy Schubert } krb5_pa_enc_ts;
753*7f2fe78bSCy Schubert 
754*7f2fe78bSCy Schubert typedef struct _krb5_pa_for_user {
755*7f2fe78bSCy Schubert     krb5_principal      user;
756*7f2fe78bSCy Schubert     krb5_checksum       cksum;
757*7f2fe78bSCy Schubert     krb5_data           auth_package;
758*7f2fe78bSCy Schubert } krb5_pa_for_user;
759*7f2fe78bSCy Schubert 
760*7f2fe78bSCy Schubert typedef struct _krb5_s4u_userid {
761*7f2fe78bSCy Schubert     krb5_int32          nonce;
762*7f2fe78bSCy Schubert     krb5_principal      user;
763*7f2fe78bSCy Schubert     krb5_data           subject_cert;
764*7f2fe78bSCy Schubert     krb5_flags          options;
765*7f2fe78bSCy Schubert } krb5_s4u_userid;
766*7f2fe78bSCy Schubert 
767*7f2fe78bSCy Schubert #define KRB5_S4U_OPTS_CHECK_LOGON_HOURS         0x40000000 /* check logon hour restrictions */
768*7f2fe78bSCy Schubert #define KRB5_S4U_OPTS_USE_REPLY_KEY_USAGE       0x20000000 /* sign with usage 27 instead of 26 */
769*7f2fe78bSCy Schubert 
770*7f2fe78bSCy Schubert typedef struct _krb5_pa_s4u_x509_user {
771*7f2fe78bSCy Schubert     krb5_s4u_userid     user_id;
772*7f2fe78bSCy Schubert     krb5_checksum       cksum;
773*7f2fe78bSCy Schubert } krb5_pa_s4u_x509_user;
774*7f2fe78bSCy Schubert 
775*7f2fe78bSCy Schubert enum {
776*7f2fe78bSCy Schubert     KRB5_FAST_ARMOR_AP_REQUEST = 0x1
777*7f2fe78bSCy Schubert };
778*7f2fe78bSCy Schubert 
779*7f2fe78bSCy Schubert typedef struct _krb5_fast_armor {
780*7f2fe78bSCy Schubert     krb5_int32 armor_type;
781*7f2fe78bSCy Schubert     krb5_data armor_value;
782*7f2fe78bSCy Schubert } krb5_fast_armor;
783*7f2fe78bSCy Schubert typedef struct _krb5_fast_armored_req {
784*7f2fe78bSCy Schubert     krb5_magic magic;
785*7f2fe78bSCy Schubert     krb5_fast_armor *armor;
786*7f2fe78bSCy Schubert     krb5_checksum req_checksum;
787*7f2fe78bSCy Schubert     krb5_enc_data enc_part;
788*7f2fe78bSCy Schubert } krb5_fast_armored_req;
789*7f2fe78bSCy Schubert 
790*7f2fe78bSCy Schubert typedef struct _krb5_fast_req {
791*7f2fe78bSCy Schubert     krb5_magic magic;
792*7f2fe78bSCy Schubert     krb5_flags fast_options;
793*7f2fe78bSCy Schubert     /* padata from req_body is used*/
794*7f2fe78bSCy Schubert     krb5_kdc_req *req_body;
795*7f2fe78bSCy Schubert } krb5_fast_req;
796*7f2fe78bSCy Schubert 
797*7f2fe78bSCy Schubert /* Bits 0-15 are critical in FAST options (RFC 6113 section 7.3). */
798*7f2fe78bSCy Schubert #define UNSUPPORTED_CRITICAL_FAST_OPTIONS   0xbfff0000
799*7f2fe78bSCy Schubert #define KRB5_FAST_OPTION_HIDE_CLIENT_NAMES  0x40000000
800*7f2fe78bSCy Schubert 
801*7f2fe78bSCy Schubert typedef struct _krb5_fast_finished {
802*7f2fe78bSCy Schubert     krb5_timestamp timestamp;
803*7f2fe78bSCy Schubert     krb5_int32 usec;
804*7f2fe78bSCy Schubert     krb5_principal client;
805*7f2fe78bSCy Schubert     krb5_checksum ticket_checksum;
806*7f2fe78bSCy Schubert } krb5_fast_finished;
807*7f2fe78bSCy Schubert 
808*7f2fe78bSCy Schubert typedef struct _krb5_fast_response {
809*7f2fe78bSCy Schubert     krb5_magic magic;
810*7f2fe78bSCy Schubert     krb5_pa_data **padata;
811*7f2fe78bSCy Schubert     krb5_keyblock *strengthen_key;
812*7f2fe78bSCy Schubert     krb5_fast_finished *finished;
813*7f2fe78bSCy Schubert     krb5_int32 nonce;
814*7f2fe78bSCy Schubert } krb5_fast_response;
815*7f2fe78bSCy Schubert 
816*7f2fe78bSCy Schubert typedef struct _krb5_ad_kdcissued {
817*7f2fe78bSCy Schubert     krb5_checksum ad_checksum;
818*7f2fe78bSCy Schubert     krb5_principal i_principal;
819*7f2fe78bSCy Schubert     krb5_authdata **elements;
820*7f2fe78bSCy Schubert } krb5_ad_kdcissued;
821*7f2fe78bSCy Schubert 
822*7f2fe78bSCy Schubert typedef struct _krb5_iakerb_header {
823*7f2fe78bSCy Schubert     krb5_data target_realm;
824*7f2fe78bSCy Schubert     krb5_data *cookie;
825*7f2fe78bSCy Schubert } krb5_iakerb_header;
826*7f2fe78bSCy Schubert 
827*7f2fe78bSCy Schubert typedef struct _krb5_iakerb_finished {
828*7f2fe78bSCy Schubert     krb5_checksum checksum;
829*7f2fe78bSCy Schubert } krb5_iakerb_finished;
830*7f2fe78bSCy Schubert 
831*7f2fe78bSCy Schubert typedef struct _krb5_verifier_mac {
832*7f2fe78bSCy Schubert     krb5_principal princ;
833*7f2fe78bSCy Schubert     krb5_kvno kvno;
834*7f2fe78bSCy Schubert     krb5_enctype enctype;
835*7f2fe78bSCy Schubert     krb5_checksum checksum;
836*7f2fe78bSCy Schubert } krb5_verifier_mac;
837*7f2fe78bSCy Schubert 
838*7f2fe78bSCy Schubert /*
839*7f2fe78bSCy Schubert  * AD-CAMMAC's other-verifiers field is a sequence of Verifier, which is an
840*7f2fe78bSCy Schubert  * extensible choice with only one selection, Verifier-MAC.  For the time being
841*7f2fe78bSCy Schubert  * we will represent this field directly as an array of krb5_verifier_mac.
842*7f2fe78bSCy Schubert  * That will have to change if other selections are added.
843*7f2fe78bSCy Schubert  */
844*7f2fe78bSCy Schubert typedef struct _krb5_cammac {
845*7f2fe78bSCy Schubert     krb5_authdata **elements;
846*7f2fe78bSCy Schubert     krb5_verifier_mac *kdc_verifier;
847*7f2fe78bSCy Schubert     krb5_verifier_mac *svc_verifier;
848*7f2fe78bSCy Schubert     krb5_verifier_mac **other_verifiers;
849*7f2fe78bSCy Schubert } krb5_cammac;
850*7f2fe78bSCy Schubert 
851*7f2fe78bSCy Schubert void krb5_free_etype_info(krb5_context, krb5_etype_info);
852*7f2fe78bSCy Schubert 
853*7f2fe78bSCy Schubert krb5_pa_data *
854*7f2fe78bSCy Schubert krb5int_find_pa_data(krb5_context, krb5_pa_data *const *, krb5_preauthtype);
855*7f2fe78bSCy Schubert /* Does not return a copy; original padata sequence responsible for freeing*/
856*7f2fe78bSCy Schubert 
857*7f2fe78bSCy Schubert /* Allocate a pa-data object with uninitialized contents of size len.  If len
858*7f2fe78bSCy Schubert  * is 0, set the contents field to NULL. */
859*7f2fe78bSCy Schubert krb5_error_code
860*7f2fe78bSCy Schubert k5_alloc_pa_data(krb5_preauthtype pa_type, size_t len, krb5_pa_data **out);
861*7f2fe78bSCy Schubert 
862*7f2fe78bSCy Schubert /* Free a single pa-data object. */
863*7f2fe78bSCy Schubert void
864*7f2fe78bSCy Schubert k5_free_pa_data_element(krb5_pa_data *pa);
865*7f2fe78bSCy Schubert 
866*7f2fe78bSCy Schubert /* Without copying, add single element *pa to *list, reallocating as necessary.
867*7f2fe78bSCy Schubert  * If *list is NULL, allocate a new list.  Set *pa to NULL on success. */
868*7f2fe78bSCy Schubert krb5_error_code
869*7f2fe78bSCy Schubert k5_add_pa_data_element(krb5_pa_data ***list, krb5_pa_data **pa);
870*7f2fe78bSCy Schubert 
871*7f2fe78bSCy Schubert /* Without copying, add a pa-data element of type pa_type to *list with the
872*7f2fe78bSCy Schubert  * contents in data.  Set *data to empty_data() on success. */
873*7f2fe78bSCy Schubert krb5_error_code
874*7f2fe78bSCy Schubert k5_add_pa_data_from_data(krb5_pa_data ***list, krb5_preauthtype pa_type,
875*7f2fe78bSCy Schubert                          krb5_data *data);
876*7f2fe78bSCy Schubert 
877*7f2fe78bSCy Schubert /* Add an empty pa-data element of type pa_type to *list. */
878*7f2fe78bSCy Schubert krb5_error_code
879*7f2fe78bSCy Schubert k5_add_empty_pa_data(krb5_pa_data ***list, krb5_preauthtype pa_type);
880*7f2fe78bSCy Schubert 
881*7f2fe78bSCy Schubert #endif /* KRB5_PREAUTH__ */
882*7f2fe78bSCy Schubert /*
883*7f2fe78bSCy Schubert  * End "preauth.h"
884*7f2fe78bSCy Schubert  */
885*7f2fe78bSCy Schubert 
886*7f2fe78bSCy Schubert krb5_error_code
887*7f2fe78bSCy Schubert krb5int_copy_data_contents(krb5_context, const krb5_data *, krb5_data *);
888*7f2fe78bSCy Schubert 
889*7f2fe78bSCy Schubert krb5_error_code
890*7f2fe78bSCy Schubert krb5int_copy_data_contents_add0(krb5_context, const krb5_data *, krb5_data *);
891*7f2fe78bSCy Schubert 
892*7f2fe78bSCy Schubert void KRB5_CALLCONV
893*7f2fe78bSCy Schubert krb5_free_sam_challenge_2(krb5_context, krb5_sam_challenge_2 *);
894*7f2fe78bSCy Schubert 
895*7f2fe78bSCy Schubert void KRB5_CALLCONV
896*7f2fe78bSCy Schubert krb5_free_sam_challenge_2_body(krb5_context, krb5_sam_challenge_2_body *);
897*7f2fe78bSCy Schubert 
898*7f2fe78bSCy Schubert void KRB5_CALLCONV
899*7f2fe78bSCy Schubert krb5_free_sam_response_2(krb5_context, krb5_sam_response_2 *);
900*7f2fe78bSCy Schubert 
901*7f2fe78bSCy Schubert void KRB5_CALLCONV
902*7f2fe78bSCy Schubert krb5_free_enc_sam_response_enc_2(krb5_context, krb5_enc_sam_response_enc_2 *);
903*7f2fe78bSCy Schubert 
904*7f2fe78bSCy Schubert void KRB5_CALLCONV
905*7f2fe78bSCy Schubert krb5_free_sam_challenge_2_contents(krb5_context, krb5_sam_challenge_2 *);
906*7f2fe78bSCy Schubert 
907*7f2fe78bSCy Schubert void KRB5_CALLCONV
908*7f2fe78bSCy Schubert krb5_free_sam_challenge_2_body_contents(krb5_context,
909*7f2fe78bSCy Schubert                                         krb5_sam_challenge_2_body *);
910*7f2fe78bSCy Schubert 
911*7f2fe78bSCy Schubert void KRB5_CALLCONV
912*7f2fe78bSCy Schubert krb5_free_sam_response_2_contents(krb5_context, krb5_sam_response_2 *);
913*7f2fe78bSCy Schubert 
914*7f2fe78bSCy Schubert void KRB5_CALLCONV
915*7f2fe78bSCy Schubert krb5_free_enc_sam_response_enc_2_contents(krb5_context,
916*7f2fe78bSCy Schubert                                           krb5_enc_sam_response_enc_2 * );
917*7f2fe78bSCy Schubert 
918*7f2fe78bSCy Schubert void KRB5_CALLCONV
919*7f2fe78bSCy Schubert krb5_free_pa_enc_ts(krb5_context, krb5_pa_enc_ts *);
920*7f2fe78bSCy Schubert 
921*7f2fe78bSCy Schubert void KRB5_CALLCONV
922*7f2fe78bSCy Schubert krb5_free_pa_for_user(krb5_context, krb5_pa_for_user *);
923*7f2fe78bSCy Schubert 
924*7f2fe78bSCy Schubert void KRB5_CALLCONV
925*7f2fe78bSCy Schubert krb5_free_s4u_userid_contents(krb5_context, krb5_s4u_userid *);
926*7f2fe78bSCy Schubert 
927*7f2fe78bSCy Schubert void KRB5_CALLCONV
928*7f2fe78bSCy Schubert krb5_free_pa_s4u_x509_user(krb5_context, krb5_pa_s4u_x509_user *);
929*7f2fe78bSCy Schubert 
930*7f2fe78bSCy Schubert void KRB5_CALLCONV
931*7f2fe78bSCy Schubert krb5_free_pa_pac_req(krb5_context, krb5_pa_pac_req * );
932*7f2fe78bSCy Schubert 
933*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_fast_armor(krb5_context, krb5_fast_armor *);
934*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_fast_armored_req(krb5_context,
935*7f2fe78bSCy Schubert                                               krb5_fast_armored_req *);
936*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_fast_req(krb5_context, krb5_fast_req *);
937*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_fast_finished(krb5_context, krb5_fast_finished *);
938*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_fast_response(krb5_context, krb5_fast_response *);
939*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_ad_kdcissued(krb5_context, krb5_ad_kdcissued *);
940*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_iakerb_header(krb5_context, krb5_iakerb_header *);
941*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_iakerb_finished(krb5_context,
942*7f2fe78bSCy Schubert                                              krb5_iakerb_finished *);
943*7f2fe78bSCy Schubert void k5_free_algorithm_identifier(krb5_context context,
944*7f2fe78bSCy Schubert                                   krb5_algorithm_identifier *val);
945*7f2fe78bSCy Schubert void k5_free_otp_tokeninfo(krb5_context context, krb5_otp_tokeninfo *val);
946*7f2fe78bSCy Schubert void k5_free_pa_otp_challenge(krb5_context context,
947*7f2fe78bSCy Schubert                               krb5_pa_otp_challenge *val);
948*7f2fe78bSCy Schubert void k5_free_pa_otp_req(krb5_context context, krb5_pa_otp_req *val);
949*7f2fe78bSCy Schubert void k5_free_kkdcp_message(krb5_context context, krb5_kkdcp_message *val);
950*7f2fe78bSCy Schubert void k5_free_cammac(krb5_context context, krb5_cammac *val);
951*7f2fe78bSCy Schubert void k5_free_secure_cookie(krb5_context context, krb5_secure_cookie *val);
952*7f2fe78bSCy Schubert 
953*7f2fe78bSCy Schubert krb5_error_code
954*7f2fe78bSCy Schubert k5_unwrap_cammac_svc(krb5_context context, const krb5_authdata *ad,
955*7f2fe78bSCy Schubert                      const krb5_keyblock *key, krb5_authdata ***adata_out);
956*7f2fe78bSCy Schubert krb5_error_code
957*7f2fe78bSCy Schubert k5_authind_decode(const krb5_authdata *ad, krb5_data ***indicators);
958*7f2fe78bSCy Schubert 
959*7f2fe78bSCy Schubert /* #include "krb5/wordsize.h" -- comes in through base-defs.h. */
960*7f2fe78bSCy Schubert #include "com_err.h"
961*7f2fe78bSCy Schubert #include "k5-plugin.h"
962*7f2fe78bSCy Schubert 
963*7f2fe78bSCy Schubert #include <krb5/authdata_plugin.h>
964*7f2fe78bSCy Schubert 
965*7f2fe78bSCy Schubert struct _krb5_authdata_context {
966*7f2fe78bSCy Schubert     krb5_magic magic;
967*7f2fe78bSCy Schubert     int n_modules;
968*7f2fe78bSCy Schubert     struct _krb5_authdata_context_module {
969*7f2fe78bSCy Schubert         krb5_authdatatype ad_type;
970*7f2fe78bSCy Schubert         void *plugin_context;
971*7f2fe78bSCy Schubert         authdata_client_plugin_fini_proc client_fini;
972*7f2fe78bSCy Schubert         krb5_flags flags;
973*7f2fe78bSCy Schubert         krb5plugin_authdata_client_ftable_v0 *ftable;
974*7f2fe78bSCy Schubert         authdata_client_request_init_proc client_req_init;
975*7f2fe78bSCy Schubert         authdata_client_request_fini_proc client_req_fini;
976*7f2fe78bSCy Schubert         const char *name;
977*7f2fe78bSCy Schubert         void *request_context;
978*7f2fe78bSCy Schubert         void **request_context_pp;
979*7f2fe78bSCy Schubert     } *modules;
980*7f2fe78bSCy Schubert     struct plugin_dir_handle plugins;
981*7f2fe78bSCy Schubert };
982*7f2fe78bSCy Schubert 
983*7f2fe78bSCy Schubert typedef struct _krb5_authdata_context *krb5_authdata_context;
984*7f2fe78bSCy Schubert 
985*7f2fe78bSCy Schubert void
986*7f2fe78bSCy Schubert k5_free_data_ptr_list(krb5_data **list);
987*7f2fe78bSCy Schubert 
988*7f2fe78bSCy Schubert void
989*7f2fe78bSCy Schubert k5_zapfree_pa_data(krb5_pa_data **val);
990*7f2fe78bSCy Schubert 
991*7f2fe78bSCy Schubert void KRB5_CALLCONV
992*7f2fe78bSCy Schubert krb5int_free_data_list(krb5_context context, krb5_data *data);
993*7f2fe78bSCy Schubert 
994*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
995*7f2fe78bSCy Schubert krb5_authdata_context_init(krb5_context kcontext,
996*7f2fe78bSCy Schubert                            krb5_authdata_context *pcontext);
997*7f2fe78bSCy Schubert 
998*7f2fe78bSCy Schubert void KRB5_CALLCONV
999*7f2fe78bSCy Schubert krb5_authdata_context_free(krb5_context kcontext,
1000*7f2fe78bSCy Schubert                            krb5_authdata_context context);
1001*7f2fe78bSCy Schubert 
1002*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1003*7f2fe78bSCy Schubert krb5_authdata_export_authdata(krb5_context kcontext,
1004*7f2fe78bSCy Schubert                               krb5_authdata_context context, krb5_flags usage,
1005*7f2fe78bSCy Schubert                               krb5_authdata ***pauthdata);
1006*7f2fe78bSCy Schubert 
1007*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1008*7f2fe78bSCy Schubert krb5_authdata_get_attribute_types(krb5_context kcontext,
1009*7f2fe78bSCy Schubert                                   krb5_authdata_context context,
1010*7f2fe78bSCy Schubert                                   krb5_data **attrs);
1011*7f2fe78bSCy Schubert 
1012*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1013*7f2fe78bSCy Schubert krb5_authdata_get_attribute(krb5_context kcontext,
1014*7f2fe78bSCy Schubert                             krb5_authdata_context context,
1015*7f2fe78bSCy Schubert                             const krb5_data *attribute,
1016*7f2fe78bSCy Schubert                             krb5_boolean *authenticated,
1017*7f2fe78bSCy Schubert                             krb5_boolean *complete, krb5_data *value,
1018*7f2fe78bSCy Schubert                             krb5_data *display_value, int *more);
1019*7f2fe78bSCy Schubert 
1020*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1021*7f2fe78bSCy Schubert krb5_authdata_set_attribute(krb5_context kcontext,
1022*7f2fe78bSCy Schubert                             krb5_authdata_context context,
1023*7f2fe78bSCy Schubert                             krb5_boolean complete, const krb5_data *attribute,
1024*7f2fe78bSCy Schubert                             const krb5_data *value);
1025*7f2fe78bSCy Schubert 
1026*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1027*7f2fe78bSCy Schubert krb5_authdata_delete_attribute(krb5_context kcontext,
1028*7f2fe78bSCy Schubert                                krb5_authdata_context context,
1029*7f2fe78bSCy Schubert                                const krb5_data *attribute);
1030*7f2fe78bSCy Schubert 
1031*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1032*7f2fe78bSCy Schubert krb5_authdata_import_attributes(krb5_context kcontext,
1033*7f2fe78bSCy Schubert                                 krb5_authdata_context context,
1034*7f2fe78bSCy Schubert                                 krb5_flags usage, const krb5_data *attributes);
1035*7f2fe78bSCy Schubert 
1036*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1037*7f2fe78bSCy Schubert krb5_authdata_export_attributes(krb5_context kcontext,
1038*7f2fe78bSCy Schubert                                 krb5_authdata_context context,
1039*7f2fe78bSCy Schubert                                 krb5_flags usage, krb5_data **pattributes);
1040*7f2fe78bSCy Schubert 
1041*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1042*7f2fe78bSCy Schubert krb5_authdata_export_internal(krb5_context kcontext,
1043*7f2fe78bSCy Schubert                               krb5_authdata_context context,
1044*7f2fe78bSCy Schubert                               krb5_boolean restrict_authenticated,
1045*7f2fe78bSCy Schubert                               const char *module, void **ptr);
1046*7f2fe78bSCy Schubert 
1047*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1048*7f2fe78bSCy Schubert krb5_authdata_context_copy(krb5_context kcontext, krb5_authdata_context src,
1049*7f2fe78bSCy Schubert                            krb5_authdata_context *dst);
1050*7f2fe78bSCy Schubert 
1051*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1052*7f2fe78bSCy Schubert krb5_authdata_free_internal(krb5_context kcontext,
1053*7f2fe78bSCy Schubert                             krb5_authdata_context context, const char *module,
1054*7f2fe78bSCy Schubert                             void *ptr);
1055*7f2fe78bSCy Schubert 
1056*7f2fe78bSCy Schubert /*** Plugin framework ***/
1057*7f2fe78bSCy Schubert 
1058*7f2fe78bSCy Schubert /*
1059*7f2fe78bSCy Schubert  * This framework can be used to create pluggable interfaces.  Not all existing
1060*7f2fe78bSCy Schubert  * pluggable interface use this framework, but new ones should.  A new
1061*7f2fe78bSCy Schubert  * pluggable interface entails:
1062*7f2fe78bSCy Schubert  *
1063*7f2fe78bSCy Schubert  * - An interface ID definition in the list of #defines below.
1064*7f2fe78bSCy Schubert  *
1065*7f2fe78bSCy Schubert  * - A name in the interface_names array in lib/krb5/krb/plugins.c.
1066*7f2fe78bSCy Schubert  *
1067*7f2fe78bSCy Schubert  * - An installed public header file in include/krb5.  The public header should
1068*7f2fe78bSCy Schubert  *   include <krb5/plugin.h> and should declare a vtable structure for each
1069*7f2fe78bSCy Schubert  *   supported major version of the interface.
1070*7f2fe78bSCy Schubert  *
1071*7f2fe78bSCy Schubert  * - A consumer API implementation, located within the code unit which makes
1072*7f2fe78bSCy Schubert  *   use of the pluggable interface.  The consumer API should consist of:
1073*7f2fe78bSCy Schubert  *
1074*7f2fe78bSCy Schubert  *   . An interface-specific handle type which contains a vtable structure for
1075*7f2fe78bSCy Schubert  *     the module (or a union of several such structures, if there are multiple
1076*7f2fe78bSCy Schubert  *     supported major versions) and, optionally, resource data bound to the
1077*7f2fe78bSCy Schubert  *     handle.
1078*7f2fe78bSCy Schubert  *
1079*7f2fe78bSCy Schubert  *   . An interface-specific loader function which creates a handle or list of
1080*7f2fe78bSCy Schubert  *     handles.  A list of handles would be created if the interface is a
1081*7f2fe78bSCy Schubert  *     one-to-many interface where the consumer wants to consult all available
1082*7f2fe78bSCy Schubert  *     modules; a single handle would be created for an interface where the
1083*7f2fe78bSCy Schubert  *     consumer wants to consult a specific module.  The loader function should
1084*7f2fe78bSCy Schubert  *     use k5_plugin_load or k5_plugin_load_all to produce one or a list of
1085*7f2fe78bSCy Schubert  *     vtable initializer functions, and should use those functions to fill in
1086*7f2fe78bSCy Schubert  *     the vtable structure for the module (if necessary, trying each supported
1087*7f2fe78bSCy Schubert  *     major version starting from the most recent).  The loader function can
1088*7f2fe78bSCy Schubert  *     also bind resource data into the handle based on caller arguments, if
1089*7f2fe78bSCy Schubert  *     appropriate.
1090*7f2fe78bSCy Schubert  *
1091*7f2fe78bSCy Schubert  *   . For each plugin method, a wrapper function which accepts a krb5_context,
1092*7f2fe78bSCy Schubert  *     a plugin handle, and the method arguments.  Wrapper functions should
1093*7f2fe78bSCy Schubert  *     invoke the method function contained in the handle's vtable.
1094*7f2fe78bSCy Schubert  *
1095*7f2fe78bSCy Schubert  * - Possibly, built-in implementations of the interface, also located within
1096*7f2fe78bSCy Schubert  *   the code unit which makes use of the interface.  Built-in implementations
1097*7f2fe78bSCy Schubert  *   must be registered with k5_plugin_register before the first call to
1098*7f2fe78bSCy Schubert  *   k5_plugin_load or k5_plugin_load_all.
1099*7f2fe78bSCy Schubert  *
1100*7f2fe78bSCy Schubert  * A pluggable interface should have one or more currently supported major
1101*7f2fe78bSCy Schubert  * versions, starting at 1.  Each major version should have a current minor
1102*7f2fe78bSCy Schubert  * version, also starting at 1.  If new methods are added to a vtable, the
1103*7f2fe78bSCy Schubert  * minor version should be incremented and the vtable structure should document
1104*7f2fe78bSCy Schubert  * where each minor vtable version ends.  If method signatures for a vtable are
1105*7f2fe78bSCy Schubert  * changed, the major version should be incremented.
1106*7f2fe78bSCy Schubert  *
1107*7f2fe78bSCy Schubert  * Plugin module implementations (either built-in or dynamically loaded) should
1108*7f2fe78bSCy Schubert  * define a function named <interfacename>_<modulename>_initvt, matching the
1109*7f2fe78bSCy Schubert  * signature of krb5_plugin_initvt_fn as declared in include/krb5/plugin.h.
1110*7f2fe78bSCy Schubert  * The initvt function should check the given maj_ver argument against its own
1111*7f2fe78bSCy Schubert  * supported major versions, cast the vtable pointer to the appropriate
1112*7f2fe78bSCy Schubert  * interface-specific vtable type, and fill in the vtable methods, stopping as
1113*7f2fe78bSCy Schubert  * appropriate for the given min_ver.  Memory for the vtable structure is
1114*7f2fe78bSCy Schubert  * allocated by the caller, not by the module.
1115*7f2fe78bSCy Schubert  *
1116*7f2fe78bSCy Schubert  * Dynamic plugin modules are registered with the framework through the
1117*7f2fe78bSCy Schubert  * [plugins] section of the profile, as described in the admin documentation
1118*7f2fe78bSCy Schubert  * and krb5.conf man page.
1119*7f2fe78bSCy Schubert  */
1120*7f2fe78bSCy Schubert 
1121*7f2fe78bSCy Schubert struct plugin_mapping;
1122*7f2fe78bSCy Schubert 
1123*7f2fe78bSCy Schubert /* Holds krb5_context information about each pluggable interface. */
1124*7f2fe78bSCy Schubert struct plugin_interface {
1125*7f2fe78bSCy Schubert     struct plugin_mapping **modules;
1126*7f2fe78bSCy Schubert     krb5_boolean configured;
1127*7f2fe78bSCy Schubert };
1128*7f2fe78bSCy Schubert 
1129*7f2fe78bSCy Schubert /* A list of plugin interface IDs.  Make sure to increment
1130*7f2fe78bSCy Schubert  * PLUGIN_NUM_INTERFACES when a new interface is added, and add an entry to the
1131*7f2fe78bSCy Schubert  * interface_names table in lib/krb5/krb/plugin.c. */
1132*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_PWQUAL      0
1133*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_KADM5_HOOK  1
1134*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_CLPREAUTH   2
1135*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_KDCPREAUTH  3
1136*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_CCSELECT    4
1137*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_LOCALAUTH   5
1138*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_HOSTREALM   6
1139*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_AUDIT       7
1140*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_TLS         8
1141*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_KDCAUTHDATA 9
1142*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_CERTAUTH    10
1143*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_KADM5_AUTH  11
1144*7f2fe78bSCy Schubert #define PLUGIN_INTERFACE_KDCPOLICY   12
1145*7f2fe78bSCy Schubert #define PLUGIN_NUM_INTERFACES        13
1146*7f2fe78bSCy Schubert 
1147*7f2fe78bSCy Schubert /* Retrieve the plugin module of type interface_id and name modname,
1148*7f2fe78bSCy Schubert  * storing the result into module. */
1149*7f2fe78bSCy Schubert krb5_error_code
1150*7f2fe78bSCy Schubert k5_plugin_load(krb5_context context, int interface_id, const char *modname,
1151*7f2fe78bSCy Schubert                krb5_plugin_initvt_fn *module);
1152*7f2fe78bSCy Schubert 
1153*7f2fe78bSCy Schubert /* Retrieve all plugin modules of type interface_id, storing the result
1154*7f2fe78bSCy Schubert  * into modules.  Free the result with k5_plugin_free_handles. */
1155*7f2fe78bSCy Schubert krb5_error_code
1156*7f2fe78bSCy Schubert k5_plugin_load_all(krb5_context context, int interface_id,
1157*7f2fe78bSCy Schubert                    krb5_plugin_initvt_fn **modules);
1158*7f2fe78bSCy Schubert 
1159*7f2fe78bSCy Schubert /* Release a module list allocated by k5_plugin_load_all. */
1160*7f2fe78bSCy Schubert void
1161*7f2fe78bSCy Schubert k5_plugin_free_modules(krb5_context context, krb5_plugin_initvt_fn *modules);
1162*7f2fe78bSCy Schubert 
1163*7f2fe78bSCy Schubert /* Register a plugin module of type interface_id and name modname. */
1164*7f2fe78bSCy Schubert krb5_error_code
1165*7f2fe78bSCy Schubert k5_plugin_register(krb5_context context, int interface_id, const char *modname,
1166*7f2fe78bSCy Schubert                    krb5_plugin_initvt_fn module);
1167*7f2fe78bSCy Schubert 
1168*7f2fe78bSCy Schubert /*
1169*7f2fe78bSCy Schubert  * Register a plugin module which is part of the krb5 tree but is built as a
1170*7f2fe78bSCy Schubert  * dynamic plugin.  Look for the module in modsubdir relative to the
1171*7f2fe78bSCy Schubert  * context->base_plugin_dir.
1172*7f2fe78bSCy Schubert  */
1173*7f2fe78bSCy Schubert krb5_error_code
1174*7f2fe78bSCy Schubert k5_plugin_register_dyn(krb5_context context, int interface_id,
1175*7f2fe78bSCy Schubert                        const char *modname, const char *modsubdir);
1176*7f2fe78bSCy Schubert 
1177*7f2fe78bSCy Schubert /* Destroy the module state within context; used by krb5_free_context. */
1178*7f2fe78bSCy Schubert void
1179*7f2fe78bSCy Schubert k5_plugin_free_context(krb5_context context);
1180*7f2fe78bSCy Schubert 
1181*7f2fe78bSCy Schubert enum dns_canonhost {
1182*7f2fe78bSCy Schubert     CANONHOST_FALSE = 0,
1183*7f2fe78bSCy Schubert     CANONHOST_TRUE = 1,
1184*7f2fe78bSCy Schubert     CANONHOST_FALLBACK = 2
1185*7f2fe78bSCy Schubert };
1186*7f2fe78bSCy Schubert 
1187*7f2fe78bSCy Schubert struct _kdb5_dal_handle;        /* private, in kdb5.h */
1188*7f2fe78bSCy Schubert typedef struct _kdb5_dal_handle kdb5_dal_handle;
1189*7f2fe78bSCy Schubert struct _kdb_log_context;
1190*7f2fe78bSCy Schubert typedef struct krb5_preauth_context_st *krb5_preauth_context;
1191*7f2fe78bSCy Schubert struct ccselect_module_handle;
1192*7f2fe78bSCy Schubert struct localauth_module_handle;
1193*7f2fe78bSCy Schubert struct hostrealm_module_handle;
1194*7f2fe78bSCy Schubert struct k5_tls_vtable_st;
1195*7f2fe78bSCy Schubert struct _krb5_context {
1196*7f2fe78bSCy Schubert     krb5_magic      magic;
1197*7f2fe78bSCy Schubert     krb5_enctype    *tgs_etypes;
1198*7f2fe78bSCy Schubert     struct _krb5_os_context os_context;
1199*7f2fe78bSCy Schubert     char            *default_realm;
1200*7f2fe78bSCy Schubert     profile_t       profile;
1201*7f2fe78bSCy Schubert     kdb5_dal_handle *dal_handle;
1202*7f2fe78bSCy Schubert     /* allowable clock skew */
1203*7f2fe78bSCy Schubert     krb5_deltat     clockskew;
1204*7f2fe78bSCy Schubert     krb5_flags      kdc_default_options;
1205*7f2fe78bSCy Schubert     krb5_flags      library_options;
1206*7f2fe78bSCy Schubert     krb5_boolean    profile_secure;
1207*7f2fe78bSCy Schubert     int             fcc_default_format;
1208*7f2fe78bSCy Schubert     krb5_prompt_type *prompt_types;
1209*7f2fe78bSCy Schubert     /* Message size above which we'll try TCP first in send-to-kdc
1210*7f2fe78bSCy Schubert        type code.  Aside from the 2**16 size limit, we put no
1211*7f2fe78bSCy Schubert        absolute limit on the UDP packet size.  */
1212*7f2fe78bSCy Schubert     int             udp_pref_limit;
1213*7f2fe78bSCy Schubert 
1214*7f2fe78bSCy Schubert     /* Use the config-file ktypes instead of app-specified?  */
1215*7f2fe78bSCy Schubert     krb5_boolean    use_conf_ktypes;
1216*7f2fe78bSCy Schubert 
1217*7f2fe78bSCy Schubert     /* locate_kdc module stuff */
1218*7f2fe78bSCy Schubert     struct plugin_dir_handle libkrb5_plugins;
1219*7f2fe78bSCy Schubert 
1220*7f2fe78bSCy Schubert     /* preauth module stuff */
1221*7f2fe78bSCy Schubert     krb5_preauth_context preauth_context;
1222*7f2fe78bSCy Schubert 
1223*7f2fe78bSCy Schubert     /* cache module stuff */
1224*7f2fe78bSCy Schubert     struct ccselect_module_handle **ccselect_handles;
1225*7f2fe78bSCy Schubert 
1226*7f2fe78bSCy Schubert     /* localauth module stuff */
1227*7f2fe78bSCy Schubert     struct localauth_module_handle **localauth_handles;
1228*7f2fe78bSCy Schubert 
1229*7f2fe78bSCy Schubert     /* hostrealm module stuff */
1230*7f2fe78bSCy Schubert     struct hostrealm_module_handle **hostrealm_handles;
1231*7f2fe78bSCy Schubert 
1232*7f2fe78bSCy Schubert     /* TLS module vtable (if loaded) */
1233*7f2fe78bSCy Schubert     struct k5_tls_vtable_st *tls;
1234*7f2fe78bSCy Schubert 
1235*7f2fe78bSCy Schubert     /* error detail info */
1236*7f2fe78bSCy Schubert     struct errinfo err;
1237*7f2fe78bSCy Schubert     char *err_fmt;
1238*7f2fe78bSCy Schubert 
1239*7f2fe78bSCy Schubert     /* For Sun iprop code; does this really have to be here?  */
1240*7f2fe78bSCy Schubert     struct _kdb_log_context *kdblog_context;
1241*7f2fe78bSCy Schubert 
1242*7f2fe78bSCy Schubert     krb5_boolean allow_weak_crypto;
1243*7f2fe78bSCy Schubert     krb5_boolean allow_des3;
1244*7f2fe78bSCy Schubert     krb5_boolean allow_rc4;
1245*7f2fe78bSCy Schubert     krb5_boolean ignore_acceptor_hostname;
1246*7f2fe78bSCy Schubert     krb5_boolean enforce_ok_as_delegate;
1247*7f2fe78bSCy Schubert     enum dns_canonhost dns_canonicalize_hostname;
1248*7f2fe78bSCy Schubert 
1249*7f2fe78bSCy Schubert     krb5_trace_callback trace_callback;
1250*7f2fe78bSCy Schubert     void *trace_callback_data;
1251*7f2fe78bSCy Schubert 
1252*7f2fe78bSCy Schubert     krb5_pre_send_fn kdc_send_hook;
1253*7f2fe78bSCy Schubert     void *kdc_send_hook_data;
1254*7f2fe78bSCy Schubert 
1255*7f2fe78bSCy Schubert     krb5_post_recv_fn kdc_recv_hook;
1256*7f2fe78bSCy Schubert     void *kdc_recv_hook_data;
1257*7f2fe78bSCy Schubert 
1258*7f2fe78bSCy Schubert     struct plugin_interface plugins[PLUGIN_NUM_INTERFACES];
1259*7f2fe78bSCy Schubert     char *plugin_base_dir;
1260*7f2fe78bSCy Schubert };
1261*7f2fe78bSCy Schubert 
1262*7f2fe78bSCy Schubert /* could be used in a table to find an etype and initialize a block */
1263*7f2fe78bSCy Schubert 
1264*7f2fe78bSCy Schubert 
1265*7f2fe78bSCy Schubert #define KRB5_LIBOPT_SYNC_KDCTIME        0x0001
1266*7f2fe78bSCy Schubert 
1267*7f2fe78bSCy Schubert /* internal message representations */
1268*7f2fe78bSCy Schubert 
1269*7f2fe78bSCy Schubert typedef struct _krb5_safe {
1270*7f2fe78bSCy Schubert     krb5_magic magic;
1271*7f2fe78bSCy Schubert     krb5_data user_data;                /* user data */
1272*7f2fe78bSCy Schubert     krb5_timestamp timestamp;           /* client time, optional */
1273*7f2fe78bSCy Schubert     krb5_int32 usec;                    /* microsecond portion of time,
1274*7f2fe78bSCy Schubert                                            optional */
1275*7f2fe78bSCy Schubert     krb5_ui_4 seq_number;               /* sequence #, optional */
1276*7f2fe78bSCy Schubert     krb5_address *s_address;    /* sender address */
1277*7f2fe78bSCy Schubert     krb5_address *r_address;    /* recipient address, optional */
1278*7f2fe78bSCy Schubert     krb5_checksum *checksum;    /* data integrity checksum */
1279*7f2fe78bSCy Schubert } krb5_safe;
1280*7f2fe78bSCy Schubert 
1281*7f2fe78bSCy Schubert typedef struct _krb5_priv {
1282*7f2fe78bSCy Schubert     krb5_magic magic;
1283*7f2fe78bSCy Schubert     krb5_enc_data enc_part;             /* encrypted part */
1284*7f2fe78bSCy Schubert } krb5_priv;
1285*7f2fe78bSCy Schubert 
1286*7f2fe78bSCy Schubert typedef struct _krb5_priv_enc_part {
1287*7f2fe78bSCy Schubert     krb5_magic magic;
1288*7f2fe78bSCy Schubert     krb5_data user_data;                /* user data */
1289*7f2fe78bSCy Schubert     krb5_timestamp timestamp;           /* client time, optional */
1290*7f2fe78bSCy Schubert     krb5_int32 usec;                    /* microsecond portion of time, opt. */
1291*7f2fe78bSCy Schubert     krb5_ui_4 seq_number;               /* sequence #, optional */
1292*7f2fe78bSCy Schubert     krb5_address *s_address;    /* sender address */
1293*7f2fe78bSCy Schubert     krb5_address *r_address;    /* recipient address, optional */
1294*7f2fe78bSCy Schubert } krb5_priv_enc_part;
1295*7f2fe78bSCy Schubert 
1296*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_safe(krb5_context, krb5_safe *);
1297*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_priv(krb5_context, krb5_priv *);
1298*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_priv_enc_part(krb5_context, krb5_priv_enc_part *);
1299*7f2fe78bSCy Schubert 
1300*7f2fe78bSCy Schubert /*
1301*7f2fe78bSCy Schubert  * Begin "asn1.h"
1302*7f2fe78bSCy Schubert  */
1303*7f2fe78bSCy Schubert #ifndef KRB5_ASN1__
1304*7f2fe78bSCy Schubert #define KRB5_ASN1__
1305*7f2fe78bSCy Schubert 
1306*7f2fe78bSCy Schubert /* ASN.1 encoding knowledge; KEEP IN SYNC WITH ASN.1 defs! */
1307*7f2fe78bSCy Schubert /* here we use some knowledge of ASN.1 encodings */
1308*7f2fe78bSCy Schubert /*
1309*7f2fe78bSCy Schubert   Ticket is APPLICATION 1.
1310*7f2fe78bSCy Schubert   Authenticator is APPLICATION 2.
1311*7f2fe78bSCy Schubert   AS_REQ is APPLICATION 10.
1312*7f2fe78bSCy Schubert   AS_REP is APPLICATION 11.
1313*7f2fe78bSCy Schubert   TGS_REQ is APPLICATION 12.
1314*7f2fe78bSCy Schubert   TGS_REP is APPLICATION 13.
1315*7f2fe78bSCy Schubert   AP_REQ is APPLICATION 14.
1316*7f2fe78bSCy Schubert   AP_REP is APPLICATION 15.
1317*7f2fe78bSCy Schubert   KRB_SAFE is APPLICATION 20.
1318*7f2fe78bSCy Schubert   KRB_PRIV is APPLICATION 21.
1319*7f2fe78bSCy Schubert   KRB_CRED is APPLICATION 22.
1320*7f2fe78bSCy Schubert   EncASRepPart is APPLICATION 25.
1321*7f2fe78bSCy Schubert   EncTGSRepPart is APPLICATION 26.
1322*7f2fe78bSCy Schubert   EncAPRepPart is APPLICATION 27.
1323*7f2fe78bSCy Schubert   EncKrbPrivPart is APPLICATION 28.
1324*7f2fe78bSCy Schubert   EncKrbCredPart is APPLICATION 29.
1325*7f2fe78bSCy Schubert   KRB_ERROR is APPLICATION 30.
1326*7f2fe78bSCy Schubert */
1327*7f2fe78bSCy Schubert /* allow either constructed or primitive encoding, so check for bit 6
1328*7f2fe78bSCy Schubert    set or reset */
1329*7f2fe78bSCy Schubert #define krb5int_is_app_tag(dat,tag)                     \
1330*7f2fe78bSCy Schubert     ((dat != NULL) && (dat)->length &&                  \
1331*7f2fe78bSCy Schubert      ((((dat)->data[0] & ~0x20) == ((tag) | 0x40))))
1332*7f2fe78bSCy Schubert #define krb5_is_krb_ticket(dat)               krb5int_is_app_tag(dat, 1)
1333*7f2fe78bSCy Schubert #define krb5_is_krb_authenticator(dat)        krb5int_is_app_tag(dat, 2)
1334*7f2fe78bSCy Schubert #define krb5_is_as_req(dat)                   krb5int_is_app_tag(dat, 10)
1335*7f2fe78bSCy Schubert #define krb5_is_as_rep(dat)                   krb5int_is_app_tag(dat, 11)
1336*7f2fe78bSCy Schubert #define krb5_is_tgs_req(dat)                  krb5int_is_app_tag(dat, 12)
1337*7f2fe78bSCy Schubert #define krb5_is_tgs_rep(dat)                  krb5int_is_app_tag(dat, 13)
1338*7f2fe78bSCy Schubert #define krb5_is_ap_req(dat)                   krb5int_is_app_tag(dat, 14)
1339*7f2fe78bSCy Schubert #define krb5_is_ap_rep(dat)                   krb5int_is_app_tag(dat, 15)
1340*7f2fe78bSCy Schubert #define krb5_is_krb_safe(dat)                 krb5int_is_app_tag(dat, 20)
1341*7f2fe78bSCy Schubert #define krb5_is_krb_priv(dat)                 krb5int_is_app_tag(dat, 21)
1342*7f2fe78bSCy Schubert #define krb5_is_krb_cred(dat)                 krb5int_is_app_tag(dat, 22)
1343*7f2fe78bSCy Schubert #define krb5_is_krb_enc_as_rep_part(dat)      krb5int_is_app_tag(dat, 25)
1344*7f2fe78bSCy Schubert #define krb5_is_krb_enc_tgs_rep_part(dat)     krb5int_is_app_tag(dat, 26)
1345*7f2fe78bSCy Schubert #define krb5_is_krb_enc_ap_rep_part(dat)      krb5int_is_app_tag(dat, 27)
1346*7f2fe78bSCy Schubert #define krb5_is_krb_enc_krb_priv_part(dat)    krb5int_is_app_tag(dat, 28)
1347*7f2fe78bSCy Schubert #define krb5_is_krb_enc_krb_cred_part(dat)    krb5int_is_app_tag(dat, 29)
1348*7f2fe78bSCy Schubert #define krb5_is_krb_error(dat)                krb5int_is_app_tag(dat, 30)
1349*7f2fe78bSCy Schubert 
1350*7f2fe78bSCy Schubert /*************************************************************************
1351*7f2fe78bSCy Schubert  * Prototypes for krb5_encode.c
1352*7f2fe78bSCy Schubert  *************************************************************************/
1353*7f2fe78bSCy Schubert 
1354*7f2fe78bSCy Schubert /*
1355*7f2fe78bSCy Schubert   krb5_error_code encode_krb5_structure(const krb5_structure *rep,
1356*7f2fe78bSCy Schubert   krb5_data **code);
1357*7f2fe78bSCy Schubert   modifies  *code
1358*7f2fe78bSCy Schubert   effects   Returns the ASN.1 encoding of *rep in **code.
1359*7f2fe78bSCy Schubert   Returns ASN1_MISSING_FIELD if a required field is empty in *rep.
1360*7f2fe78bSCy Schubert   Returns ENOMEM if memory runs out.
1361*7f2fe78bSCy Schubert */
1362*7f2fe78bSCy Schubert 
1363*7f2fe78bSCy Schubert krb5_error_code
1364*7f2fe78bSCy Schubert encode_krb5_authenticator(const krb5_authenticator *rep, krb5_data **code);
1365*7f2fe78bSCy Schubert 
1366*7f2fe78bSCy Schubert krb5_error_code
1367*7f2fe78bSCy Schubert encode_krb5_ticket(const krb5_ticket *rep, krb5_data **code);
1368*7f2fe78bSCy Schubert 
1369*7f2fe78bSCy Schubert krb5_error_code
1370*7f2fe78bSCy Schubert encode_krb5_enc_tkt_part(const krb5_enc_tkt_part *rep, krb5_data **code);
1371*7f2fe78bSCy Schubert 
1372*7f2fe78bSCy Schubert krb5_error_code
1373*7f2fe78bSCy Schubert encode_krb5_enc_kdc_rep_part(const krb5_enc_kdc_rep_part *rep,
1374*7f2fe78bSCy Schubert                              krb5_data **code);
1375*7f2fe78bSCy Schubert 
1376*7f2fe78bSCy Schubert /* yes, the translation is identical to that used for KDC__REP */
1377*7f2fe78bSCy Schubert krb5_error_code
1378*7f2fe78bSCy Schubert encode_krb5_as_rep(const krb5_kdc_rep *rep, krb5_data **code);
1379*7f2fe78bSCy Schubert 
1380*7f2fe78bSCy Schubert /* yes, the translation is identical to that used for KDC__REP */
1381*7f2fe78bSCy Schubert krb5_error_code
1382*7f2fe78bSCy Schubert encode_krb5_tgs_rep(const krb5_kdc_rep *rep, krb5_data **code);
1383*7f2fe78bSCy Schubert 
1384*7f2fe78bSCy Schubert krb5_error_code
1385*7f2fe78bSCy Schubert encode_krb5_ap_req(const krb5_ap_req *rep, krb5_data **code);
1386*7f2fe78bSCy Schubert 
1387*7f2fe78bSCy Schubert krb5_error_code
1388*7f2fe78bSCy Schubert encode_krb5_ap_rep(const krb5_ap_rep *rep, krb5_data **code);
1389*7f2fe78bSCy Schubert 
1390*7f2fe78bSCy Schubert krb5_error_code
1391*7f2fe78bSCy Schubert encode_krb5_ap_rep_enc_part(const krb5_ap_rep_enc_part *rep, krb5_data **code);
1392*7f2fe78bSCy Schubert 
1393*7f2fe78bSCy Schubert krb5_error_code
1394*7f2fe78bSCy Schubert encode_krb5_as_req(const krb5_kdc_req *rep, krb5_data **code);
1395*7f2fe78bSCy Schubert 
1396*7f2fe78bSCy Schubert krb5_error_code
1397*7f2fe78bSCy Schubert encode_krb5_tgs_req(const krb5_kdc_req *rep, krb5_data **code);
1398*7f2fe78bSCy Schubert 
1399*7f2fe78bSCy Schubert krb5_error_code
1400*7f2fe78bSCy Schubert encode_krb5_kdc_req_body(const krb5_kdc_req *rep, krb5_data **code);
1401*7f2fe78bSCy Schubert 
1402*7f2fe78bSCy Schubert krb5_error_code
1403*7f2fe78bSCy Schubert encode_krb5_safe(const krb5_safe *rep, krb5_data **code);
1404*7f2fe78bSCy Schubert 
1405*7f2fe78bSCy Schubert struct krb5_safe_with_body {
1406*7f2fe78bSCy Schubert     krb5_safe *safe;
1407*7f2fe78bSCy Schubert     krb5_data *body;
1408*7f2fe78bSCy Schubert };
1409*7f2fe78bSCy Schubert krb5_error_code
1410*7f2fe78bSCy Schubert encode_krb5_safe_with_body(const struct krb5_safe_with_body *rep,
1411*7f2fe78bSCy Schubert                            krb5_data **code);
1412*7f2fe78bSCy Schubert 
1413*7f2fe78bSCy Schubert krb5_error_code
1414*7f2fe78bSCy Schubert encode_krb5_priv(const krb5_priv *rep, krb5_data **code);
1415*7f2fe78bSCy Schubert 
1416*7f2fe78bSCy Schubert krb5_error_code
1417*7f2fe78bSCy Schubert encode_krb5_enc_priv_part(const krb5_priv_enc_part *rep, krb5_data **code);
1418*7f2fe78bSCy Schubert 
1419*7f2fe78bSCy Schubert krb5_error_code
1420*7f2fe78bSCy Schubert encode_krb5_cred(const krb5_cred *rep, krb5_data **code);
1421*7f2fe78bSCy Schubert krb5_error_code
1422*7f2fe78bSCy Schubert encode_krb5_checksum(const krb5_checksum *, krb5_data **);
1423*7f2fe78bSCy Schubert 
1424*7f2fe78bSCy Schubert krb5_error_code
1425*7f2fe78bSCy Schubert encode_krb5_enc_cred_part(const krb5_cred_enc_part *rep, krb5_data **code);
1426*7f2fe78bSCy Schubert 
1427*7f2fe78bSCy Schubert krb5_error_code
1428*7f2fe78bSCy Schubert encode_krb5_error(const krb5_error *rep, krb5_data **code);
1429*7f2fe78bSCy Schubert 
1430*7f2fe78bSCy Schubert krb5_error_code
1431*7f2fe78bSCy Schubert encode_krb5_authdata(krb5_authdata *const *rep, krb5_data **code);
1432*7f2fe78bSCy Schubert 
1433*7f2fe78bSCy Schubert krb5_error_code
1434*7f2fe78bSCy Schubert encode_krb5_padata_sequence(krb5_pa_data *const *rep, krb5_data **code);
1435*7f2fe78bSCy Schubert 
1436*7f2fe78bSCy Schubert krb5_error_code
1437*7f2fe78bSCy Schubert encode_krb5_typed_data(krb5_pa_data *const *rep, krb5_data **code);
1438*7f2fe78bSCy Schubert 
1439*7f2fe78bSCy Schubert krb5_error_code
1440*7f2fe78bSCy Schubert encode_krb5_etype_info(krb5_etype_info_entry *const *, krb5_data **code);
1441*7f2fe78bSCy Schubert 
1442*7f2fe78bSCy Schubert krb5_error_code
1443*7f2fe78bSCy Schubert encode_krb5_etype_info2(krb5_etype_info_entry *const *, krb5_data **code);
1444*7f2fe78bSCy Schubert 
1445*7f2fe78bSCy Schubert krb5_error_code
1446*7f2fe78bSCy Schubert encode_krb5_pa_enc_ts(const krb5_pa_enc_ts *, krb5_data **);
1447*7f2fe78bSCy Schubert 
1448*7f2fe78bSCy Schubert krb5_error_code
1449*7f2fe78bSCy Schubert encode_krb5_sam_challenge_2(const krb5_sam_challenge_2 * , krb5_data **);
1450*7f2fe78bSCy Schubert 
1451*7f2fe78bSCy Schubert krb5_error_code
1452*7f2fe78bSCy Schubert encode_krb5_sam_challenge_2_body(const krb5_sam_challenge_2_body *,
1453*7f2fe78bSCy Schubert                                  krb5_data **);
1454*7f2fe78bSCy Schubert 
1455*7f2fe78bSCy Schubert krb5_error_code
1456*7f2fe78bSCy Schubert encode_krb5_enc_sam_response_enc_2(const krb5_enc_sam_response_enc_2 *,
1457*7f2fe78bSCy Schubert                                    krb5_data **);
1458*7f2fe78bSCy Schubert 
1459*7f2fe78bSCy Schubert krb5_error_code
1460*7f2fe78bSCy Schubert encode_krb5_sam_response_2(const krb5_sam_response_2 * , krb5_data **);
1461*7f2fe78bSCy Schubert 
1462*7f2fe78bSCy Schubert struct krb5_setpw_req {
1463*7f2fe78bSCy Schubert     krb5_principal target;
1464*7f2fe78bSCy Schubert     krb5_data password;
1465*7f2fe78bSCy Schubert };
1466*7f2fe78bSCy Schubert krb5_error_code
1467*7f2fe78bSCy Schubert encode_krb5_setpw_req(const struct krb5_setpw_req *rep, krb5_data **code);
1468*7f2fe78bSCy Schubert 
1469*7f2fe78bSCy Schubert krb5_error_code
1470*7f2fe78bSCy Schubert encode_krb5_pa_for_user(const krb5_pa_for_user *, krb5_data **);
1471*7f2fe78bSCy Schubert 
1472*7f2fe78bSCy Schubert krb5_error_code
1473*7f2fe78bSCy Schubert encode_krb5_s4u_userid(const krb5_s4u_userid *, krb5_data **);
1474*7f2fe78bSCy Schubert 
1475*7f2fe78bSCy Schubert krb5_error_code
1476*7f2fe78bSCy Schubert encode_krb5_pa_s4u_x509_user(const krb5_pa_s4u_x509_user *, krb5_data **);
1477*7f2fe78bSCy Schubert 
1478*7f2fe78bSCy Schubert krb5_error_code
1479*7f2fe78bSCy Schubert encode_krb5_pa_pac_req(const krb5_pa_pac_req *, krb5_data **);
1480*7f2fe78bSCy Schubert 
1481*7f2fe78bSCy Schubert krb5_error_code
1482*7f2fe78bSCy Schubert encode_krb5_etype_list(const krb5_etype_list * , krb5_data **);
1483*7f2fe78bSCy Schubert 
1484*7f2fe78bSCy Schubert krb5_error_code
1485*7f2fe78bSCy Schubert encode_krb5_pa_fx_fast_request(const krb5_fast_armored_req *, krb5_data **);
1486*7f2fe78bSCy Schubert 
1487*7f2fe78bSCy Schubert krb5_error_code
1488*7f2fe78bSCy Schubert encode_krb5_fast_req(const krb5_fast_req *, krb5_data **);
1489*7f2fe78bSCy Schubert 
1490*7f2fe78bSCy Schubert krb5_error_code
1491*7f2fe78bSCy Schubert encode_krb5_pa_fx_fast_reply(const krb5_enc_data *, krb5_data **);
1492*7f2fe78bSCy Schubert 
1493*7f2fe78bSCy Schubert krb5_error_code
1494*7f2fe78bSCy Schubert encode_krb5_iakerb_header(const krb5_iakerb_header *, krb5_data **);
1495*7f2fe78bSCy Schubert 
1496*7f2fe78bSCy Schubert krb5_error_code
1497*7f2fe78bSCy Schubert encode_krb5_iakerb_finished(const krb5_iakerb_finished *, krb5_data **);
1498*7f2fe78bSCy Schubert 
1499*7f2fe78bSCy Schubert krb5_error_code
1500*7f2fe78bSCy Schubert encode_krb5_fast_response(const krb5_fast_response *, krb5_data **);
1501*7f2fe78bSCy Schubert 
1502*7f2fe78bSCy Schubert krb5_error_code
1503*7f2fe78bSCy Schubert encode_krb5_ad_kdcissued(const krb5_ad_kdcissued *, krb5_data **);
1504*7f2fe78bSCy Schubert 
1505*7f2fe78bSCy Schubert krb5_error_code
1506*7f2fe78bSCy Schubert encode_krb5_otp_tokeninfo(const krb5_otp_tokeninfo *, krb5_data **);
1507*7f2fe78bSCy Schubert 
1508*7f2fe78bSCy Schubert krb5_error_code
1509*7f2fe78bSCy Schubert encode_krb5_pa_otp_challenge(const krb5_pa_otp_challenge *, krb5_data **);
1510*7f2fe78bSCy Schubert 
1511*7f2fe78bSCy Schubert krb5_error_code
1512*7f2fe78bSCy Schubert encode_krb5_pa_otp_req(const krb5_pa_otp_req *, krb5_data **);
1513*7f2fe78bSCy Schubert 
1514*7f2fe78bSCy Schubert krb5_error_code
1515*7f2fe78bSCy Schubert encode_krb5_pa_otp_enc_req(const krb5_data *, krb5_data **);
1516*7f2fe78bSCy Schubert 
1517*7f2fe78bSCy Schubert krb5_error_code
1518*7f2fe78bSCy Schubert encode_krb5_kkdcp_message(const krb5_kkdcp_message *, krb5_data **);
1519*7f2fe78bSCy Schubert 
1520*7f2fe78bSCy Schubert krb5_error_code
1521*7f2fe78bSCy Schubert encode_krb5_cammac(const krb5_cammac *, krb5_data **);
1522*7f2fe78bSCy Schubert 
1523*7f2fe78bSCy Schubert krb5_error_code
1524*7f2fe78bSCy Schubert encode_utf8_strings(krb5_data *const *ut8fstrings, krb5_data **);
1525*7f2fe78bSCy Schubert 
1526*7f2fe78bSCy Schubert krb5_error_code
1527*7f2fe78bSCy Schubert encode_krb5_secure_cookie(const krb5_secure_cookie *, krb5_data **);
1528*7f2fe78bSCy Schubert 
1529*7f2fe78bSCy Schubert krb5_error_code
1530*7f2fe78bSCy Schubert encode_krb5_pa_pac_options(const krb5_pa_pac_options *, krb5_data **);
1531*7f2fe78bSCy Schubert 
1532*7f2fe78bSCy Schubert /*************************************************************************
1533*7f2fe78bSCy Schubert  * End of prototypes for krb5_encode.c
1534*7f2fe78bSCy Schubert  *************************************************************************/
1535*7f2fe78bSCy Schubert 
1536*7f2fe78bSCy Schubert krb5_error_code
1537*7f2fe78bSCy Schubert decode_krb5_sam_challenge_2(const krb5_data *, krb5_sam_challenge_2 **);
1538*7f2fe78bSCy Schubert 
1539*7f2fe78bSCy Schubert krb5_error_code
1540*7f2fe78bSCy Schubert decode_krb5_sam_challenge_2_body(const krb5_data *,
1541*7f2fe78bSCy Schubert                                  krb5_sam_challenge_2_body **);
1542*7f2fe78bSCy Schubert 
1543*7f2fe78bSCy Schubert krb5_error_code
1544*7f2fe78bSCy Schubert decode_krb5_enc_sam_response_enc_2(const krb5_data *,
1545*7f2fe78bSCy Schubert                                    krb5_enc_sam_response_enc_2 **);
1546*7f2fe78bSCy Schubert 
1547*7f2fe78bSCy Schubert krb5_error_code
1548*7f2fe78bSCy Schubert decode_krb5_sam_response_2(const krb5_data *, krb5_sam_response_2 **);
1549*7f2fe78bSCy Schubert 
1550*7f2fe78bSCy Schubert 
1551*7f2fe78bSCy Schubert /*************************************************************************
1552*7f2fe78bSCy Schubert  * Prototypes for krb5_decode.c
1553*7f2fe78bSCy Schubert  *************************************************************************/
1554*7f2fe78bSCy Schubert /*
1555*7f2fe78bSCy Schubert   krb5_error_code decode_krb5_structure(const krb5_data *code,
1556*7f2fe78bSCy Schubert   krb5_structure **rep);
1557*7f2fe78bSCy Schubert 
1558*7f2fe78bSCy Schubert   requires  Expects **rep to not have been allocated;
1559*7f2fe78bSCy Schubert   a new *rep is allocated regardless of the old value.
1560*7f2fe78bSCy Schubert   effects   Decodes *code into **rep.
1561*7f2fe78bSCy Schubert   Returns ENOMEM if memory is exhausted.
1562*7f2fe78bSCy Schubert   Returns asn1 and krb5 errors.
1563*7f2fe78bSCy Schubert */
1564*7f2fe78bSCy Schubert 
1565*7f2fe78bSCy Schubert krb5_error_code
1566*7f2fe78bSCy Schubert decode_krb5_authenticator(const krb5_data *code, krb5_authenticator **rep);
1567*7f2fe78bSCy Schubert 
1568*7f2fe78bSCy Schubert krb5_error_code
1569*7f2fe78bSCy Schubert decode_krb5_ticket(const krb5_data *code, krb5_ticket **rep);
1570*7f2fe78bSCy Schubert 
1571*7f2fe78bSCy Schubert krb5_error_code
1572*7f2fe78bSCy Schubert decode_krb5_encryption_key(const krb5_data *output, krb5_keyblock **rep);
1573*7f2fe78bSCy Schubert 
1574*7f2fe78bSCy Schubert krb5_error_code
1575*7f2fe78bSCy Schubert decode_krb5_enc_tkt_part(const krb5_data *output, krb5_enc_tkt_part **rep);
1576*7f2fe78bSCy Schubert 
1577*7f2fe78bSCy Schubert krb5_error_code
1578*7f2fe78bSCy Schubert decode_krb5_enc_kdc_rep_part(const krb5_data *output,
1579*7f2fe78bSCy Schubert                              krb5_enc_kdc_rep_part **rep);
1580*7f2fe78bSCy Schubert 
1581*7f2fe78bSCy Schubert krb5_error_code
1582*7f2fe78bSCy Schubert decode_krb5_as_rep(const krb5_data *output, krb5_kdc_rep **rep);
1583*7f2fe78bSCy Schubert 
1584*7f2fe78bSCy Schubert krb5_error_code
1585*7f2fe78bSCy Schubert decode_krb5_tgs_rep(const krb5_data *output, krb5_kdc_rep **rep);
1586*7f2fe78bSCy Schubert 
1587*7f2fe78bSCy Schubert krb5_error_code
1588*7f2fe78bSCy Schubert decode_krb5_ap_req(const krb5_data *output, krb5_ap_req **rep);
1589*7f2fe78bSCy Schubert 
1590*7f2fe78bSCy Schubert krb5_error_code
1591*7f2fe78bSCy Schubert decode_krb5_ap_rep(const krb5_data *output, krb5_ap_rep **rep);
1592*7f2fe78bSCy Schubert 
1593*7f2fe78bSCy Schubert krb5_error_code
1594*7f2fe78bSCy Schubert decode_krb5_ap_rep_enc_part(const krb5_data *output,
1595*7f2fe78bSCy Schubert                             krb5_ap_rep_enc_part **rep);
1596*7f2fe78bSCy Schubert 
1597*7f2fe78bSCy Schubert krb5_error_code
1598*7f2fe78bSCy Schubert decode_krb5_as_req(const krb5_data *output, krb5_kdc_req **rep);
1599*7f2fe78bSCy Schubert 
1600*7f2fe78bSCy Schubert krb5_error_code
1601*7f2fe78bSCy Schubert decode_krb5_tgs_req(const krb5_data *output, krb5_kdc_req **rep);
1602*7f2fe78bSCy Schubert 
1603*7f2fe78bSCy Schubert krb5_error_code
1604*7f2fe78bSCy Schubert decode_krb5_kdc_req_body(const krb5_data *output, krb5_kdc_req **rep);
1605*7f2fe78bSCy Schubert 
1606*7f2fe78bSCy Schubert krb5_error_code
1607*7f2fe78bSCy Schubert decode_krb5_safe(const krb5_data *output, krb5_safe **rep);
1608*7f2fe78bSCy Schubert 
1609*7f2fe78bSCy Schubert krb5_error_code
1610*7f2fe78bSCy Schubert decode_krb5_safe_with_body(const krb5_data *output, krb5_safe **rep,
1611*7f2fe78bSCy Schubert                            krb5_data **body);
1612*7f2fe78bSCy Schubert 
1613*7f2fe78bSCy Schubert krb5_error_code
1614*7f2fe78bSCy Schubert decode_krb5_priv(const krb5_data *output, krb5_priv **rep);
1615*7f2fe78bSCy Schubert 
1616*7f2fe78bSCy Schubert krb5_error_code
1617*7f2fe78bSCy Schubert decode_krb5_enc_priv_part(const krb5_data *output, krb5_priv_enc_part **rep);
1618*7f2fe78bSCy Schubert krb5_error_code
1619*7f2fe78bSCy Schubert decode_krb5_checksum(const krb5_data *, krb5_checksum **);
1620*7f2fe78bSCy Schubert 
1621*7f2fe78bSCy Schubert krb5_error_code
1622*7f2fe78bSCy Schubert decode_krb5_cred(const krb5_data *output, krb5_cred **rep);
1623*7f2fe78bSCy Schubert 
1624*7f2fe78bSCy Schubert krb5_error_code
1625*7f2fe78bSCy Schubert decode_krb5_enc_cred_part(const krb5_data *output, krb5_cred_enc_part **rep);
1626*7f2fe78bSCy Schubert 
1627*7f2fe78bSCy Schubert krb5_error_code
1628*7f2fe78bSCy Schubert decode_krb5_error(const krb5_data *output, krb5_error **rep);
1629*7f2fe78bSCy Schubert 
1630*7f2fe78bSCy Schubert krb5_error_code
1631*7f2fe78bSCy Schubert decode_krb5_authdata(const krb5_data *output, krb5_authdata ***rep);
1632*7f2fe78bSCy Schubert 
1633*7f2fe78bSCy Schubert krb5_error_code
1634*7f2fe78bSCy Schubert decode_krb5_padata_sequence(const krb5_data *output, krb5_pa_data ***rep);
1635*7f2fe78bSCy Schubert 
1636*7f2fe78bSCy Schubert krb5_error_code
1637*7f2fe78bSCy Schubert decode_krb5_typed_data(const krb5_data *, krb5_pa_data ***);
1638*7f2fe78bSCy Schubert 
1639*7f2fe78bSCy Schubert krb5_error_code
1640*7f2fe78bSCy Schubert decode_krb5_etype_info(const krb5_data *output, krb5_etype_info_entry ***rep);
1641*7f2fe78bSCy Schubert 
1642*7f2fe78bSCy Schubert krb5_error_code
1643*7f2fe78bSCy Schubert decode_krb5_etype_info2(const krb5_data *output, krb5_etype_info_entry ***rep);
1644*7f2fe78bSCy Schubert 
1645*7f2fe78bSCy Schubert krb5_error_code
1646*7f2fe78bSCy Schubert decode_krb5_enc_data(const krb5_data *output, krb5_enc_data **rep);
1647*7f2fe78bSCy Schubert 
1648*7f2fe78bSCy Schubert krb5_error_code
1649*7f2fe78bSCy Schubert decode_krb5_pa_enc_ts(const krb5_data *output, krb5_pa_enc_ts **rep);
1650*7f2fe78bSCy Schubert 
1651*7f2fe78bSCy Schubert krb5_error_code
1652*7f2fe78bSCy Schubert decode_krb5_setpw_req(const krb5_data *, krb5_data **, krb5_principal *);
1653*7f2fe78bSCy Schubert 
1654*7f2fe78bSCy Schubert krb5_error_code
1655*7f2fe78bSCy Schubert decode_krb5_pa_for_user(const krb5_data *, krb5_pa_for_user **);
1656*7f2fe78bSCy Schubert 
1657*7f2fe78bSCy Schubert krb5_error_code
1658*7f2fe78bSCy Schubert decode_krb5_pa_s4u_x509_user(const krb5_data *, krb5_pa_s4u_x509_user **);
1659*7f2fe78bSCy Schubert 
1660*7f2fe78bSCy Schubert krb5_error_code
1661*7f2fe78bSCy Schubert decode_krb5_pa_pac_req(const krb5_data *, krb5_pa_pac_req **);
1662*7f2fe78bSCy Schubert 
1663*7f2fe78bSCy Schubert krb5_error_code
1664*7f2fe78bSCy Schubert decode_krb5_etype_list(const krb5_data *, krb5_etype_list **);
1665*7f2fe78bSCy Schubert 
1666*7f2fe78bSCy Schubert krb5_error_code
1667*7f2fe78bSCy Schubert decode_krb5_pa_fx_fast_request(const krb5_data *, krb5_fast_armored_req **);
1668*7f2fe78bSCy Schubert 
1669*7f2fe78bSCy Schubert krb5_error_code
1670*7f2fe78bSCy Schubert decode_krb5_fast_req(const krb5_data *, krb5_fast_req **);
1671*7f2fe78bSCy Schubert 
1672*7f2fe78bSCy Schubert krb5_error_code
1673*7f2fe78bSCy Schubert decode_krb5_pa_fx_fast_reply(const krb5_data *, krb5_enc_data **);
1674*7f2fe78bSCy Schubert 
1675*7f2fe78bSCy Schubert krb5_error_code
1676*7f2fe78bSCy Schubert decode_krb5_fast_response(const krb5_data *, krb5_fast_response **);
1677*7f2fe78bSCy Schubert 
1678*7f2fe78bSCy Schubert krb5_error_code
1679*7f2fe78bSCy Schubert decode_krb5_ad_kdcissued(const krb5_data *, krb5_ad_kdcissued **);
1680*7f2fe78bSCy Schubert 
1681*7f2fe78bSCy Schubert krb5_error_code
1682*7f2fe78bSCy Schubert decode_krb5_iakerb_header(const krb5_data *, krb5_iakerb_header **);
1683*7f2fe78bSCy Schubert 
1684*7f2fe78bSCy Schubert krb5_error_code
1685*7f2fe78bSCy Schubert decode_krb5_iakerb_finished(const krb5_data *, krb5_iakerb_finished **);
1686*7f2fe78bSCy Schubert 
1687*7f2fe78bSCy Schubert krb5_error_code
1688*7f2fe78bSCy Schubert decode_krb5_otp_tokeninfo(const krb5_data *, krb5_otp_tokeninfo **);
1689*7f2fe78bSCy Schubert 
1690*7f2fe78bSCy Schubert krb5_error_code
1691*7f2fe78bSCy Schubert decode_krb5_pa_otp_challenge(const krb5_data *, krb5_pa_otp_challenge **);
1692*7f2fe78bSCy Schubert 
1693*7f2fe78bSCy Schubert krb5_error_code
1694*7f2fe78bSCy Schubert decode_krb5_pa_otp_req(const krb5_data *, krb5_pa_otp_req **);
1695*7f2fe78bSCy Schubert 
1696*7f2fe78bSCy Schubert krb5_error_code
1697*7f2fe78bSCy Schubert decode_krb5_pa_otp_enc_req(const krb5_data *, krb5_data **);
1698*7f2fe78bSCy Schubert 
1699*7f2fe78bSCy Schubert krb5_error_code
1700*7f2fe78bSCy Schubert decode_krb5_kkdcp_message(const krb5_data *, krb5_kkdcp_message **);
1701*7f2fe78bSCy Schubert 
1702*7f2fe78bSCy Schubert krb5_error_code
1703*7f2fe78bSCy Schubert decode_krb5_cammac(const krb5_data *, krb5_cammac **);
1704*7f2fe78bSCy Schubert 
1705*7f2fe78bSCy Schubert krb5_error_code
1706*7f2fe78bSCy Schubert decode_utf8_strings(const krb5_data *, krb5_data ***);
1707*7f2fe78bSCy Schubert 
1708*7f2fe78bSCy Schubert krb5_error_code
1709*7f2fe78bSCy Schubert decode_krb5_secure_cookie(const krb5_data *, krb5_secure_cookie **);
1710*7f2fe78bSCy Schubert 
1711*7f2fe78bSCy Schubert krb5_error_code
1712*7f2fe78bSCy Schubert decode_krb5_pa_pac_options(const krb5_data *, krb5_pa_pac_options **);
1713*7f2fe78bSCy Schubert 
1714*7f2fe78bSCy Schubert struct _krb5_key_data;          /* kdb.h */
1715*7f2fe78bSCy Schubert 
1716*7f2fe78bSCy Schubert struct ldap_seqof_key_data {
1717*7f2fe78bSCy Schubert     krb5_int32 mkvno;           /* Master key version number */
1718*7f2fe78bSCy Schubert     krb5_ui_2 kvno;             /* kvno of key_data elements (all the same) */
1719*7f2fe78bSCy Schubert     struct _krb5_key_data *key_data;
1720*7f2fe78bSCy Schubert     krb5_int16 n_key_data;
1721*7f2fe78bSCy Schubert };
1722*7f2fe78bSCy Schubert typedef struct ldap_seqof_key_data ldap_seqof_key_data;
1723*7f2fe78bSCy Schubert 
1724*7f2fe78bSCy Schubert krb5_error_code
1725*7f2fe78bSCy Schubert krb5int_ldap_encode_sequence_of_keys(const ldap_seqof_key_data *val,
1726*7f2fe78bSCy Schubert                                      krb5_data **code);
1727*7f2fe78bSCy Schubert 
1728*7f2fe78bSCy Schubert krb5_error_code
1729*7f2fe78bSCy Schubert krb5int_ldap_decode_sequence_of_keys(const krb5_data *in,
1730*7f2fe78bSCy Schubert                                      ldap_seqof_key_data **rep);
1731*7f2fe78bSCy Schubert 
1732*7f2fe78bSCy Schubert /*************************************************************************
1733*7f2fe78bSCy Schubert  * End of prototypes for krb5_decode.c
1734*7f2fe78bSCy Schubert  *************************************************************************/
1735*7f2fe78bSCy Schubert 
1736*7f2fe78bSCy Schubert #endif /* KRB5_ASN1__ */
1737*7f2fe78bSCy Schubert /*
1738*7f2fe78bSCy Schubert  * End "asn1.h"
1739*7f2fe78bSCy Schubert  */
1740*7f2fe78bSCy Schubert 
1741*7f2fe78bSCy Schubert 
1742*7f2fe78bSCy Schubert /*
1743*7f2fe78bSCy Schubert  * Internal krb5 library routines
1744*7f2fe78bSCy Schubert  */
1745*7f2fe78bSCy Schubert krb5_error_code
1746*7f2fe78bSCy Schubert krb5_encrypt_tkt_part(krb5_context, const krb5_keyblock *, krb5_ticket *);
1747*7f2fe78bSCy Schubert 
1748*7f2fe78bSCy Schubert krb5_error_code
1749*7f2fe78bSCy Schubert krb5_encode_kdc_rep(krb5_context, krb5_msgtype, const krb5_enc_kdc_rep_part *,
1750*7f2fe78bSCy Schubert                     int using_subkey, const krb5_keyblock *, krb5_kdc_rep *,
1751*7f2fe78bSCy Schubert                     krb5_data ** );
1752*7f2fe78bSCy Schubert 
1753*7f2fe78bSCy Schubert /* Return true if s is non-empty and composed solely of digits. */
1754*7f2fe78bSCy Schubert krb5_boolean
1755*7f2fe78bSCy Schubert k5_is_string_numeric(const char *s);
1756*7f2fe78bSCy Schubert 
1757*7f2fe78bSCy Schubert krb5_error_code
1758*7f2fe78bSCy Schubert k5_parse_host_string(const char *address, int default_port, char **host_out,
1759*7f2fe78bSCy Schubert                      int *port_out);
1760*7f2fe78bSCy Schubert 
1761*7f2fe78bSCy Schubert krb5_error_code
1762*7f2fe78bSCy Schubert k5_size_authdata_context(krb5_context kcontext, krb5_authdata_context context,
1763*7f2fe78bSCy Schubert                          size_t *sizep);
1764*7f2fe78bSCy Schubert 
1765*7f2fe78bSCy Schubert krb5_error_code
1766*7f2fe78bSCy Schubert k5_externalize_authdata_context(krb5_context kcontext,
1767*7f2fe78bSCy Schubert                                 krb5_authdata_context context,
1768*7f2fe78bSCy Schubert                                 krb5_octet **buffer, size_t *lenremain);
1769*7f2fe78bSCy Schubert 
1770*7f2fe78bSCy Schubert krb5_error_code
1771*7f2fe78bSCy Schubert k5_internalize_authdata_context(krb5_context kcontext,
1772*7f2fe78bSCy Schubert                                 krb5_authdata_context *ptr,
1773*7f2fe78bSCy Schubert                                 krb5_octet **buffer, size_t *lenremain);
1774*7f2fe78bSCy Schubert 
1775*7f2fe78bSCy Schubert krb5_error_code
1776*7f2fe78bSCy Schubert k5_size_auth_context(krb5_auth_context auth_context, size_t *sizep);
1777*7f2fe78bSCy Schubert 
1778*7f2fe78bSCy Schubert krb5_error_code
1779*7f2fe78bSCy Schubert k5_externalize_auth_context(krb5_auth_context auth_context,
1780*7f2fe78bSCy Schubert                             krb5_octet **buffer, size_t *lenremain);
1781*7f2fe78bSCy Schubert krb5_error_code
1782*7f2fe78bSCy Schubert k5_internalize_auth_context(krb5_auth_context *argp,
1783*7f2fe78bSCy Schubert                             krb5_octet **buffer, size_t *lenremain);
1784*7f2fe78bSCy Schubert 
1785*7f2fe78bSCy Schubert krb5_error_code
1786*7f2fe78bSCy Schubert k5_size_authdata(krb5_authdata *authdata, size_t *sizep);
1787*7f2fe78bSCy Schubert 
1788*7f2fe78bSCy Schubert krb5_error_code
1789*7f2fe78bSCy Schubert k5_externalize_authdata(krb5_authdata *authdata,
1790*7f2fe78bSCy Schubert                         krb5_octet **buffer, size_t *lenremain);
1791*7f2fe78bSCy Schubert 
1792*7f2fe78bSCy Schubert krb5_error_code
1793*7f2fe78bSCy Schubert k5_internalize_authdata(krb5_authdata **authdata,
1794*7f2fe78bSCy Schubert                         krb5_octet **buffer, size_t *lenremain);
1795*7f2fe78bSCy Schubert 
1796*7f2fe78bSCy Schubert krb5_error_code
1797*7f2fe78bSCy Schubert k5_size_address(krb5_address *address, size_t *sizep);
1798*7f2fe78bSCy Schubert 
1799*7f2fe78bSCy Schubert krb5_error_code
1800*7f2fe78bSCy Schubert k5_externalize_address(krb5_address *address,
1801*7f2fe78bSCy Schubert                        krb5_octet **buffer, size_t *lenremain);
1802*7f2fe78bSCy Schubert 
1803*7f2fe78bSCy Schubert krb5_error_code
1804*7f2fe78bSCy Schubert k5_internalize_address(krb5_address **argp,
1805*7f2fe78bSCy Schubert                        krb5_octet **buffer, size_t *lenremain);
1806*7f2fe78bSCy Schubert 
1807*7f2fe78bSCy Schubert krb5_error_code
1808*7f2fe78bSCy Schubert k5_size_authenticator(krb5_authenticator *authenticator, size_t *sizep);
1809*7f2fe78bSCy Schubert 
1810*7f2fe78bSCy Schubert krb5_error_code
1811*7f2fe78bSCy Schubert k5_externalize_authenticator(krb5_authenticator *authenticator,
1812*7f2fe78bSCy Schubert                              krb5_octet **buffer, size_t *lenremain);
1813*7f2fe78bSCy Schubert 
1814*7f2fe78bSCy Schubert krb5_error_code
1815*7f2fe78bSCy Schubert k5_internalize_authenticator(krb5_authenticator **argp,
1816*7f2fe78bSCy Schubert                              krb5_octet **buffer, size_t *lenremain);
1817*7f2fe78bSCy Schubert 
1818*7f2fe78bSCy Schubert krb5_error_code
1819*7f2fe78bSCy Schubert k5_size_checksum(krb5_checksum *checksum, size_t *sizep);
1820*7f2fe78bSCy Schubert 
1821*7f2fe78bSCy Schubert krb5_error_code
1822*7f2fe78bSCy Schubert k5_externalize_checksum(krb5_checksum *checksum,
1823*7f2fe78bSCy Schubert                         krb5_octet **buffer, size_t *lenremain);
1824*7f2fe78bSCy Schubert 
1825*7f2fe78bSCy Schubert krb5_error_code
1826*7f2fe78bSCy Schubert k5_internalize_checksum(krb5_checksum **argp,
1827*7f2fe78bSCy Schubert                         krb5_octet **buffer, size_t *lenremain);
1828*7f2fe78bSCy Schubert 
1829*7f2fe78bSCy Schubert krb5_error_code
1830*7f2fe78bSCy Schubert k5_size_context(krb5_context context, size_t *sizep);
1831*7f2fe78bSCy Schubert 
1832*7f2fe78bSCy Schubert krb5_error_code
1833*7f2fe78bSCy Schubert k5_externalize_context(krb5_context context,
1834*7f2fe78bSCy Schubert                        krb5_octet **buffer, size_t *lenremain);
1835*7f2fe78bSCy Schubert 
1836*7f2fe78bSCy Schubert krb5_error_code
1837*7f2fe78bSCy Schubert k5_internalize_context(krb5_context *argp,
1838*7f2fe78bSCy Schubert                        krb5_octet **buffer, size_t *lenremain);
1839*7f2fe78bSCy Schubert 
1840*7f2fe78bSCy Schubert krb5_error_code
1841*7f2fe78bSCy Schubert k5_size_keyblock(krb5_keyblock *keyblock, size_t *sizep);
1842*7f2fe78bSCy Schubert 
1843*7f2fe78bSCy Schubert krb5_error_code
1844*7f2fe78bSCy Schubert k5_externalize_keyblock(krb5_keyblock *keyblock,
1845*7f2fe78bSCy Schubert                         krb5_octet **buffer, size_t *lenremain);
1846*7f2fe78bSCy Schubert 
1847*7f2fe78bSCy Schubert krb5_error_code
1848*7f2fe78bSCy Schubert k5_internalize_keyblock(krb5_keyblock **argp,
1849*7f2fe78bSCy Schubert                         krb5_octet **buffer, size_t *lenremain);
1850*7f2fe78bSCy Schubert 
1851*7f2fe78bSCy Schubert krb5_error_code
1852*7f2fe78bSCy Schubert k5_size_principal(krb5_principal principal, size_t *sizep);
1853*7f2fe78bSCy Schubert 
1854*7f2fe78bSCy Schubert krb5_error_code
1855*7f2fe78bSCy Schubert k5_externalize_principal(krb5_principal principal,
1856*7f2fe78bSCy Schubert                          krb5_octet **buffer, size_t *lenremain);
1857*7f2fe78bSCy Schubert 
1858*7f2fe78bSCy Schubert krb5_error_code
1859*7f2fe78bSCy Schubert k5_internalize_principal(krb5_principal *argp,
1860*7f2fe78bSCy Schubert                          krb5_octet **buffer, size_t *lenremain);
1861*7f2fe78bSCy Schubert 
1862*7f2fe78bSCy Schubert /*
1863*7f2fe78bSCy Schubert  * Initialization routines.
1864*7f2fe78bSCy Schubert  */
1865*7f2fe78bSCy Schubert 
1866*7f2fe78bSCy Schubert /* [De]serialize 4-byte integer */
1867*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1868*7f2fe78bSCy Schubert krb5_ser_pack_int32(krb5_int32, krb5_octet **, size_t *);
1869*7f2fe78bSCy Schubert 
1870*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1871*7f2fe78bSCy Schubert krb5_ser_unpack_int32(krb5_int32 *, krb5_octet **, size_t *);
1872*7f2fe78bSCy Schubert 
1873*7f2fe78bSCy Schubert /* [De]serialize 8-byte integer */
1874*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1875*7f2fe78bSCy Schubert krb5_ser_pack_int64(int64_t, krb5_octet **, size_t *);
1876*7f2fe78bSCy Schubert 
1877*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1878*7f2fe78bSCy Schubert krb5_ser_unpack_int64(int64_t *, krb5_octet **, size_t *);
1879*7f2fe78bSCy Schubert 
1880*7f2fe78bSCy Schubert /* [De]serialize byte string */
1881*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1882*7f2fe78bSCy Schubert krb5_ser_pack_bytes(krb5_octet *, size_t, krb5_octet **, size_t *);
1883*7f2fe78bSCy Schubert 
1884*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1885*7f2fe78bSCy Schubert krb5_ser_unpack_bytes(krb5_octet *, size_t, krb5_octet **, size_t *);
1886*7f2fe78bSCy Schubert 
1887*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1888*7f2fe78bSCy Schubert krb5int_cc_default(krb5_context, krb5_ccache *);
1889*7f2fe78bSCy Schubert 
1890*7f2fe78bSCy Schubert krb5_error_code
1891*7f2fe78bSCy Schubert k5_cc_store_primary_cred(krb5_context, krb5_ccache, krb5_creds *);
1892*7f2fe78bSCy Schubert 
1893*7f2fe78bSCy Schubert /* Fill in the buffer with random alphanumeric data. */
1894*7f2fe78bSCy Schubert krb5_error_code
1895*7f2fe78bSCy Schubert krb5int_random_string(krb5_context, char *string, unsigned int length);
1896*7f2fe78bSCy Schubert 
1897*7f2fe78bSCy Schubert /* value to use when requesting a keytab entry and KVNO doesn't matter */
1898*7f2fe78bSCy Schubert #define IGNORE_VNO 0
1899*7f2fe78bSCy Schubert /* value to use when requesting a keytab entry and enctype doesn't matter */
1900*7f2fe78bSCy Schubert #define IGNORE_ENCTYPE 0
1901*7f2fe78bSCy Schubert 
1902*7f2fe78bSCy Schubert /* To keep happy libraries which are (for now) accessing internal stuff */
1903*7f2fe78bSCy Schubert 
1904*7f2fe78bSCy Schubert /* Make sure to increment by one when changing the struct */
1905*7f2fe78bSCy Schubert #define KRB5INT_ACCESS_STRUCT_VERSION 23
1906*7f2fe78bSCy Schubert 
1907*7f2fe78bSCy Schubert typedef struct _krb5int_access {
1908*7f2fe78bSCy Schubert     krb5_error_code (*auth_con_get_subkey_enctype)(krb5_context,
1909*7f2fe78bSCy Schubert                                                    krb5_auth_context,
1910*7f2fe78bSCy Schubert                                                    krb5_enctype *);
1911*7f2fe78bSCy Schubert 
1912*7f2fe78bSCy Schubert     krb5_error_code (*mandatory_cksumtype)(krb5_context, krb5_enctype,
1913*7f2fe78bSCy Schubert                                            krb5_cksumtype *);
1914*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *ser_pack_int64)(int64_t, krb5_octet **,
1915*7f2fe78bSCy Schubert                                                     size_t *);
1916*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *ser_unpack_int64)(int64_t *, krb5_octet **,
1917*7f2fe78bSCy Schubert                                                       size_t *);
1918*7f2fe78bSCy Schubert 
1919*7f2fe78bSCy Schubert     /* Used for KDB LDAP back end.  */
1920*7f2fe78bSCy Schubert     krb5_error_code
1921*7f2fe78bSCy Schubert     (*asn1_ldap_encode_sequence_of_keys)(const ldap_seqof_key_data *val,
1922*7f2fe78bSCy Schubert                                          krb5_data **code);
1923*7f2fe78bSCy Schubert 
1924*7f2fe78bSCy Schubert     krb5_error_code
1925*7f2fe78bSCy Schubert     (*asn1_ldap_decode_sequence_of_keys)(const krb5_data *in,
1926*7f2fe78bSCy Schubert                                          ldap_seqof_key_data **);
1927*7f2fe78bSCy Schubert 
1928*7f2fe78bSCy Schubert     /*
1929*7f2fe78bSCy Schubert      * pkinit asn.1 encode/decode functions
1930*7f2fe78bSCy Schubert      */
1931*7f2fe78bSCy Schubert     krb5_error_code
1932*7f2fe78bSCy Schubert     (*encode_krb5_auth_pack)(const krb5_auth_pack *rep, krb5_data **code);
1933*7f2fe78bSCy Schubert 
1934*7f2fe78bSCy Schubert     krb5_error_code
1935*7f2fe78bSCy Schubert     (*encode_krb5_kdc_dh_key_info)(const krb5_kdc_dh_key_info *rep,
1936*7f2fe78bSCy Schubert                                    krb5_data **code);
1937*7f2fe78bSCy Schubert 
1938*7f2fe78bSCy Schubert     krb5_error_code
1939*7f2fe78bSCy Schubert     (*encode_krb5_pa_pk_as_rep)(const krb5_pa_pk_as_rep *rep,
1940*7f2fe78bSCy Schubert                                 krb5_data **code);
1941*7f2fe78bSCy Schubert 
1942*7f2fe78bSCy Schubert     krb5_error_code
1943*7f2fe78bSCy Schubert     (*encode_krb5_pa_pk_as_req)(const krb5_pa_pk_as_req *rep,
1944*7f2fe78bSCy Schubert                                 krb5_data **code);
1945*7f2fe78bSCy Schubert 
1946*7f2fe78bSCy Schubert     krb5_error_code
1947*7f2fe78bSCy Schubert     (*encode_krb5_reply_key_pack)(const krb5_reply_key_pack *,
1948*7f2fe78bSCy Schubert                                   krb5_data **code);
1949*7f2fe78bSCy Schubert 
1950*7f2fe78bSCy Schubert     krb5_error_code
1951*7f2fe78bSCy Schubert     (*encode_krb5_td_dh_parameters)(krb5_algorithm_identifier *const *,
1952*7f2fe78bSCy Schubert                                     krb5_data **code);
1953*7f2fe78bSCy Schubert 
1954*7f2fe78bSCy Schubert     krb5_error_code
1955*7f2fe78bSCy Schubert     (*encode_krb5_td_trusted_certifiers)(krb5_external_principal_identifier *
1956*7f2fe78bSCy Schubert                                          const *, krb5_data **code);
1957*7f2fe78bSCy Schubert 
1958*7f2fe78bSCy Schubert     krb5_error_code
1959*7f2fe78bSCy Schubert     (*decode_krb5_auth_pack)(const krb5_data *, krb5_auth_pack **);
1960*7f2fe78bSCy Schubert 
1961*7f2fe78bSCy Schubert     krb5_error_code
1962*7f2fe78bSCy Schubert     (*decode_krb5_pa_pk_as_req)(const krb5_data *, krb5_pa_pk_as_req **);
1963*7f2fe78bSCy Schubert 
1964*7f2fe78bSCy Schubert     krb5_error_code
1965*7f2fe78bSCy Schubert     (*decode_krb5_pa_pk_as_rep)(const krb5_data *, krb5_pa_pk_as_rep **);
1966*7f2fe78bSCy Schubert 
1967*7f2fe78bSCy Schubert     krb5_error_code
1968*7f2fe78bSCy Schubert     (*decode_krb5_kdc_dh_key_info)(const krb5_data *, krb5_kdc_dh_key_info **);
1969*7f2fe78bSCy Schubert 
1970*7f2fe78bSCy Schubert     krb5_error_code
1971*7f2fe78bSCy Schubert     (*decode_krb5_principal_name)(const krb5_data *, krb5_principal_data **);
1972*7f2fe78bSCy Schubert 
1973*7f2fe78bSCy Schubert     krb5_error_code
1974*7f2fe78bSCy Schubert     (*decode_krb5_reply_key_pack)(const krb5_data *, krb5_reply_key_pack **);
1975*7f2fe78bSCy Schubert 
1976*7f2fe78bSCy Schubert     krb5_error_code
1977*7f2fe78bSCy Schubert     (*decode_krb5_td_dh_parameters)(const krb5_data *,
1978*7f2fe78bSCy Schubert                                     krb5_algorithm_identifier ***);
1979*7f2fe78bSCy Schubert 
1980*7f2fe78bSCy Schubert     krb5_error_code
1981*7f2fe78bSCy Schubert     (*decode_krb5_td_trusted_certifiers)(const krb5_data *,
1982*7f2fe78bSCy Schubert                                          krb5_external_principal_identifier
1983*7f2fe78bSCy Schubert                                          ***);
1984*7f2fe78bSCy Schubert 
1985*7f2fe78bSCy Schubert     krb5_error_code
1986*7f2fe78bSCy Schubert     (*encode_krb5_kdc_req_body)(const krb5_kdc_req *rep, krb5_data **code);
1987*7f2fe78bSCy Schubert 
1988*7f2fe78bSCy Schubert     void
1989*7f2fe78bSCy Schubert     (KRB5_CALLCONV *free_kdc_req)(krb5_context, krb5_kdc_req * );
1990*7f2fe78bSCy Schubert     void
1991*7f2fe78bSCy Schubert     (*set_prompt_types)(krb5_context, krb5_prompt_type *);
1992*7f2fe78bSCy Schubert } krb5int_access;
1993*7f2fe78bSCy Schubert 
1994*7f2fe78bSCy Schubert #define KRB5INT_ACCESS_VERSION                                          \
1995*7f2fe78bSCy Schubert     (((krb5_int32)((sizeof(krb5int_access) & 0xFFFF) |                  \
1996*7f2fe78bSCy Schubert                    (KRB5INT_ACCESS_STRUCT_VERSION << 16))) & 0xFFFFFFFF)
1997*7f2fe78bSCy Schubert 
1998*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
1999*7f2fe78bSCy Schubert krb5int_accessor(krb5int_access*, krb5_int32);
2000*7f2fe78bSCy Schubert 
2001*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
2002*7f2fe78bSCy Schubert krb5int_cc_user_set_default_name(krb5_context context, const char *name);
2003*7f2fe78bSCy Schubert 
2004*7f2fe78bSCy Schubert krb5_error_code k5_rc_default(krb5_context context, krb5_rcache *rc_out);
2005*7f2fe78bSCy Schubert krb5_error_code k5_rc_resolve(krb5_context context, const char *name,
2006*7f2fe78bSCy Schubert                               krb5_rcache *rc_out);
2007*7f2fe78bSCy Schubert void k5_rc_close(krb5_context context, krb5_rcache rc);
2008*7f2fe78bSCy Schubert krb5_error_code k5_rc_store(krb5_context context, krb5_rcache rc,
2009*7f2fe78bSCy Schubert                             const krb5_enc_data *authenticator);
2010*7f2fe78bSCy Schubert const char *k5_rc_get_name(krb5_context context, krb5_rcache rc);
2011*7f2fe78bSCy Schubert 
2012*7f2fe78bSCy Schubert /* Set *tag_out to the integrity tag of *enc.  (Does not allocate memory;
2013*7f2fe78bSCy Schubert  * returned buffer is a subrange of *ctext.) */
2014*7f2fe78bSCy Schubert krb5_error_code
2015*7f2fe78bSCy Schubert k5_rc_tag_from_ciphertext(krb5_context context, const krb5_enc_data *enc,
2016*7f2fe78bSCy Schubert                           krb5_data *tag_out);
2017*7f2fe78bSCy Schubert 
2018*7f2fe78bSCy Schubert /*
2019*7f2fe78bSCy Schubert  * This structure was exposed and used in macros in krb5 1.2, so do not
2020*7f2fe78bSCy Schubert  * change its ABI.
2021*7f2fe78bSCy Schubert  */
2022*7f2fe78bSCy Schubert typedef struct _krb5_kt_ops {
2023*7f2fe78bSCy Schubert     krb5_magic magic;
2024*7f2fe78bSCy Schubert     char *prefix;
2025*7f2fe78bSCy Schubert 
2026*7f2fe78bSCy Schubert     /* routines always present */
2027*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *resolve)(krb5_context, const char *,
2028*7f2fe78bSCy Schubert                                              krb5_keytab *);
2029*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *get_name)(krb5_context, krb5_keytab,
2030*7f2fe78bSCy Schubert                                               char *, unsigned int);
2031*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *close)(krb5_context, krb5_keytab);
2032*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *get)(krb5_context, krb5_keytab,
2033*7f2fe78bSCy Schubert                                          krb5_const_principal, krb5_kvno,
2034*7f2fe78bSCy Schubert                                          krb5_enctype, krb5_keytab_entry *);
2035*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *start_seq_get)(krb5_context, krb5_keytab,
2036*7f2fe78bSCy Schubert                                                    krb5_kt_cursor *);
2037*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *get_next)(krb5_context, krb5_keytab,
2038*7f2fe78bSCy Schubert                                               krb5_keytab_entry *,
2039*7f2fe78bSCy Schubert                                               krb5_kt_cursor *);
2040*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *end_get)(krb5_context, krb5_keytab,
2041*7f2fe78bSCy Schubert                                              krb5_kt_cursor *);
2042*7f2fe78bSCy Schubert     /* routines to be included on extended version (write routines) */
2043*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *add)(krb5_context, krb5_keytab,
2044*7f2fe78bSCy Schubert                                          krb5_keytab_entry *);
2045*7f2fe78bSCy Schubert     krb5_error_code (KRB5_CALLCONV *remove)(krb5_context, krb5_keytab,
2046*7f2fe78bSCy Schubert                                             krb5_keytab_entry *);
2047*7f2fe78bSCy Schubert } krb5_kt_ops;
2048*7f2fe78bSCy Schubert 
2049*7f2fe78bSCy Schubert /* Not sure it's ready for exposure just yet.  */
2050*7f2fe78bSCy Schubert extern krb5_error_code
2051*7f2fe78bSCy Schubert krb5int_c_mandatory_cksumtype(krb5_context, krb5_enctype, krb5_cksumtype *);
2052*7f2fe78bSCy Schubert 
2053*7f2fe78bSCy Schubert /*
2054*7f2fe78bSCy Schubert  * Referral definitions and subfunctions.
2055*7f2fe78bSCy Schubert  */
2056*7f2fe78bSCy Schubert #define        KRB5_REFERRAL_MAXHOPS    10
2057*7f2fe78bSCy Schubert 
2058*7f2fe78bSCy Schubert struct _krb5_kt {       /* should move into k5-int.h */
2059*7f2fe78bSCy Schubert     krb5_magic magic;
2060*7f2fe78bSCy Schubert     const struct _krb5_kt_ops *ops;
2061*7f2fe78bSCy Schubert     krb5_pointer data;
2062*7f2fe78bSCy Schubert };
2063*7f2fe78bSCy Schubert 
2064*7f2fe78bSCy Schubert krb5_error_code krb5_get_default_in_tkt_ktypes(krb5_context, krb5_enctype **);
2065*7f2fe78bSCy Schubert 
2066*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
2067*7f2fe78bSCy Schubert krb5_get_tgs_ktypes(krb5_context, krb5_const_principal, krb5_enctype **);
2068*7f2fe78bSCy Schubert 
2069*7f2fe78bSCy Schubert krb5_boolean krb5_is_permitted_enctype(krb5_context, krb5_enctype);
2070*7f2fe78bSCy Schubert 
2071*7f2fe78bSCy Schubert krb5_boolean KRB5_CALLCONV krb5int_c_weak_enctype(krb5_enctype);
2072*7f2fe78bSCy Schubert krb5_boolean KRB5_CALLCONV krb5int_c_deprecated_enctype(krb5_enctype);
2073*7f2fe78bSCy Schubert krb5_error_code k5_enctype_to_ssf(krb5_enctype enctype, unsigned int *ssf_out);
2074*7f2fe78bSCy Schubert 
2075*7f2fe78bSCy Schubert krb5_error_code krb5_kdc_rep_decrypt_proc(krb5_context, const krb5_keyblock *,
2076*7f2fe78bSCy Schubert                                           krb5_const_pointer, krb5_kdc_rep *);
2077*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV krb5_decrypt_tkt_part(krb5_context,
2078*7f2fe78bSCy Schubert                                                     const krb5_keyblock *,
2079*7f2fe78bSCy Schubert                                                     krb5_ticket * );
2080*7f2fe78bSCy Schubert 
2081*7f2fe78bSCy Schubert krb5_error_code krb5_get_cred_via_tkt(krb5_context, krb5_creds *, krb5_flags,
2082*7f2fe78bSCy Schubert                                       krb5_address *const *, krb5_creds *,
2083*7f2fe78bSCy Schubert                                       krb5_creds **);
2084*7f2fe78bSCy Schubert 
2085*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV krb5_copy_addr(krb5_context,
2086*7f2fe78bSCy Schubert                                              const krb5_address *,
2087*7f2fe78bSCy Schubert                                              krb5_address **);
2088*7f2fe78bSCy Schubert 
2089*7f2fe78bSCy Schubert void krb5_init_ets(krb5_context);
2090*7f2fe78bSCy Schubert void krb5_free_ets(krb5_context);
2091*7f2fe78bSCy Schubert krb5_error_code krb5_generate_subkey(krb5_context, const krb5_keyblock *,
2092*7f2fe78bSCy Schubert                                      krb5_keyblock **);
2093*7f2fe78bSCy Schubert krb5_error_code krb5_generate_subkey_extended(krb5_context,
2094*7f2fe78bSCy Schubert                                               const krb5_keyblock *,
2095*7f2fe78bSCy Schubert                                               krb5_enctype, krb5_keyblock **);
2096*7f2fe78bSCy Schubert krb5_error_code krb5_generate_seq_number(krb5_context, const krb5_keyblock *,
2097*7f2fe78bSCy Schubert                                          krb5_ui_4 *);
2098*7f2fe78bSCy Schubert 
2099*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV krb5_kt_register(krb5_context,
2100*7f2fe78bSCy Schubert                                                const struct _krb5_kt_ops *);
2101*7f2fe78bSCy Schubert 
2102*7f2fe78bSCy Schubert krb5_error_code k5_kt_get_principal(krb5_context context, krb5_keytab keytab,
2103*7f2fe78bSCy Schubert                                     krb5_principal *princ_out);
2104*7f2fe78bSCy Schubert 
2105*7f2fe78bSCy Schubert krb5_error_code k5_kt_have_match(krb5_context context, krb5_keytab keytab,
2106*7f2fe78bSCy Schubert                                  krb5_principal mprinc);
2107*7f2fe78bSCy Schubert 
2108*7f2fe78bSCy Schubert krb5_error_code krb5_principal2salt_norealm(krb5_context, krb5_const_principal,
2109*7f2fe78bSCy Schubert                                             krb5_data *);
2110*7f2fe78bSCy Schubert 
2111*7f2fe78bSCy Schubert unsigned int KRB5_CALLCONV krb5_get_notification_message(void);
2112*7f2fe78bSCy Schubert 
2113*7f2fe78bSCy Schubert /* chk_trans.c */
2114*7f2fe78bSCy Schubert krb5_error_code krb5_check_transited_list(krb5_context, const krb5_data *trans,
2115*7f2fe78bSCy Schubert                                           const krb5_data *realm1,
2116*7f2fe78bSCy Schubert                                           const krb5_data *realm2);
2117*7f2fe78bSCy Schubert 
2118*7f2fe78bSCy Schubert /* free_rtree.c */
2119*7f2fe78bSCy Schubert void krb5_free_realm_tree(krb5_context, krb5_principal *);
2120*7f2fe78bSCy Schubert 
2121*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_authenticator_contents(krb5_context,
2122*7f2fe78bSCy Schubert                                                     krb5_authenticator *);
2123*7f2fe78bSCy Schubert 
2124*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_address(krb5_context, krb5_address *);
2125*7f2fe78bSCy Schubert 
2126*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_enc_tkt_part(krb5_context, krb5_enc_tkt_part *);
2127*7f2fe78bSCy Schubert 
2128*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_tickets(krb5_context, krb5_ticket **);
2129*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_kdc_req(krb5_context, krb5_kdc_req *);
2130*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_kdc_rep(krb5_context, krb5_kdc_rep *);
2131*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_last_req(krb5_context, krb5_last_req_entry **);
2132*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_enc_kdc_rep_part(krb5_context,
2133*7f2fe78bSCy Schubert                                               krb5_enc_kdc_rep_part *);
2134*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_ap_req(krb5_context, krb5_ap_req *);
2135*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_ap_rep(krb5_context, krb5_ap_rep *);
2136*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_cred(krb5_context, krb5_cred *);
2137*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_cred_enc_part(krb5_context, krb5_cred_enc_part *);
2138*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_pa_data(krb5_context, krb5_pa_data **);
2139*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_tkt_authent(krb5_context, krb5_tkt_authent *);
2140*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_enc_data(krb5_context, krb5_enc_data *);
2141*7f2fe78bSCy Schubert krb5_error_code krb5_set_config_files(krb5_context, const char **);
2142*7f2fe78bSCy Schubert 
2143*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV krb5_get_default_config_files(char ***filenames);
2144*7f2fe78bSCy Schubert 
2145*7f2fe78bSCy Schubert void KRB5_CALLCONV krb5_free_config_files(char **filenames);
2146*7f2fe78bSCy Schubert 
2147*7f2fe78bSCy Schubert krb5_error_code krb5_rd_req_decoded(krb5_context, krb5_auth_context *,
2148*7f2fe78bSCy Schubert                                     const krb5_ap_req *, krb5_const_principal,
2149*7f2fe78bSCy Schubert                                     krb5_keytab, krb5_flags *, krb5_ticket **);
2150*7f2fe78bSCy Schubert 
2151*7f2fe78bSCy Schubert krb5_error_code krb5_rd_req_decoded_anyflag(krb5_context, krb5_auth_context *,
2152*7f2fe78bSCy Schubert                                             const krb5_ap_req *,
2153*7f2fe78bSCy Schubert                                             krb5_const_principal, krb5_keytab,
2154*7f2fe78bSCy Schubert                                             krb5_flags *, krb5_ticket **);
2155*7f2fe78bSCy Schubert 
2156*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
2157*7f2fe78bSCy Schubert krb5_cc_register(krb5_context, const krb5_cc_ops *, krb5_boolean );
2158*7f2fe78bSCy Schubert 
2159*7f2fe78bSCy Schubert krb5_error_code krb5_walk_realm_tree(krb5_context, const krb5_data *,
2160*7f2fe78bSCy Schubert                                      const krb5_data *, krb5_principal **,
2161*7f2fe78bSCy Schubert                                      int);
2162*7f2fe78bSCy Schubert 
2163*7f2fe78bSCy Schubert krb5_error_code
2164*7f2fe78bSCy Schubert krb5_auth_con_set_safe_cksumtype(krb5_context, krb5_auth_context,
2165*7f2fe78bSCy Schubert                                  krb5_cksumtype);
2166*7f2fe78bSCy Schubert 
2167*7f2fe78bSCy Schubert krb5_error_code krb5_auth_con_setivector(krb5_context, krb5_auth_context,
2168*7f2fe78bSCy Schubert                                          krb5_pointer);
2169*7f2fe78bSCy Schubert 
2170*7f2fe78bSCy Schubert krb5_error_code krb5_auth_con_getivector(krb5_context, krb5_auth_context,
2171*7f2fe78bSCy Schubert                                          krb5_pointer *);
2172*7f2fe78bSCy Schubert 
2173*7f2fe78bSCy Schubert krb5_error_code krb5_auth_con_setpermetypes(krb5_context, krb5_auth_context,
2174*7f2fe78bSCy Schubert                                             const krb5_enctype *);
2175*7f2fe78bSCy Schubert 
2176*7f2fe78bSCy Schubert krb5_error_code krb5_auth_con_getpermetypes(krb5_context, krb5_auth_context,
2177*7f2fe78bSCy Schubert                                             krb5_enctype **);
2178*7f2fe78bSCy Schubert 
2179*7f2fe78bSCy Schubert krb5_error_code krb5_auth_con_get_subkey_enctype(krb5_context context,
2180*7f2fe78bSCy Schubert                                                  krb5_auth_context,
2181*7f2fe78bSCy Schubert                                                  krb5_enctype *);
2182*7f2fe78bSCy Schubert 
2183*7f2fe78bSCy Schubert krb5_error_code
2184*7f2fe78bSCy Schubert krb5_auth_con_get_authdata_context(krb5_context context,
2185*7f2fe78bSCy Schubert                                    krb5_auth_context auth_context,
2186*7f2fe78bSCy Schubert                                    krb5_authdata_context *ad_context);
2187*7f2fe78bSCy Schubert 
2188*7f2fe78bSCy Schubert krb5_error_code
2189*7f2fe78bSCy Schubert krb5_auth_con_set_authdata_context(krb5_context context,
2190*7f2fe78bSCy Schubert                                    krb5_auth_context auth_context,
2191*7f2fe78bSCy Schubert                                    krb5_authdata_context ad_context);
2192*7f2fe78bSCy Schubert 
2193*7f2fe78bSCy Schubert krb5_error_code krb5_read_message(krb5_context, krb5_pointer, krb5_data *);
2194*7f2fe78bSCy Schubert krb5_error_code krb5_write_message(krb5_context, krb5_pointer, krb5_data *);
2195*7f2fe78bSCy Schubert int krb5_net_read(krb5_context, int , char *, int);
2196*7f2fe78bSCy Schubert int krb5_net_write(krb5_context, int , const char *, int);
2197*7f2fe78bSCy Schubert 
2198*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV krb5_get_realm_domain(krb5_context,
2199*7f2fe78bSCy Schubert                                                     const char *, char ** );
2200*7f2fe78bSCy Schubert 
2201*7f2fe78bSCy Schubert krb5_error_code krb5_gen_portaddr(krb5_context, const krb5_address *,
2202*7f2fe78bSCy Schubert                                   krb5_const_pointer, krb5_address **);
2203*7f2fe78bSCy Schubert 
2204*7f2fe78bSCy Schubert krb5_error_code krb5_gen_replay_name(krb5_context, const krb5_address *,
2205*7f2fe78bSCy Schubert                                      const char *, char **);
2206*7f2fe78bSCy Schubert krb5_error_code krb5_make_fulladdr(krb5_context, krb5_address *,
2207*7f2fe78bSCy Schubert                                    krb5_address *, krb5_address *);
2208*7f2fe78bSCy Schubert 
2209*7f2fe78bSCy Schubert krb5_error_code krb5_set_debugging_time(krb5_context, krb5_timestamp,
2210*7f2fe78bSCy Schubert                                         krb5_int32);
2211*7f2fe78bSCy Schubert krb5_error_code krb5_use_natural_time(krb5_context);
2212*7f2fe78bSCy Schubert krb5_error_code krb5_set_time_offsets(krb5_context, krb5_timestamp,
2213*7f2fe78bSCy Schubert                                       krb5_int32);
2214*7f2fe78bSCy Schubert 
2215*7f2fe78bSCy Schubert /* Some data comparison and conversion functions.  */
2216*7f2fe78bSCy Schubert static inline int
data_eq(krb5_data d1,krb5_data d2)2217*7f2fe78bSCy Schubert data_eq(krb5_data d1, krb5_data d2)
2218*7f2fe78bSCy Schubert {
2219*7f2fe78bSCy Schubert     return (d1.length == d2.length && (d1.length == 0 ||
2220*7f2fe78bSCy Schubert                                        !memcmp(d1.data, d2.data, d1.length)));
2221*7f2fe78bSCy Schubert }
2222*7f2fe78bSCy Schubert 
2223*7f2fe78bSCy Schubert static inline int
data_eq_string(krb5_data d,const char * s)2224*7f2fe78bSCy Schubert data_eq_string (krb5_data d, const char *s)
2225*7f2fe78bSCy Schubert {
2226*7f2fe78bSCy Schubert     return (d.length == strlen(s) && (d.length == 0 ||
2227*7f2fe78bSCy Schubert                                       !memcmp(d.data, s, d.length)));
2228*7f2fe78bSCy Schubert }
2229*7f2fe78bSCy Schubert 
2230*7f2fe78bSCy Schubert static inline krb5_data
make_data(void * data,unsigned int len)2231*7f2fe78bSCy Schubert make_data(void *data, unsigned int len)
2232*7f2fe78bSCy Schubert {
2233*7f2fe78bSCy Schubert     krb5_data d;
2234*7f2fe78bSCy Schubert 
2235*7f2fe78bSCy Schubert     d.magic = KV5M_DATA;
2236*7f2fe78bSCy Schubert     d.data = (char *) data;
2237*7f2fe78bSCy Schubert     d.length = len;
2238*7f2fe78bSCy Schubert     return d;
2239*7f2fe78bSCy Schubert }
2240*7f2fe78bSCy Schubert 
2241*7f2fe78bSCy Schubert static inline krb5_data
empty_data()2242*7f2fe78bSCy Schubert empty_data()
2243*7f2fe78bSCy Schubert {
2244*7f2fe78bSCy Schubert     return make_data(NULL, 0);
2245*7f2fe78bSCy Schubert }
2246*7f2fe78bSCy Schubert 
2247*7f2fe78bSCy Schubert static inline krb5_data
string2data(char * str)2248*7f2fe78bSCy Schubert string2data(char *str)
2249*7f2fe78bSCy Schubert {
2250*7f2fe78bSCy Schubert     return make_data(str, strlen(str));
2251*7f2fe78bSCy Schubert }
2252*7f2fe78bSCy Schubert 
2253*7f2fe78bSCy Schubert static inline krb5_error_code
alloc_data(krb5_data * data,unsigned int len)2254*7f2fe78bSCy Schubert alloc_data(krb5_data *data, unsigned int len)
2255*7f2fe78bSCy Schubert {
2256*7f2fe78bSCy Schubert     /* Allocate at least one byte since zero-byte allocs may return NULL. */
2257*7f2fe78bSCy Schubert     char *ptr = (char *) calloc((len > 0) ? len : 1, 1);
2258*7f2fe78bSCy Schubert 
2259*7f2fe78bSCy Schubert     if (ptr == NULL)
2260*7f2fe78bSCy Schubert         return ENOMEM;
2261*7f2fe78bSCy Schubert     data->magic = KV5M_DATA;
2262*7f2fe78bSCy Schubert     data->data = ptr;
2263*7f2fe78bSCy Schubert     data->length = len;
2264*7f2fe78bSCy Schubert     return 0;
2265*7f2fe78bSCy Schubert }
2266*7f2fe78bSCy Schubert 
2267*7f2fe78bSCy Schubert static inline int
authdata_eq(krb5_authdata a1,krb5_authdata a2)2268*7f2fe78bSCy Schubert authdata_eq(krb5_authdata a1, krb5_authdata a2)
2269*7f2fe78bSCy Schubert {
2270*7f2fe78bSCy Schubert     return (a1.ad_type == a2.ad_type && a1.length == a2.length &&
2271*7f2fe78bSCy Schubert             (a1.length == 0 || !memcmp(a1.contents, a2.contents, a1.length)));
2272*7f2fe78bSCy Schubert }
2273*7f2fe78bSCy Schubert 
2274*7f2fe78bSCy Schubert /* Allocate zeroed memory; set *code to 0 on success or ENOMEM on failure. */
2275*7f2fe78bSCy Schubert static inline void *
k5calloc(size_t nmemb,size_t size,krb5_error_code * code)2276*7f2fe78bSCy Schubert k5calloc(size_t nmemb, size_t size, krb5_error_code *code)
2277*7f2fe78bSCy Schubert {
2278*7f2fe78bSCy Schubert     void *ptr;
2279*7f2fe78bSCy Schubert 
2280*7f2fe78bSCy Schubert     /* Allocate at least one byte since zero-byte allocs may return NULL. */
2281*7f2fe78bSCy Schubert     ptr = calloc(nmemb ? nmemb : 1, size ? size : 1);
2282*7f2fe78bSCy Schubert     *code = (ptr == NULL) ? ENOMEM : 0;
2283*7f2fe78bSCy Schubert     return ptr;
2284*7f2fe78bSCy Schubert }
2285*7f2fe78bSCy Schubert 
2286*7f2fe78bSCy Schubert /* Allocate zeroed memory; set *code to 0 on success or ENOMEM on failure. */
2287*7f2fe78bSCy Schubert static inline void *
k5alloc(size_t size,krb5_error_code * code)2288*7f2fe78bSCy Schubert k5alloc(size_t size, krb5_error_code *code)
2289*7f2fe78bSCy Schubert {
2290*7f2fe78bSCy Schubert     return k5calloc(1, size, code);
2291*7f2fe78bSCy Schubert }
2292*7f2fe78bSCy Schubert 
2293*7f2fe78bSCy Schubert /* Return a copy of the len bytes of memory at in; set *code to 0 or ENOMEM. */
2294*7f2fe78bSCy Schubert static inline void *
k5memdup(const void * in,size_t len,krb5_error_code * code)2295*7f2fe78bSCy Schubert k5memdup(const void *in, size_t len, krb5_error_code *code)
2296*7f2fe78bSCy Schubert {
2297*7f2fe78bSCy Schubert     void *ptr = k5alloc(len, code);
2298*7f2fe78bSCy Schubert 
2299*7f2fe78bSCy Schubert     if (ptr != NULL && len > 0)
2300*7f2fe78bSCy Schubert         memcpy(ptr, in, len);
2301*7f2fe78bSCy Schubert     return ptr;
2302*7f2fe78bSCy Schubert }
2303*7f2fe78bSCy Schubert 
2304*7f2fe78bSCy Schubert /* Like k5memdup, but add a final null byte. */
2305*7f2fe78bSCy Schubert static inline void *
k5memdup0(const void * in,size_t len,krb5_error_code * code)2306*7f2fe78bSCy Schubert k5memdup0(const void *in, size_t len, krb5_error_code *code)
2307*7f2fe78bSCy Schubert {
2308*7f2fe78bSCy Schubert     void *ptr = k5alloc(len + 1, code);
2309*7f2fe78bSCy Schubert 
2310*7f2fe78bSCy Schubert     if (ptr != NULL && len > 0)
2311*7f2fe78bSCy Schubert         memcpy(ptr, in, len);
2312*7f2fe78bSCy Schubert     return ptr;
2313*7f2fe78bSCy Schubert }
2314*7f2fe78bSCy Schubert 
2315*7f2fe78bSCy Schubert /* Convert a krb5_timestamp to a time_t value, treating the negative range of
2316*7f2fe78bSCy Schubert  * krb5_timestamp as times between 2038 and 2106 (if time_t is 64-bit). */
2317*7f2fe78bSCy Schubert static inline time_t
ts2tt(krb5_timestamp timestamp)2318*7f2fe78bSCy Schubert ts2tt(krb5_timestamp timestamp)
2319*7f2fe78bSCy Schubert {
2320*7f2fe78bSCy Schubert     return (time_t)(uint32_t)timestamp;
2321*7f2fe78bSCy Schubert }
2322*7f2fe78bSCy Schubert 
2323*7f2fe78bSCy Schubert /* Return the delta between two timestamps (a - b) as a signed 32-bit value,
2324*7f2fe78bSCy Schubert  * without relying on undefined behavior. */
2325*7f2fe78bSCy Schubert static inline krb5_deltat
ts_delta(krb5_timestamp a,krb5_timestamp b)2326*7f2fe78bSCy Schubert ts_delta(krb5_timestamp a, krb5_timestamp b)
2327*7f2fe78bSCy Schubert {
2328*7f2fe78bSCy Schubert     return (krb5_deltat)((uint32_t)a - (uint32_t)b);
2329*7f2fe78bSCy Schubert }
2330*7f2fe78bSCy Schubert 
2331*7f2fe78bSCy Schubert /* Return (end - start) as an unsigned 32-bit value, or 0 if start > end. */
2332*7f2fe78bSCy Schubert static inline uint32_t
ts_interval(krb5_timestamp start,krb5_timestamp end)2333*7f2fe78bSCy Schubert ts_interval(krb5_timestamp start, krb5_timestamp end)
2334*7f2fe78bSCy Schubert {
2335*7f2fe78bSCy Schubert     if ((uint32_t)start > (uint32_t)end)
2336*7f2fe78bSCy Schubert         return 0;
2337*7f2fe78bSCy Schubert     return (uint32_t)end - (uint32_t)start;
2338*7f2fe78bSCy Schubert }
2339*7f2fe78bSCy Schubert 
2340*7f2fe78bSCy Schubert /* Increment a timestamp by a signed 32-bit interval, without relying on
2341*7f2fe78bSCy Schubert  * undefined behavior. */
2342*7f2fe78bSCy Schubert static inline krb5_timestamp
ts_incr(krb5_timestamp ts,krb5_deltat delta)2343*7f2fe78bSCy Schubert ts_incr(krb5_timestamp ts, krb5_deltat delta)
2344*7f2fe78bSCy Schubert {
2345*7f2fe78bSCy Schubert     return (krb5_timestamp)((uint32_t)ts + (uint32_t)delta);
2346*7f2fe78bSCy Schubert }
2347*7f2fe78bSCy Schubert 
2348*7f2fe78bSCy Schubert /* Return true if a comes after b. */
2349*7f2fe78bSCy Schubert static inline krb5_boolean
ts_after(krb5_timestamp a,krb5_timestamp b)2350*7f2fe78bSCy Schubert ts_after(krb5_timestamp a, krb5_timestamp b)
2351*7f2fe78bSCy Schubert {
2352*7f2fe78bSCy Schubert     return (uint32_t)a > (uint32_t)b;
2353*7f2fe78bSCy Schubert }
2354*7f2fe78bSCy Schubert 
2355*7f2fe78bSCy Schubert /* Return true if a and b are within d seconds. */
2356*7f2fe78bSCy Schubert static inline krb5_boolean
ts_within(krb5_timestamp a,krb5_timestamp b,krb5_deltat d)2357*7f2fe78bSCy Schubert ts_within(krb5_timestamp a, krb5_timestamp b, krb5_deltat d)
2358*7f2fe78bSCy Schubert {
2359*7f2fe78bSCy Schubert     return !ts_after(a, ts_incr(b, d)) && !ts_after(b, ts_incr(a, d));
2360*7f2fe78bSCy Schubert }
2361*7f2fe78bSCy Schubert 
2362*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
2363*7f2fe78bSCy Schubert krb5_get_credentials_for_user(krb5_context context, krb5_flags options,
2364*7f2fe78bSCy Schubert                               krb5_ccache ccache,
2365*7f2fe78bSCy Schubert                               krb5_creds *in_creds,
2366*7f2fe78bSCy Schubert                               krb5_data *cert,
2367*7f2fe78bSCy Schubert                               krb5_creds **out_creds);
2368*7f2fe78bSCy Schubert 
2369*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
2370*7f2fe78bSCy Schubert krb5_get_credentials_for_proxy(krb5_context context,
2371*7f2fe78bSCy Schubert                                krb5_flags options,
2372*7f2fe78bSCy Schubert                                krb5_ccache ccache,
2373*7f2fe78bSCy Schubert                                krb5_creds *in_creds,
2374*7f2fe78bSCy Schubert                                krb5_ticket *evidence_tkt,
2375*7f2fe78bSCy Schubert                                krb5_creds **out_creds);
2376*7f2fe78bSCy Schubert 
2377*7f2fe78bSCy Schubert krb5_error_code KRB5_CALLCONV
2378*7f2fe78bSCy Schubert krb5int_get_authdata_containee_types(krb5_context context,
2379*7f2fe78bSCy Schubert                                      const krb5_authdata *container,
2380*7f2fe78bSCy Schubert                                      unsigned int *nad_types,
2381*7f2fe78bSCy Schubert                                      krb5_authdatatype **ad_types);
2382*7f2fe78bSCy Schubert 
2383*7f2fe78bSCy Schubert krb5_error_code krb5int_parse_enctype_list(krb5_context context,
2384*7f2fe78bSCy Schubert                                            const char *profkey, char *profstr,
2385*7f2fe78bSCy Schubert                                            krb5_enctype *default_list,
2386*7f2fe78bSCy Schubert                                            krb5_enctype **result);
2387*7f2fe78bSCy Schubert 
2388*7f2fe78bSCy Schubert krb5_boolean k5_etypes_contains(const krb5_enctype *list, krb5_enctype etype);
2389*7f2fe78bSCy Schubert 
2390*7f2fe78bSCy Schubert void k5_change_error_message_code(krb5_context ctx, krb5_error_code oldcode,
2391*7f2fe78bSCy Schubert                                   krb5_error_code newcode);
2392*7f2fe78bSCy Schubert 
2393*7f2fe78bSCy Schubert /* Define shorter internal names for setting error messages. */
2394*7f2fe78bSCy Schubert #define k5_setmsg krb5_set_error_message
2395*7f2fe78bSCy Schubert #define k5_prependmsg krb5_prepend_error_message
2396*7f2fe78bSCy Schubert #define k5_wrapmsg krb5_wrap_error_message
2397*7f2fe78bSCy Schubert 
2398*7f2fe78bSCy Schubert /*
2399*7f2fe78bSCy Schubert  * Like krb5_principal_compare(), but with canonicalization of sname if
2400*7f2fe78bSCy Schubert  * fallback is enabled.  This function should be avoided if multiple matches
2401*7f2fe78bSCy Schubert  * are required, since repeated canonicalization is inefficient.
2402*7f2fe78bSCy Schubert  */
2403*7f2fe78bSCy Schubert krb5_boolean
2404*7f2fe78bSCy Schubert k5_sname_compare(krb5_context context, krb5_const_principal sname,
2405*7f2fe78bSCy Schubert                  krb5_const_principal princ);
2406*7f2fe78bSCy Schubert 
2407*7f2fe78bSCy Schubert #endif /* _KRB5_INT_H */
2408