Prepare regress for opaque structs in x509*.h
authortb <tb@openbsd.org>
Sun, 31 Oct 2021 08:27:15 +0000 (08:27 +0000)
committertb <tb@openbsd.org>
Sun, 31 Oct 2021 08:27:15 +0000 (08:27 +0000)
regress/lib/libcrypto/x509/callback.c
regress/lib/libcrypto/x509/verify.c
regress/lib/libcrypto/x509/x509attribute.c
regress/lib/libcrypto/x509/x509name.c

index e31d1b8..b2531fe 100644 (file)
@@ -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 <jsing@openbsd.org>
  * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
@@ -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);
index 3a3c9b0..3b85280 100644 (file)
@@ -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 <jsing@openbsd.org>
  * Copyright (c) 2020-2021 Bob Beck <beck@openbsd.org>
@@ -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);
index 3dd6d29..4f98114 100644 (file)
@@ -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 <schwarze@openbsd.org>
  *
@@ -15,6 +15,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#define LIBRESSL_CRYPTO_INTERNAL
+
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
index c9c96d4..9deeeb2 100644 (file)
@@ -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 <schwarze@openbsd.org>
  *
@@ -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');