From: tb Date: Thu, 1 Dec 2022 05:16:08 +0000 (+0000) Subject: Getters and setters for the check_issued() callback X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=43f73684321c48681c96238bbcf6fef8146f3481;p=openbsd Getters and setters for the check_issued() callback Open62541 uses X509_STORE_CTX_get_check_issued(), so provide it along with X509_STORE_{get,set}_check_issued(). As you would expect, they all return or take an X509_STORE_CTX_check_issued_fn. The getters aren't const in OpenSSL 1.1, but they now are in OpenSSL 3... These will be made available in the next minor bump and will ship in the stable release of LibreSSL 3.7 Part of OpenSSL commit 1060a50b See also https://github.com/libressl-portable/portable/issues/748 ok beck jsing --- diff --git a/lib/libcrypto/hidden/openssl/x509_vfy.h b/lib/libcrypto/hidden/openssl/x509_vfy.h index 3a52206b453..a8e172ad2d2 100644 --- a/lib/libcrypto/hidden/openssl/x509_vfy.h +++ b/lib/libcrypto/hidden/openssl/x509_vfy.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_vfy.h,v 1.1 2022/11/14 17:48:49 beck Exp $ */ +/* $OpenBSD: x509_vfy.h,v 1.2 2022/12/01 05:16:08 tb Exp $ */ /* * Copyright (c) 2022 Bob Beck * @@ -47,6 +47,9 @@ LCRYPTO_USED(X509_STORE_set1_param); LCRYPTO_USED(X509_STORE_get0_param); LCRYPTO_USED(X509_STORE_get_verify_cb); LCRYPTO_USED(X509_STORE_set_verify_cb); +LCRYPTO_USED(X509_STORE_get_check_issued); +LCRYPTO_USED(X509_STORE_set_check_issued); +LCRYPTO_USED(X509_STORE_CTX_get_check_issued); LCRYPTO_USED(X509_STORE_CTX_new); LCRYPTO_USED(X509_STORE_CTX_get1_issuer); LCRYPTO_USED(X509_STORE_CTX_free); diff --git a/lib/libcrypto/x509/x509_vfy.c b/lib/libcrypto/x509/x509_vfy.c index 9b7f371cea5..675aba43225 100644 --- a/lib/libcrypto/x509/x509_vfy.c +++ b/lib/libcrypto/x509/x509_vfy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_vfy.c,v 1.107 2022/11/26 16:08:55 tb Exp $ */ +/* $OpenBSD: x509_vfy.c,v 1.108 2022/12/01 05:16:08 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -2587,6 +2587,28 @@ X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx, int (*verify)(X509_STORE_CTX *)) } LCRYPTO_ALIAS(X509_STORE_CTX_set_verify) +X509_STORE_CTX_check_issued_fn +X509_STORE_get_check_issued(X509_STORE *store) +{ + return store->check_issued; +} +LCRYPTO_ALIAS(X509_STORE_get_check_issued) + +void +X509_STORE_set_check_issued(X509_STORE *store, + X509_STORE_CTX_check_issued_fn check_issued) +{ + store->check_issued = check_issued; +} +LCRYPTO_ALIAS(X509_STORE_set_check_issued) + +X509_STORE_CTX_check_issued_fn +X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx) +{ + return ctx->check_issued; +} +LCRYPTO_ALIAS(X509_STORE_CTX_get_check_issued) + X509 * X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx) { diff --git a/lib/libcrypto/x509/x509_vfy.h b/lib/libcrypto/x509/x509_vfy.h index 98b1cf5e928..e00db3a7af5 100644 --- a/lib/libcrypto/x509/x509_vfy.h +++ b/lib/libcrypto/x509/x509_vfy.h @@ -1,4 +1,4 @@ -/* $OpenBSD: x509_vfy.h,v 1.54 2022/07/07 13:01:28 tb Exp $ */ +/* $OpenBSD: x509_vfy.h,v 1.55 2022/12/01 05:16:08 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -310,6 +310,17 @@ void X509_STORE_set_verify_cb(X509_STORE *ctx, #define X509_STORE_set_verify_cb_func(ctx, func) \ X509_STORE_set_verify_cb((ctx), (func)) +#if defined(LIBRESSL_INTERNAL) || defined(LIBRESSL_NEXT_API) +typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx, + X509 *subject, X509 *issuer); + +X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE *store); +void X509_STORE_set_check_issued(X509_STORE *store, + X509_STORE_CTX_check_issued_fn check_issued); +X509_STORE_CTX_check_issued_fn + X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx); +#endif + X509_STORE_CTX *X509_STORE_CTX_new(void); int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);