summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2021-10-24 13:52:13 +0000
committertb <>2021-10-24 13:52:13 +0000
commit05ad4b612f5c1f984f5d2f34e62751408dfaea72 (patch)
treed3e109722017654f5021af5a8ce3e73cc7b12eb7 /src
parent9dd051ee2075fc69f1304f5e92f999bbe33635b2 (diff)
downloadopenbsd-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.c39
-rw-r--r--src/lib/libcrypto/x509/x509_vfy.h15
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
2126void
2127X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth)
2128{
2129 ctx->error_depth = depth;
2130}
2131
2126X509 * 2132X509 *
2127X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx) 2133X509_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
2138void
2139X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x)
2140{
2141 ctx->current_cert = x;
2142}
2143
2132STACK_OF(X509) * 2144STACK_OF(X509) *
2133X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx) 2145X509_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
2483int
2484(*X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx))(int, X509_STORE_CTX *)
2485{
2486 return ctx->verify_cb;
2487}
2488
2471void 2489void
2472X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, 2490X509_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
2496int
2497(*X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx))(X509_STORE_CTX *)
2498{
2499 return ctx->verify;
2500}
2501
2502void
2503X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, int (*verify)(X509_STORE_CTX *))
2504{
2505 ctx->verify = verify;
2506}
2507
2478X509 * 2508X509 *
2479X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx) 2509X509_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
2526void
2527X509_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
2496X509_POLICY_TREE * 2533X509_POLICY_TREE *
2497X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx) 2534X509_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);
518int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx); 518int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
519void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s); 519void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
520int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx); 520int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
521#if defined(LIBRESSL_NEW_API)
522void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth);
523#endif
521X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx); 524X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
525#if defined(LIBRESSL_NEW_API)
526void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x);
527#endif
522X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx); 528X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx);
523X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx); 529X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx);
524X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx); 530X509_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,
534void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags); 540void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags);
535void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, 541void 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)
544void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
545int (*X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx))(X509_STORE_CTX *);
546void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx,
547 int (*verify)(X509_STORE_CTX *));
548int (*X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx))(int, X509_STORE_CTX *);
549#endif
537void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx, 550void 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