xref: /freebsd/crypto/krb5/src/plugins/preauth/pkinit/pkinit.h (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert /*
2*7f2fe78bSCy Schubert  * COPYRIGHT (C) 2006,2007
3*7f2fe78bSCy Schubert  * THE REGENTS OF THE UNIVERSITY OF MICHIGAN
4*7f2fe78bSCy Schubert  * ALL RIGHTS RESERVED
5*7f2fe78bSCy Schubert  *
6*7f2fe78bSCy Schubert  * Permission is granted to use, copy, create derivative works
7*7f2fe78bSCy Schubert  * and redistribute this software and such derivative works
8*7f2fe78bSCy Schubert  * for any purpose, so long as the name of The University of
9*7f2fe78bSCy Schubert  * Michigan is not used in any advertising or publicity
10*7f2fe78bSCy Schubert  * pertaining to the use of distribution of this software
11*7f2fe78bSCy Schubert  * without specific, written prior authorization.  If the
12*7f2fe78bSCy Schubert  * above copyright notice or any other identification of the
13*7f2fe78bSCy Schubert  * University of Michigan is included in any copy of any
14*7f2fe78bSCy Schubert  * portion of this software, then the disclaimer below must
15*7f2fe78bSCy Schubert  * also be included.
16*7f2fe78bSCy Schubert  *
17*7f2fe78bSCy Schubert  * THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION
18*7f2fe78bSCy Schubert  * FROM THE UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY
19*7f2fe78bSCy Schubert  * PURPOSE, AND WITHOUT WARRANTY BY THE UNIVERSITY OF
20*7f2fe78bSCy Schubert  * MICHIGAN OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
21*7f2fe78bSCy Schubert  * WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
22*7f2fe78bSCy Schubert  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
23*7f2fe78bSCy Schubert  * REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE
24*7f2fe78bSCy Schubert  * FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR
25*7f2fe78bSCy Schubert  * CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING
26*7f2fe78bSCy Schubert  * OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN
27*7f2fe78bSCy Schubert  * IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF
28*7f2fe78bSCy Schubert  * SUCH DAMAGES.
29*7f2fe78bSCy Schubert  */
30*7f2fe78bSCy Schubert 
31*7f2fe78bSCy Schubert #ifndef _PKINIT_H
32*7f2fe78bSCy Schubert #define _PKINIT_H
33*7f2fe78bSCy Schubert 
34*7f2fe78bSCy Schubert #include <k5-platform.h>
35*7f2fe78bSCy Schubert #include <krb5/krb5.h>
36*7f2fe78bSCy Schubert #include <krb5/preauth_plugin.h>
37*7f2fe78bSCy Schubert #include <k5-int-pkinit.h>
38*7f2fe78bSCy Schubert #include <profile.h>
39*7f2fe78bSCy Schubert #include "pkinit_accessor.h"
40*7f2fe78bSCy Schubert #include "pkinit_trace.h"
41*7f2fe78bSCy Schubert 
42*7f2fe78bSCy Schubert #ifndef WITHOUT_PKCS11
43*7f2fe78bSCy Schubert #include "pkcs11.h"
44*7f2fe78bSCy Schubert 
45*7f2fe78bSCy Schubert #define PK_SIGLEN_GUESS 1000
46*7f2fe78bSCy Schubert #define PK_NOSLOT 999999
47*7f2fe78bSCy Schubert #endif
48*7f2fe78bSCy Schubert 
49*7f2fe78bSCy Schubert #define DH_PROTOCOL     1
50*7f2fe78bSCy Schubert #define RSA_PROTOCOL    2
51*7f2fe78bSCy Schubert 
52*7f2fe78bSCy Schubert #define TD_TRUSTED_CERTIFIERS 104
53*7f2fe78bSCy Schubert #define TD_INVALID_CERTIFICATES 105
54*7f2fe78bSCy Schubert #define TD_DH_PARAMETERS 109
55*7f2fe78bSCy Schubert 
56*7f2fe78bSCy Schubert #define PKINIT_CTX_MAGIC	0x05551212
57*7f2fe78bSCy Schubert #define PKINIT_REQ_CTX_MAGIC	0xdeadbeef
58*7f2fe78bSCy Schubert #define PKINIT_DEFERRED_ID_MAGIC    0x3ca20d21
59*7f2fe78bSCy Schubert 
60*7f2fe78bSCy Schubert #define PKINIT_DEFAULT_DH_MIN_BITS  2048
61*7f2fe78bSCy Schubert #define PKINIT_DH_MIN_CONFIG_BITS   1024
62*7f2fe78bSCy Schubert 
63*7f2fe78bSCy Schubert #define KRB5_CONF_KDCDEFAULTS                   "kdcdefaults"
64*7f2fe78bSCy Schubert #define KRB5_CONF_LIBDEFAULTS                   "libdefaults"
65*7f2fe78bSCy Schubert #define KRB5_CONF_REALMS                        "realms"
66*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_ALLOW_UPN              "pkinit_allow_upn"
67*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_ANCHORS                "pkinit_anchors"
68*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_INDICATOR              "pkinit_indicator"
69*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_CERT_MATCH             "pkinit_cert_match"
70*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_DH_MIN_BITS            "pkinit_dh_min_bits"
71*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_EKU_CHECKING           "pkinit_eku_checking"
72*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_IDENTITIES             "pkinit_identities"
73*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_IDENTITY               "pkinit_identity"
74*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_KDC_HOSTNAME           "pkinit_kdc_hostname"
75*7f2fe78bSCy Schubert /* pkinit_kdc_ocsp has been removed */
76*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_KDC_OCSP               "pkinit_kdc_ocsp"
77*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_POOL                   "pkinit_pool"
78*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_REQUIRE_CRL_CHECKING   "pkinit_require_crl_checking"
79*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_REQUIRE_FRESHNESS      "pkinit_require_freshness"
80*7f2fe78bSCy Schubert #define KRB5_CONF_PKINIT_REVOKE                 "pkinit_revoke"
81*7f2fe78bSCy Schubert 
82*7f2fe78bSCy Schubert /* Make pkiDebug(fmt,...) print, or not.  */
83*7f2fe78bSCy Schubert #ifdef DEBUG
84*7f2fe78bSCy Schubert #define pkiDebug	printf
85*7f2fe78bSCy Schubert #else
86*7f2fe78bSCy Schubert /* Still evaluates for side effects.  */
pkiDebug(const char * fmt,...)87*7f2fe78bSCy Schubert static inline void pkiDebug (const char *fmt, ...) { }
88*7f2fe78bSCy Schubert /* This is better if the compiler doesn't inline variadic functions
89*7f2fe78bSCy Schubert    well, but gcc will warn about "left-hand operand of comma
90*7f2fe78bSCy Schubert    expression has no effect".  Still evaluates for side effects.  */
91*7f2fe78bSCy Schubert /* #define pkiDebug	(void) */
92*7f2fe78bSCy Schubert #endif
93*7f2fe78bSCy Schubert 
94*7f2fe78bSCy Schubert /* Solaris compiler doesn't grok __FUNCTION__
95*7f2fe78bSCy Schubert  * hack for now.  Fix all the uses eventually. */
96*7f2fe78bSCy Schubert #define __FUNCTION__ __func__
97*7f2fe78bSCy Schubert 
98*7f2fe78bSCy Schubert /* Macros to deal with converting between various data types... */
99*7f2fe78bSCy Schubert #define PADATA_TO_KRB5DATA(pad, k5d) \
100*7f2fe78bSCy Schubert     (k5d)->length = (pad)->length; (k5d)->data = (char *)(pad)->contents;
101*7f2fe78bSCy Schubert #define OCTETDATA_TO_KRB5DATA(octd, k5d) \
102*7f2fe78bSCy Schubert     (k5d)->length = (octd)->length; (k5d)->data = (char *)(octd)->data;
103*7f2fe78bSCy Schubert 
104*7f2fe78bSCy Schubert extern const krb5_data dh_oid;
105*7f2fe78bSCy Schubert 
106*7f2fe78bSCy Schubert /*
107*7f2fe78bSCy Schubert  * notes about crypto contexts:
108*7f2fe78bSCy Schubert  *
109*7f2fe78bSCy Schubert  * the basic idea is that there are crypto contexts that live at
110*7f2fe78bSCy Schubert  * both the plugin level and request level. the identity context (that
111*7f2fe78bSCy Schubert  * keeps info about your own certs and such) is separate because
112*7f2fe78bSCy Schubert  * it is needed at different levels for the kdc and and the client.
113*7f2fe78bSCy Schubert  * (the kdc's identity is at the plugin level, the client's identity
114*7f2fe78bSCy Schubert  * information could change per-request.)
115*7f2fe78bSCy Schubert  * the identity context is meant to have the entity's cert,
116*7f2fe78bSCy Schubert  * a list of trusted and intermediate cas, a list of crls, and any
117*7f2fe78bSCy Schubert  * pkcs11 information.  the req context is meant to have the
118*7f2fe78bSCy Schubert  * received certificate and the DH related information. the plugin
119*7f2fe78bSCy Schubert  * context is meant to have global crypto information, i.e., OIDs
120*7f2fe78bSCy Schubert  * and constant DH parameter information.
121*7f2fe78bSCy Schubert  */
122*7f2fe78bSCy Schubert 
123*7f2fe78bSCy Schubert /*
124*7f2fe78bSCy Schubert  * plugin crypto context should keep plugin common information,
125*7f2fe78bSCy Schubert  * eg., OIDs, known DHparams
126*7f2fe78bSCy Schubert  */
127*7f2fe78bSCy Schubert typedef struct _pkinit_plg_crypto_context *pkinit_plg_crypto_context;
128*7f2fe78bSCy Schubert 
129*7f2fe78bSCy Schubert /*
130*7f2fe78bSCy Schubert  * request crypto context should keep reqyest common information,
131*7f2fe78bSCy Schubert  * eg., received credentials, DH parameters of this request
132*7f2fe78bSCy Schubert  */
133*7f2fe78bSCy Schubert typedef struct _pkinit_req_crypto_context *pkinit_req_crypto_context;
134*7f2fe78bSCy Schubert 
135*7f2fe78bSCy Schubert /*
136*7f2fe78bSCy Schubert  * identity context should keep information about credentials
137*7f2fe78bSCy Schubert  * for the request, eg., my credentials, trusted ca certs,
138*7f2fe78bSCy Schubert  * intermediate ca certs, crls, pkcs11 info
139*7f2fe78bSCy Schubert  */
140*7f2fe78bSCy Schubert typedef struct _pkinit_identity_crypto_context *pkinit_identity_crypto_context;
141*7f2fe78bSCy Schubert 
142*7f2fe78bSCy Schubert /*
143*7f2fe78bSCy Schubert  * this structure keeps information about the config options
144*7f2fe78bSCy Schubert  */
145*7f2fe78bSCy Schubert typedef struct _pkinit_plg_opts {
146*7f2fe78bSCy Schubert     int require_eku;	    /* require EKU checking (default is true) */
147*7f2fe78bSCy Schubert     int accept_secondary_eku;/* accept secondary EKU (default is false) */
148*7f2fe78bSCy Schubert     int allow_upn;	    /* allow UPN-SAN instead of pkinit-SAN */
149*7f2fe78bSCy Schubert     int dh_or_rsa;	    /* selects DH or RSA based pkinit */
150*7f2fe78bSCy Schubert     int require_crl_checking; /* require CRL for a CA (default is false) */
151*7f2fe78bSCy Schubert     int require_freshness;  /* require freshness token (default is false) */
152*7f2fe78bSCy Schubert     int disable_freshness;  /* disable freshness token on client for testing */
153*7f2fe78bSCy Schubert     int dh_min_bits;	    /* minimum DH modulus size allowed */
154*7f2fe78bSCy Schubert } pkinit_plg_opts;
155*7f2fe78bSCy Schubert 
156*7f2fe78bSCy Schubert /*
157*7f2fe78bSCy Schubert  * this structure keeps options used for a given request
158*7f2fe78bSCy Schubert  */
159*7f2fe78bSCy Schubert typedef struct _pkinit_req_opts {
160*7f2fe78bSCy Schubert     int require_eku;
161*7f2fe78bSCy Schubert     int accept_secondary_eku;
162*7f2fe78bSCy Schubert     int allow_upn;
163*7f2fe78bSCy Schubert     int dh_or_rsa;
164*7f2fe78bSCy Schubert     int require_crl_checking;
165*7f2fe78bSCy Schubert     int dh_size;	    /* initial request DH modulus size (default=1024) */
166*7f2fe78bSCy Schubert     int require_hostname_match;
167*7f2fe78bSCy Schubert     int disable_freshness;
168*7f2fe78bSCy Schubert } pkinit_req_opts;
169*7f2fe78bSCy Schubert 
170*7f2fe78bSCy Schubert /*
171*7f2fe78bSCy Schubert  * information about identity from config file or command line
172*7f2fe78bSCy Schubert  */
173*7f2fe78bSCy Schubert 
174*7f2fe78bSCy Schubert typedef struct _pkinit_identity_opts {
175*7f2fe78bSCy Schubert     char *identity;
176*7f2fe78bSCy Schubert     char **identity_alt;
177*7f2fe78bSCy Schubert     char **anchors;
178*7f2fe78bSCy Schubert     char **intermediates;
179*7f2fe78bSCy Schubert     char **crls;
180*7f2fe78bSCy Schubert     int  idtype;
181*7f2fe78bSCy Schubert     char *cert_filename;
182*7f2fe78bSCy Schubert     char *key_filename;
183*7f2fe78bSCy Schubert #ifndef WITHOUT_PKCS11
184*7f2fe78bSCy Schubert     char *p11_module_name;
185*7f2fe78bSCy Schubert     CK_SLOT_ID slotid;
186*7f2fe78bSCy Schubert     char *token_label;
187*7f2fe78bSCy Schubert     char *cert_id_string;
188*7f2fe78bSCy Schubert     char *cert_label;
189*7f2fe78bSCy Schubert #endif
190*7f2fe78bSCy Schubert } pkinit_identity_opts;
191*7f2fe78bSCy Schubert 
192*7f2fe78bSCy Schubert 
193*7f2fe78bSCy Schubert /*
194*7f2fe78bSCy Schubert  * Client's plugin context
195*7f2fe78bSCy Schubert  */
196*7f2fe78bSCy Schubert struct _pkinit_context {
197*7f2fe78bSCy Schubert     int magic;
198*7f2fe78bSCy Schubert     pkinit_plg_crypto_context cryptoctx;
199*7f2fe78bSCy Schubert     pkinit_plg_opts *opts;
200*7f2fe78bSCy Schubert     pkinit_identity_opts *idopts;
201*7f2fe78bSCy Schubert };
202*7f2fe78bSCy Schubert typedef struct _pkinit_context *pkinit_context;
203*7f2fe78bSCy Schubert 
204*7f2fe78bSCy Schubert /*
205*7f2fe78bSCy Schubert  * Client's per-request context
206*7f2fe78bSCy Schubert  */
207*7f2fe78bSCy Schubert struct _pkinit_req_context {
208*7f2fe78bSCy Schubert     unsigned int magic;
209*7f2fe78bSCy Schubert     pkinit_req_crypto_context cryptoctx;
210*7f2fe78bSCy Schubert     pkinit_req_opts *opts;
211*7f2fe78bSCy Schubert     pkinit_identity_crypto_context idctx;
212*7f2fe78bSCy Schubert     pkinit_identity_opts *idopts;
213*7f2fe78bSCy Schubert     int do_identity_matching;
214*7f2fe78bSCy Schubert     krb5_preauthtype pa_type;
215*7f2fe78bSCy Schubert     int rfc6112_kdc;
216*7f2fe78bSCy Schubert     int identity_initialized;
217*7f2fe78bSCy Schubert     int identity_prompted;
218*7f2fe78bSCy Schubert     krb5_error_code identity_prompt_retval;
219*7f2fe78bSCy Schubert     krb5_data *freshness_token;
220*7f2fe78bSCy Schubert };
221*7f2fe78bSCy Schubert typedef struct _pkinit_req_context *pkinit_req_context;
222*7f2fe78bSCy Schubert 
223*7f2fe78bSCy Schubert /*
224*7f2fe78bSCy Schubert  * KDC's (per-realm) plugin context
225*7f2fe78bSCy Schubert  */
226*7f2fe78bSCy Schubert struct _pkinit_kdc_context {
227*7f2fe78bSCy Schubert     int magic;
228*7f2fe78bSCy Schubert     pkinit_plg_crypto_context cryptoctx;
229*7f2fe78bSCy Schubert     pkinit_plg_opts *opts;
230*7f2fe78bSCy Schubert     pkinit_identity_crypto_context idctx;
231*7f2fe78bSCy Schubert     pkinit_identity_opts *idopts;
232*7f2fe78bSCy Schubert     char *realmname;
233*7f2fe78bSCy Schubert     unsigned int realmname_len;
234*7f2fe78bSCy Schubert     char **auth_indicators;
235*7f2fe78bSCy Schubert };
236*7f2fe78bSCy Schubert typedef struct _pkinit_kdc_context *pkinit_kdc_context;
237*7f2fe78bSCy Schubert 
238*7f2fe78bSCy Schubert /*
239*7f2fe78bSCy Schubert  * KDC's per-request context
240*7f2fe78bSCy Schubert  */
241*7f2fe78bSCy Schubert struct _pkinit_kdc_req_context {
242*7f2fe78bSCy Schubert     int magic;
243*7f2fe78bSCy Schubert     pkinit_req_crypto_context cryptoctx;
244*7f2fe78bSCy Schubert     krb5_auth_pack *rcv_auth_pack;
245*7f2fe78bSCy Schubert     krb5_preauthtype pa_type;
246*7f2fe78bSCy Schubert };
247*7f2fe78bSCy Schubert typedef struct _pkinit_kdc_req_context *pkinit_kdc_req_context;
248*7f2fe78bSCy Schubert 
249*7f2fe78bSCy Schubert /*
250*7f2fe78bSCy Schubert  * Functions in pkinit_lib.c
251*7f2fe78bSCy Schubert  */
252*7f2fe78bSCy Schubert 
253*7f2fe78bSCy Schubert krb5_error_code pkinit_init_req_opts(pkinit_req_opts **);
254*7f2fe78bSCy Schubert void pkinit_fini_req_opts(pkinit_req_opts *);
255*7f2fe78bSCy Schubert 
256*7f2fe78bSCy Schubert krb5_error_code pkinit_init_plg_opts(pkinit_plg_opts **);
257*7f2fe78bSCy Schubert void pkinit_fini_plg_opts(pkinit_plg_opts *);
258*7f2fe78bSCy Schubert 
259*7f2fe78bSCy Schubert krb5_error_code pkinit_init_identity_opts(pkinit_identity_opts **idopts);
260*7f2fe78bSCy Schubert void pkinit_fini_identity_opts(pkinit_identity_opts *idopts);
261*7f2fe78bSCy Schubert krb5_error_code pkinit_dup_identity_opts(pkinit_identity_opts *src_opts,
262*7f2fe78bSCy Schubert 					 pkinit_identity_opts **dest_opts);
263*7f2fe78bSCy Schubert 
264*7f2fe78bSCy Schubert /*
265*7f2fe78bSCy Schubert  * Functions in pkinit_identity.c
266*7f2fe78bSCy Schubert  */
267*7f2fe78bSCy Schubert char * idtype2string(int idtype);
268*7f2fe78bSCy Schubert char * catype2string(int catype);
269*7f2fe78bSCy Schubert 
270*7f2fe78bSCy Schubert krb5_error_code pkinit_identity_initialize
271*7f2fe78bSCy Schubert 	(krb5_context context,				/* IN */
272*7f2fe78bSCy Schubert 	 pkinit_plg_crypto_context plg_cryptoctx,	/* IN */
273*7f2fe78bSCy Schubert 	 pkinit_req_crypto_context req_cryptoctx,	/* IN */
274*7f2fe78bSCy Schubert 	 pkinit_identity_opts *idopts,			/* IN */
275*7f2fe78bSCy Schubert 	 pkinit_identity_crypto_context id_cryptoctx,	/* IN/OUT */
276*7f2fe78bSCy Schubert 	 krb5_clpreauth_callbacks cb,			/* IN/OUT */
277*7f2fe78bSCy Schubert 	 krb5_clpreauth_rock rock,			/* IN/OUT */
278*7f2fe78bSCy Schubert 	 krb5_principal princ);				/* IN (optional) */
279*7f2fe78bSCy Schubert 
280*7f2fe78bSCy Schubert krb5_error_code pkinit_identity_prompt
281*7f2fe78bSCy Schubert 	(krb5_context context,				/* IN */
282*7f2fe78bSCy Schubert 	 pkinit_plg_crypto_context plg_cryptoctx,	/* IN */
283*7f2fe78bSCy Schubert 	 pkinit_req_crypto_context req_cryptoctx,	/* IN */
284*7f2fe78bSCy Schubert 	 pkinit_identity_opts *idopts,			/* IN */
285*7f2fe78bSCy Schubert 	 pkinit_identity_crypto_context id_cryptoctx,	/* IN/OUT */
286*7f2fe78bSCy Schubert 	 krb5_clpreauth_callbacks cb,			/* IN/OUT */
287*7f2fe78bSCy Schubert 	 krb5_clpreauth_rock rock,			/* IN/OUT */
288*7f2fe78bSCy Schubert 	 int do_matching,				/* IN */
289*7f2fe78bSCy Schubert 	 krb5_principal princ);				/* IN (optional) */
290*7f2fe78bSCy Schubert 
291*7f2fe78bSCy Schubert krb5_error_code pkinit_cert_matching
292*7f2fe78bSCy Schubert 	(krb5_context context,
293*7f2fe78bSCy Schubert 	pkinit_plg_crypto_context plg_cryptoctx,
294*7f2fe78bSCy Schubert 	pkinit_req_crypto_context req_cryptoctx,
295*7f2fe78bSCy Schubert 	pkinit_identity_crypto_context id_cryptoctx,
296*7f2fe78bSCy Schubert 	krb5_principal princ);
297*7f2fe78bSCy Schubert 
298*7f2fe78bSCy Schubert krb5_error_code pkinit_client_cert_match
299*7f2fe78bSCy Schubert 	(krb5_context context,
300*7f2fe78bSCy Schubert 	pkinit_plg_crypto_context plgctx,
301*7f2fe78bSCy Schubert 	pkinit_req_crypto_context reqctx,
302*7f2fe78bSCy Schubert 	const char *match_rule,
303*7f2fe78bSCy Schubert 	krb5_boolean *matched);
304*7f2fe78bSCy Schubert 
305*7f2fe78bSCy Schubert /*
306*7f2fe78bSCy Schubert  * Client's list of identities for which it needs PINs or passwords
307*7f2fe78bSCy Schubert  */
308*7f2fe78bSCy Schubert struct _pkinit_deferred_id {
309*7f2fe78bSCy Schubert     int magic;
310*7f2fe78bSCy Schubert     char *identity;
311*7f2fe78bSCy Schubert     unsigned long ck_flags;
312*7f2fe78bSCy Schubert     char *password;
313*7f2fe78bSCy Schubert };
314*7f2fe78bSCy Schubert typedef struct _pkinit_deferred_id *pkinit_deferred_id;
315*7f2fe78bSCy Schubert 
316*7f2fe78bSCy Schubert krb5_error_code pkinit_set_deferred_id
317*7f2fe78bSCy Schubert 	(pkinit_deferred_id **identities, const char *identity,
318*7f2fe78bSCy Schubert 	 unsigned long ck_flags, const char *password);
319*7f2fe78bSCy Schubert const char * pkinit_find_deferred_id
320*7f2fe78bSCy Schubert 	(pkinit_deferred_id *identities, const char *identity);
321*7f2fe78bSCy Schubert unsigned long pkinit_get_deferred_id_flags
322*7f2fe78bSCy Schubert 	(pkinit_deferred_id *identities, const char *identity);
323*7f2fe78bSCy Schubert void pkinit_free_deferred_ids(pkinit_deferred_id *identities);
324*7f2fe78bSCy Schubert 
325*7f2fe78bSCy Schubert /*
326*7f2fe78bSCy Schubert  * initialization and free functions
327*7f2fe78bSCy Schubert  */
328*7f2fe78bSCy Schubert void init_krb5_pa_pk_as_req(krb5_pa_pk_as_req **in);
329*7f2fe78bSCy Schubert void init_krb5_reply_key_pack(krb5_reply_key_pack **in);
330*7f2fe78bSCy Schubert 
331*7f2fe78bSCy Schubert void init_krb5_pa_pk_as_rep(krb5_pa_pk_as_rep **in);
332*7f2fe78bSCy Schubert 
333*7f2fe78bSCy Schubert void free_krb5_pa_pk_as_req(krb5_pa_pk_as_req **in);
334*7f2fe78bSCy Schubert void free_krb5_reply_key_pack(krb5_reply_key_pack **in);
335*7f2fe78bSCy Schubert void free_krb5_auth_pack(krb5_auth_pack **in);
336*7f2fe78bSCy Schubert void free_krb5_pa_pk_as_rep(krb5_pa_pk_as_rep **in);
337*7f2fe78bSCy Schubert void free_krb5_external_principal_identifier(krb5_external_principal_identifier ***in);
338*7f2fe78bSCy Schubert void free_krb5_algorithm_identifiers(krb5_algorithm_identifier ***in);
339*7f2fe78bSCy Schubert void free_krb5_algorithm_identifier(krb5_algorithm_identifier *in);
340*7f2fe78bSCy Schubert void free_krb5_kdc_dh_key_info(krb5_kdc_dh_key_info **in);
341*7f2fe78bSCy Schubert krb5_error_code pkinit_copy_krb5_data(krb5_data *dst, const krb5_data *src);
342*7f2fe78bSCy Schubert 
343*7f2fe78bSCy Schubert 
344*7f2fe78bSCy Schubert /*
345*7f2fe78bSCy Schubert  * Functions in pkinit_profile.c
346*7f2fe78bSCy Schubert  */
347*7f2fe78bSCy Schubert krb5_error_code pkinit_kdcdefault_strings
348*7f2fe78bSCy Schubert 	(krb5_context context, const char *realmname, const char *option,
349*7f2fe78bSCy Schubert 	 char ***ret_value);
350*7f2fe78bSCy Schubert krb5_error_code pkinit_kdcdefault_string
351*7f2fe78bSCy Schubert 	(krb5_context context, const char *realmname, const char *option,
352*7f2fe78bSCy Schubert 	 char **ret_value);
353*7f2fe78bSCy Schubert krb5_error_code pkinit_kdcdefault_boolean
354*7f2fe78bSCy Schubert 	(krb5_context context, const char *realmname, const char *option,
355*7f2fe78bSCy Schubert 	 int default_value, int *ret_value);
356*7f2fe78bSCy Schubert krb5_error_code pkinit_kdcdefault_integer
357*7f2fe78bSCy Schubert 	(krb5_context context, const char *realmname, const char *option,
358*7f2fe78bSCy Schubert 	 int default_value, int *ret_value);
359*7f2fe78bSCy Schubert 
360*7f2fe78bSCy Schubert 
361*7f2fe78bSCy Schubert krb5_error_code pkinit_libdefault_strings
362*7f2fe78bSCy Schubert 	(krb5_context context, const krb5_data *realm,
363*7f2fe78bSCy Schubert 	 const char *option, char ***ret_value);
364*7f2fe78bSCy Schubert krb5_error_code pkinit_libdefault_string
365*7f2fe78bSCy Schubert 	(krb5_context context, const krb5_data *realm,
366*7f2fe78bSCy Schubert 	 const char *option, char **ret_value);
367*7f2fe78bSCy Schubert krb5_error_code pkinit_libdefault_boolean
368*7f2fe78bSCy Schubert 	(krb5_context context, const krb5_data *realm, const char *option,
369*7f2fe78bSCy Schubert 	 int default_value, int *ret_value);
370*7f2fe78bSCy Schubert krb5_error_code pkinit_libdefault_integer
371*7f2fe78bSCy Schubert 	(krb5_context context, const krb5_data *realm, const char *option,
372*7f2fe78bSCy Schubert 	 int default_value, int *ret_value);
373*7f2fe78bSCy Schubert 
374*7f2fe78bSCy Schubert /*
375*7f2fe78bSCy Schubert  * debugging functions
376*7f2fe78bSCy Schubert  */
377*7f2fe78bSCy Schubert void print_buffer(const unsigned char *, unsigned int);
378*7f2fe78bSCy Schubert void print_buffer_bin(unsigned char *, unsigned int, char *);
379*7f2fe78bSCy Schubert 
380*7f2fe78bSCy Schubert /*
381*7f2fe78bSCy Schubert  * Now get crypto function declarations
382*7f2fe78bSCy Schubert  */
383*7f2fe78bSCy Schubert #include "pkinit_crypto.h"
384*7f2fe78bSCy Schubert 
385*7f2fe78bSCy Schubert #endif	/* _PKINIT_H */
386