diff options
author | tb <> | 2021-10-24 13:52:13 +0000 |
---|---|---|
committer | tb <> | 2021-10-24 13:52:13 +0000 |
commit | 05ad4b612f5c1f984f5d2f34e62751408dfaea72 (patch) | |
tree | d3e109722017654f5021af5a8ce3e73cc7b12eb7 /src | |
parent | 9dd051ee2075fc69f1304f5e92f999bbe33635b2 (diff) | |
download | openbsd-05ad4b612f5c1f984f5d2f34e62751408dfaea72.tar.gz openbsd-05ad4b612f5c1f984f5d2f34e62751408dfaea72.tar.bz2 openbsd-05ad4b612f5c1f984f5d2f34e62751408dfaea72.zip |
Prepare to provide a number of X509_STORE_CTX_* setters.
ok beck jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.c | 39 | ||||
-rw-r--r-- | src/lib/libcrypto/x509/x509_vfy.h | 15 |
2 files changed, 52 insertions, 2 deletions
diff --git a/src/lib/libcrypto/x509/x509_vfy.c b/src/lib/libcrypto/x509/x509_vfy.c index 17dfb52c62..c54444c91b 100644 --- a/src/lib/libcrypto/x509/x509_vfy.c +++ b/src/lib/libcrypto/x509/x509_vfy.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_vfy.c,v 1.90 2021/10/24 13:48:15 tb Exp $ */ | 1 | /* $OpenBSD: x509_vfy.c,v 1.91 2021/10/24 13:52:13 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -2123,12 +2123,24 @@ X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx) | |||
2123 | return ctx->error_depth; | 2123 | return ctx->error_depth; |
2124 | } | 2124 | } |
2125 | 2125 | ||
2126 | void | ||
2127 | X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth) | ||
2128 | { | ||
2129 | ctx->error_depth = depth; | ||
2130 | } | ||
2131 | |||
2126 | X509 * | 2132 | X509 * |
2127 | X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx) | 2133 | X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx) |
2128 | { | 2134 | { |
2129 | return ctx->current_cert; | 2135 | return ctx->current_cert; |
2130 | } | 2136 | } |
2131 | 2137 | ||
2138 | void | ||
2139 | X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x) | ||
2140 | { | ||
2141 | ctx->current_cert = x; | ||
2142 | } | ||
2143 | |||
2132 | STACK_OF(X509) * | 2144 | STACK_OF(X509) * |
2133 | X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx) | 2145 | X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx) |
2134 | { | 2146 | { |
@@ -2468,6 +2480,12 @@ X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, time_t t) | |||
2468 | X509_VERIFY_PARAM_set_time(ctx->param, t); | 2480 | X509_VERIFY_PARAM_set_time(ctx->param, t); |
2469 | } | 2481 | } |
2470 | 2482 | ||
2483 | int | ||
2484 | (*X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx))(int, X509_STORE_CTX *) | ||
2485 | { | ||
2486 | return ctx->verify_cb; | ||
2487 | } | ||
2488 | |||
2471 | void | 2489 | void |
2472 | X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, | 2490 | X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, |
2473 | int (*verify_cb)(int, X509_STORE_CTX *)) | 2491 | int (*verify_cb)(int, X509_STORE_CTX *)) |
@@ -2475,6 +2493,18 @@ X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, | |||
2475 | ctx->verify_cb = verify_cb; | 2493 | ctx->verify_cb = verify_cb; |
2476 | } | 2494 | } |
2477 | 2495 | ||
2496 | int | ||
2497 | (*X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx))(X509_STORE_CTX *) | ||
2498 | { | ||
2499 | return ctx->verify; | ||
2500 | } | ||
2501 | |||
2502 | void | ||
2503 | X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, int (*verify)(X509_STORE_CTX *)) | ||
2504 | { | ||
2505 | ctx->verify = verify; | ||
2506 | } | ||
2507 | |||
2478 | X509 * | 2508 | X509 * |
2479 | X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx) | 2509 | X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx) |
2480 | { | 2510 | { |
@@ -2493,6 +2523,13 @@ X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk) | |||
2493 | ctx->untrusted = sk; | 2523 | ctx->untrusted = sk; |
2494 | } | 2524 | } |
2495 | 2525 | ||
2526 | void | ||
2527 | X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *sk) | ||
2528 | { | ||
2529 | sk_X509_pop_free(ctx->chain, X509_free); | ||
2530 | ctx->chain = sk; | ||
2531 | } | ||
2532 | |||
2496 | X509_POLICY_TREE * | 2533 | X509_POLICY_TREE * |
2497 | X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx) | 2534 | X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx) |
2498 | { | 2535 | { |
diff --git a/src/lib/libcrypto/x509/x509_vfy.h b/src/lib/libcrypto/x509/x509_vfy.h index c6adb41b3d..abb1389db6 100644 --- a/src/lib/libcrypto/x509/x509_vfy.h +++ b/src/lib/libcrypto/x509/x509_vfy.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509_vfy.h,v 1.36 2021/10/24 13:48:15 tb Exp $ */ | 1 | /* $OpenBSD: x509_vfy.h,v 1.37 2021/10/24 13:52:13 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -518,7 +518,13 @@ void * X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx); | |||
518 | int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); | 518 | int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); |
519 | void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); | 519 | void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); |
520 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); | 520 | int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); |
521 | #if defined(LIBRESSL_NEW_API) | ||
522 | void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth); | ||
523 | #endif | ||
521 | X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); | 524 | X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); |
525 | #if defined(LIBRESSL_NEW_API) | ||
526 | void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x); | ||
527 | #endif | ||
522 | X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); | 528 | X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); |
523 | X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); | 529 | X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); |
524 | X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); | 530 | X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); |
@@ -534,6 +540,13 @@ int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose, | |||
534 | void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); | 540 | void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); |
535 | void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, | 541 | void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, |
536 | time_t t); | 542 | time_t t); |
543 | #if defined(LIBRESSL_NEW_API) | ||
544 | void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *sk); | ||
545 | int (*X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx))(X509_STORE_CTX *); | ||
546 | void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, | ||
547 | int (*verify)(X509_STORE_CTX *)); | ||
548 | int (*X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx))(int, X509_STORE_CTX *); | ||
549 | #endif | ||
537 | void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, | 550 | void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, |
538 | int (*verify_cb)(int, X509_STORE_CTX *)); | 551 | int (*verify_cb)(int, X509_STORE_CTX *)); |
539 | 552 | ||