Revert previous. Committed the wrong version of the diff.
authortb <tb@openbsd.org>
Wed, 31 Aug 2022 09:36:46 +0000 (09:36 +0000)
committertb <tb@openbsd.org>
Wed, 31 Aug 2022 09:36:46 +0000 (09:36 +0000)
regress/lib/libcrypto/ecdsa/ecdsatest.c

index 5e2419a..45ffd91 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ecdsatest.c,v 1.10 2022/08/31 09:33:39 tb Exp $       */
+/*     $OpenBSD: ecdsatest.c,v 1.11 2022/08/31 09:36:46 tb Exp $       */
 /*
  * Written by Nils Larsch for the OpenSSL project.
  */
@@ -251,8 +251,7 @@ test_builtin(BIO *out)
                BIO_printf(out, ".");
                (void)BIO_flush(out);
                /* create signature */
-               if ((sig_len = ECDSA_size(eckey)) == 0)
-                       goto builtin_err;
+               sig_len = ECDSA_size(eckey);
                if ((signature = malloc(sig_len)) == NULL)
                        goto builtin_err;
                if (!ECDSA_sign(0, digest, 20, signature, &sig_len, eckey)) {
@@ -333,13 +332,8 @@ test_builtin(BIO *out)
                r = NULL;
                s = NULL;
 
-               free(signature);
-               signature = NULL;
-
                sig_ptr2 = signature;
-               if ((sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2)) <= 0)
-                       goto builtin_err;
-
+               sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);
                if (ECDSA_verify(0, digest, 20, signature, sig_len,
                    eckey) == 1) {
                        BIO_printf(out, " failed\n");
@@ -355,12 +349,8 @@ test_builtin(BIO *out)
                r = NULL;
                s = NULL;
 
-               free(signature);
-               signature = NULL;
-
                sig_ptr2 = signature;
-               if ((sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2)) <= 0)
-                       goto builtin_err;
+               sig_len = i2d_ECDSA_SIG(ecdsa_sig, &sig_ptr2);
                if (ECDSA_verify(0, digest, 20, signature, sig_len,
                    eckey) != 1) {
                        BIO_printf(out, " failed\n");