diff options
Diffstat (limited to 'src/lib/libcrypto/x509/x509_vfy.h')
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.h | 143 |
1 files changed, 17 insertions, 126 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h index 76c76e1719..7fd1f0bc4d 100644 --- a/src/lib/libcrypto/x509/x509_vfy.h +++ b/src/lib/libcrypto/x509/x509_vfy.h | |||
@@ -65,7 +65,6 @@ | |||
65 | #ifndef HEADER_X509_VFY_H | 65 | #ifndef HEADER_X509_VFY_H |
66 | #define HEADER_X509_VFY_H | 66 | #define HEADER_X509_VFY_H |
67 | 67 | ||
68 | #include <openssl/opensslconf.h> | ||
69 | #ifndef OPENSSL_NO_LHASH | 68 | #ifndef OPENSSL_NO_LHASH |
70 | #include <openssl/lhash.h> | 69 | #include <openssl/lhash.h> |
71 | #endif | 70 | #endif |
@@ -156,25 +155,6 @@ typedef struct x509_lookup_method_st | |||
156 | X509_OBJECT *ret); | 155 | X509_OBJECT *ret); |
157 | } X509_LOOKUP_METHOD; | 156 | } X509_LOOKUP_METHOD; |
158 | 157 | ||
159 | /* This structure hold all parameters associated with a verify operation | ||
160 | * by including an X509_VERIFY_PARAM structure in related structures the | ||
161 | * parameters used can be customized | ||
162 | */ | ||
163 | |||
164 | typedef struct X509_VERIFY_PARAM_st | ||
165 | { | ||
166 | char *name; | ||
167 | time_t check_time; /* Time to use */ | ||
168 | unsigned long inh_flags; /* Inheritance flags */ | ||
169 | unsigned long flags; /* Various verify flags */ | ||
170 | int purpose; /* purpose to check untrusted certificates */ | ||
171 | int trust; /* trust setting to check */ | ||
172 | int depth; /* Verify depth */ | ||
173 | STACK_OF(ASN1_OBJECT) *policies; /* Permissible policies */ | ||
174 | } X509_VERIFY_PARAM; | ||
175 | |||
176 | DECLARE_STACK_OF(X509_VERIFY_PARAM) | ||
177 | |||
178 | /* This is used to hold everything. It is used for all certificate | 158 | /* This is used to hold everything. It is used for all certificate |
179 | * validation. Once we have a certificate chain, the 'verify' | 159 | * validation. Once we have a certificate chain, the 'verify' |
180 | * function is then called to actually check the cert chain. */ | 160 | * function is then called to actually check the cert chain. */ |
@@ -187,8 +167,13 @@ struct x509_store_st | |||
187 | /* These are external lookup methods */ | 167 | /* These are external lookup methods */ |
188 | STACK_OF(X509_LOOKUP) *get_cert_methods; | 168 | STACK_OF(X509_LOOKUP) *get_cert_methods; |
189 | 169 | ||
190 | X509_VERIFY_PARAM *param; | 170 | /* The following fields are not used by X509_STORE but are |
171 | * inherited by X509_STORE_CTX when it is initialised. | ||
172 | */ | ||
191 | 173 | ||
174 | unsigned long flags; /* Various verify flags */ | ||
175 | int purpose; | ||
176 | int trust; | ||
192 | /* Callbacks for various operations */ | 177 | /* Callbacks for various operations */ |
193 | int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ | 178 | int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */ |
194 | int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ | 179 | int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */ |
@@ -202,9 +187,10 @@ struct x509_store_st | |||
202 | 187 | ||
203 | CRYPTO_EX_DATA ex_data; | 188 | CRYPTO_EX_DATA ex_data; |
204 | int references; | 189 | int references; |
190 | int depth; /* how deep to look (still unused -- X509_STORE_CTX's depth is used) */ | ||
205 | } /* X509_STORE */; | 191 | } /* X509_STORE */; |
206 | 192 | ||
207 | int X509_STORE_set_depth(X509_STORE *store, int depth); | 193 | #define X509_STORE_set_depth(ctx,d) ((ctx)->depth=(d)) |
208 | 194 | ||
209 | #define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func)) | 195 | #define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func)) |
210 | #define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func)) | 196 | #define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func)) |
@@ -231,9 +217,10 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
231 | /* The following are set by the caller */ | 217 | /* The following are set by the caller */ |
232 | X509 *cert; /* The cert to check */ | 218 | X509 *cert; /* The cert to check */ |
233 | STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */ | 219 | STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */ |
234 | STACK_OF(X509_CRL) *crls; /* set of CRLs passed in */ | 220 | int purpose; /* purpose to check untrusted certificates */ |
235 | 221 | int trust; /* trust setting to check */ | |
236 | X509_VERIFY_PARAM *param; | 222 | time_t check_time; /* time to make verify at */ |
223 | unsigned long flags; /* Various verify flags */ | ||
237 | void *other_ctx; /* Other info for use with get_issuer() */ | 224 | void *other_ctx; /* Other info for use with get_issuer() */ |
238 | 225 | ||
239 | /* Callbacks for various operations */ | 226 | /* Callbacks for various operations */ |
@@ -245,16 +232,13 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
245 | int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */ | 232 | int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */ |
246 | int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ | 233 | int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */ |
247 | int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ | 234 | int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */ |
248 | int (*check_policy)(X509_STORE_CTX *ctx); | ||
249 | int (*cleanup)(X509_STORE_CTX *ctx); | 235 | int (*cleanup)(X509_STORE_CTX *ctx); |
250 | 236 | ||
251 | /* The following is built up */ | 237 | /* The following is built up */ |
238 | int depth; /* how far to go looking up certs */ | ||
252 | int valid; /* if 0, rebuild chain */ | 239 | int valid; /* if 0, rebuild chain */ |
253 | int last_untrusted; /* index of last untrusted cert */ | 240 | int last_untrusted; /* index of last untrusted cert */ |
254 | STACK_OF(X509) *chain; /* chain of X509s - built up and trusted */ | 241 | STACK_OF(X509) *chain; /* chain of X509s - built up and trusted */ |
255 | X509_POLICY_TREE *tree; /* Valid policy tree */ | ||
256 | |||
257 | int explicit_policy; /* Require explicit policy value */ | ||
258 | 242 | ||
259 | /* When something goes wrong, this is why */ | 243 | /* When something goes wrong, this is why */ |
260 | int error_depth; | 244 | int error_depth; |
@@ -266,7 +250,7 @@ struct x509_store_ctx_st /* X509_STORE_CTX */ | |||
266 | CRYPTO_EX_DATA ex_data; | 250 | CRYPTO_EX_DATA ex_data; |
267 | } /* X509_STORE_CTX */; | 251 | } /* X509_STORE_CTX */; |
268 | 252 | ||
269 | void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); | 253 | #define X509_STORE_CTX_set_depth(ctx,d) ((ctx)->depth=(d)) |
270 | 254 | ||
271 | #define X509_STORE_CTX_set_app_data(ctx,data) \ | 255 | #define X509_STORE_CTX_set_app_data(ctx,data) \ |
272 | X509_STORE_CTX_set_ex_data(ctx,0,data) | 256 | X509_STORE_CTX_set_ex_data(ctx,0,data) |
@@ -327,12 +311,6 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); | |||
327 | #define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 | 311 | #define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39 |
328 | #define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 | 312 | #define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40 |
329 | 313 | ||
330 | #define X509_V_ERR_INVALID_EXTENSION 41 | ||
331 | #define X509_V_ERR_INVALID_POLICY_EXTENSION 42 | ||
332 | #define X509_V_ERR_NO_EXPLICIT_POLICY 43 | ||
333 | |||
334 | #define X509_V_ERR_UNNESTED_RESOURCE 44 | ||
335 | |||
336 | /* The application is not happy */ | 314 | /* The application is not happy */ |
337 | #define X509_V_ERR_APPLICATION_VERIFICATION 50 | 315 | #define X509_V_ERR_APPLICATION_VERIFICATION 50 |
338 | 316 | ||
@@ -352,28 +330,6 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); | |||
352 | #define X509_V_FLAG_X509_STRICT 0x20 | 330 | #define X509_V_FLAG_X509_STRICT 0x20 |
353 | /* Enable proxy certificate validation */ | 331 | /* Enable proxy certificate validation */ |
354 | #define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 | 332 | #define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40 |
355 | /* Enable policy checking */ | ||
356 | #define X509_V_FLAG_POLICY_CHECK 0x80 | ||
357 | /* Policy variable require-explicit-policy */ | ||
358 | #define X509_V_FLAG_EXPLICIT_POLICY 0x100 | ||
359 | /* Policy variable inhibit-any-policy */ | ||
360 | #define X509_V_FLAG_INHIBIT_ANY 0x200 | ||
361 | /* Policy variable inhibit-policy-mapping */ | ||
362 | #define X509_V_FLAG_INHIBIT_MAP 0x400 | ||
363 | /* Notify callback that policy is OK */ | ||
364 | #define X509_V_FLAG_NOTIFY_POLICY 0x800 | ||
365 | |||
366 | #define X509_VP_FLAG_DEFAULT 0x1 | ||
367 | #define X509_VP_FLAG_OVERWRITE 0x2 | ||
368 | #define X509_VP_FLAG_RESET_FLAGS 0x4 | ||
369 | #define X509_VP_FLAG_LOCKED 0x8 | ||
370 | #define X509_VP_FLAG_ONCE 0x10 | ||
371 | |||
372 | /* Internal use: mask of policy related options */ | ||
373 | #define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \ | ||
374 | | X509_V_FLAG_EXPLICIT_POLICY \ | ||
375 | | X509_V_FLAG_INHIBIT_ANY \ | ||
376 | | X509_V_FLAG_INHIBIT_MAP) | ||
377 | 333 | ||
378 | int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, | 334 | int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type, |
379 | X509_NAME *name); | 335 | X509_NAME *name); |
@@ -384,10 +340,9 @@ void X509_OBJECT_free_contents(X509_OBJECT *a); | |||
384 | X509_STORE *X509_STORE_new(void ); | 340 | X509_STORE *X509_STORE_new(void ); |
385 | void X509_STORE_free(X509_STORE *v); | 341 | void X509_STORE_free(X509_STORE *v); |
386 | 342 | ||
387 | int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags); | 343 | void X509_STORE_set_flags(X509_STORE *ctx, long flags); |
388 | int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); | 344 | int X509_STORE_set_purpose(X509_STORE *ctx, int purpose); |
389 | int X509_STORE_set_trust(X509_STORE *ctx, int trust); | 345 | int X509_STORE_set_trust(X509_STORE *ctx, int trust); |
390 | int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm); | ||
391 | 346 | ||
392 | X509_STORE_CTX *X509_STORE_CTX_new(void); | 347 | X509_STORE_CTX *X509_STORE_CTX_new(void); |
393 | 348 | ||
@@ -451,78 +406,14 @@ STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx); | |||
451 | STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); | 406 | STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx); |
452 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x); | 407 | void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x); |
453 | void X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk); | 408 | void X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk); |
454 | void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk); | ||
455 | int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); | 409 | int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose); |
456 | int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); | 410 | int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust); |
457 | int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, | 411 | int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, |
458 | int purpose, int trust); | 412 | int purpose, int trust); |
459 | void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); | 413 | void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, long flags); |
460 | void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, | 414 | void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, long flags, time_t t); |
461 | time_t t); | ||
462 | void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, | 415 | void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, |
463 | int (*verify_cb)(int, X509_STORE_CTX *)); | 416 | int (*verify_cb)(int, X509_STORE_CTX *)); |
464 | |||
465 | X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx); | ||
466 | int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx); | ||
467 | |||
468 | X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx); | ||
469 | void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param); | ||
470 | int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name); | ||
471 | |||
472 | /* X509_VERIFY_PARAM functions */ | ||
473 | |||
474 | X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void); | ||
475 | void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param); | ||
476 | int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to, | ||
477 | const X509_VERIFY_PARAM *from); | ||
478 | int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to, | ||
479 | const X509_VERIFY_PARAM *from); | ||
480 | int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name); | ||
481 | int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags); | ||
482 | int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, | ||
483 | unsigned long flags); | ||
484 | unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param); | ||
485 | int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose); | ||
486 | int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust); | ||
487 | void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth); | ||
488 | void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t); | ||
489 | int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param, | ||
490 | ASN1_OBJECT *policy); | ||
491 | int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, | ||
492 | STACK_OF(ASN1_OBJECT) *policies); | ||
493 | int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); | ||
494 | |||
495 | int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); | ||
496 | const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); | ||
497 | void X509_VERIFY_PARAM_table_cleanup(void); | ||
498 | |||
499 | int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy, | ||
500 | STACK_OF(X509) *certs, | ||
501 | STACK_OF(ASN1_OBJECT) *policy_oids, | ||
502 | unsigned int flags); | ||
503 | |||
504 | void X509_policy_tree_free(X509_POLICY_TREE *tree); | ||
505 | |||
506 | int X509_policy_tree_level_count(const X509_POLICY_TREE *tree); | ||
507 | X509_POLICY_LEVEL * | ||
508 | X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i); | ||
509 | |||
510 | STACK_OF(X509_POLICY_NODE) * | ||
511 | X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree); | ||
512 | |||
513 | STACK_OF(X509_POLICY_NODE) * | ||
514 | X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree); | ||
515 | |||
516 | int X509_policy_level_node_count(X509_POLICY_LEVEL *level); | ||
517 | |||
518 | X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i); | ||
519 | |||
520 | const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node); | ||
521 | |||
522 | STACK_OF(POLICYQUALINFO) * | ||
523 | X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node); | ||
524 | const X509_POLICY_NODE * | ||
525 | X509_policy_node_get0_parent(const X509_POLICY_NODE *node); | ||
526 | 417 | ||
527 | #ifdef __cplusplus | 418 | #ifdef __cplusplus |
528 | } | 419 | } |