From: tb Date: Sun, 31 Oct 2021 08:27:15 +0000 (+0000) Subject: Prepare regress for opaque structs in x509*.h X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=920585fa5f3731ef8f1627189b85a134e8d6fb75;p=openbsd Prepare regress for opaque structs in x509*.h --- diff --git a/regress/lib/libcrypto/x509/callback.c b/regress/lib/libcrypto/x509/callback.c index e31d1b826b4..b2531fe8192 100644 --- a/regress/lib/libcrypto/x509/callback.c +++ b/regress/lib/libcrypto/x509/callback.c @@ -1,4 +1,4 @@ -/* $OpenBSD: callback.c,v 1.2 2021/09/30 18:28:38 jsing Exp $ */ +/* $OpenBSD: callback.c,v 1.3 2021/10/31 08:27:15 tb Exp $ */ /* * Copyright (c) 2020 Joel Sing * Copyright (c) 2020-2021 Bob Beck @@ -115,7 +115,6 @@ verify_cert(const char *roots_dir, const char *roots_file, X509_STORE_CTX *xsc = NULL; X509_STORE *store = NULL; int verify_err, use_dir; - unsigned long flags; X509 *leaf = NULL; *chains = 0; @@ -141,15 +140,11 @@ verify_cert(const char *roots_dir, const char *roots_file, if (!X509_STORE_load_locations(store, NULL, roots_dir)) errx(1, "failed to set by_dir directory of %s", roots_dir); } - if (mode == MODE_LEGACY_VFY) { - flags = X509_VERIFY_PARAM_get_flags(xsc->param); - flags |= X509_V_FLAG_LEGACY_VERIFY; - X509_VERIFY_PARAM_set_flags(xsc->param, flags); - } else { - flags = X509_VERIFY_PARAM_get_flags(xsc->param); - flags &= ~X509_V_FLAG_LEGACY_VERIFY; - X509_VERIFY_PARAM_set_flags(xsc->param, flags); - } + if (mode == MODE_LEGACY_VFY) + X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_LEGACY_VERIFY); + else + X509_VERIFY_PARAM_clear_flags(X509_STORE_CTX_get0_param(xsc), + X509_V_FLAG_LEGACY_VERIFY); if (verbose) X509_STORE_CTX_set_verify_cb(xsc, verify_cert_cb); diff --git a/regress/lib/libcrypto/x509/verify.c b/regress/lib/libcrypto/x509/verify.c index 3a3c9b01976..3b852803596 100644 --- a/regress/lib/libcrypto/x509/verify.c +++ b/regress/lib/libcrypto/x509/verify.c @@ -1,4 +1,4 @@ -/* $OpenBSD: verify.c,v 1.8 2021/09/30 18:28:38 jsing Exp $ */ +/* $OpenBSD: verify.c,v 1.9 2021/10/31 08:27:15 tb Exp $ */ /* * Copyright (c) 2020 Joel Sing * Copyright (c) 2020-2021 Bob Beck @@ -108,7 +108,6 @@ verify_cert(const char *roots_dir, const char *roots_file, X509_STORE_CTX *xsc = NULL; X509_STORE *store = NULL; int verify_err, use_dir; - unsigned long flags; X509 *leaf = NULL; *chains = 0; @@ -134,15 +133,11 @@ verify_cert(const char *roots_dir, const char *roots_file, if (!X509_STORE_load_locations(store, NULL, roots_dir)) errx(1, "failed to set by_dir directory of %s", roots_dir); } - if (mode == MODE_LEGACY_VFY) { - flags = X509_VERIFY_PARAM_get_flags(xsc->param); - flags |= X509_V_FLAG_LEGACY_VERIFY; - X509_VERIFY_PARAM_set_flags(xsc->param, flags); - } else { - flags = X509_VERIFY_PARAM_get_flags(xsc->param); - flags &= ~X509_V_FLAG_LEGACY_VERIFY; - X509_VERIFY_PARAM_set_flags(xsc->param, flags); - } + if (mode == MODE_LEGACY_VFY) + X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_LEGACY_VERIFY); + else + X509_VERIFY_PARAM_clear_flags(X509_STORE_CTX_get0_param(xsc), + X509_V_FLAG_LEGACY_VERIFY); if (verbose) X509_STORE_CTX_set_verify_cb(xsc, verify_cert_cb); diff --git a/regress/lib/libcrypto/x509/x509attribute.c b/regress/lib/libcrypto/x509/x509attribute.c index 3dd6d2912c8..4f981144582 100644 --- a/regress/lib/libcrypto/x509/x509attribute.c +++ b/regress/lib/libcrypto/x509/x509attribute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509attribute.c,v 1.1 2020/06/04 21:21:03 schwarze Exp $ */ +/* $OpenBSD: x509attribute.c,v 1.2 2021/10/31 08:27:15 tb Exp $ */ /* * Copyright (c) 2020 Ingo Schwarze * @@ -15,6 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#define LIBRESSL_CRYPTO_INTERNAL + #include #include #include diff --git a/regress/lib/libcrypto/x509/x509name.c b/regress/lib/libcrypto/x509/x509name.c index c9c96d4ec89..9deeeb29869 100644 --- a/regress/lib/libcrypto/x509/x509name.c +++ b/regress/lib/libcrypto/x509/x509name.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x509name.c,v 1.2 2018/11/10 01:43:03 tb Exp $ */ +/* $OpenBSD: x509name.c,v 1.3 2021/10/31 08:27:15 tb Exp $ */ /* * Copyright (c) 2018 Ingo Schwarze * @@ -28,7 +28,8 @@ debug_print(X509_NAME *name) int loc; for (loc = 0; loc < X509_NAME_entry_count(name); loc++) - printf("%d:", X509_NAME_get_entry(name, loc)->set); + printf("%d:", + X509_NAME_ENTRY_set(X509_NAME_get_entry(name, loc))); putchar(' '); X509_NAME_print_ex_fp(stdout, name, 0, XN_FLAG_SEP_CPLUS_SPC); putchar('\n');