Check that {DH,DSA}_get0_engine() returns NULL if OPENSSL_NO_ENGINE is
authortb <tb@openbsd.org>
Sat, 12 Aug 2023 06:23:59 +0000 (06:23 +0000)
committertb <tb@openbsd.org>
Sat, 12 Aug 2023 06:23:59 +0000 (06:23 +0000)
defined.

regress/lib/libcrypto/dh/dhtest.c
regress/lib/libcrypto/dsa/dsatest.c

index 7ddd118..cfbfb98 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dhtest.c,v 1.8 2023/07/28 13:05:59 tb Exp $   */
+/*     $OpenBSD: dhtest.c,v 1.9 2023/08/12 06:23:59 tb Exp $   */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -108,6 +108,13 @@ main(int argc, char *argv[])
        if ((a = DH_new()) == NULL)
                goto err;
 
+#ifdef OPENSSL_NO_ENGINE
+       if (DH_get0_engine(a) != NULL) {
+               fprintf(stderr, "ENGINE was not NULL\n");
+               goto err;
+       }
+#endif
+
        if (!DH_generate_parameters_ex(a, 64, DH_GENERATOR_5, _cb))
                goto err;
 
index e5b56c0..b21f1b9 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dsatest.c,v 1.7 2022/01/12 08:59:56 tb Exp $  */
+/*     $OpenBSD: dsatest.c,v 1.8 2023/08/12 06:23:59 tb Exp $  */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -143,6 +143,13 @@ main(int argc, char **argv)
        if ((dsa = DSA_new()) == NULL)
                goto end;
 
+#ifdef OPENSSL_NO_ENGINE
+       if (DSA_get0_engine(dsa) != NULL) {
+               BIO_printf(bio_err, "ENGINE was not NULL\n");
+               goto end;
+       }
+#endif
+
        if (!DSA_generate_parameters_ex(dsa, 512, seed, 20, &counter, &h, cb))
                goto end;