Sfoglia il codice sorgente

dsatest: Properly detect failure in generate/sign/verify

Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/16268)
Tomas Mraz 2 anni fa
parent
commit
12e055991e
1 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 5 3
      test/dsatest.c

+ 5 - 3
test/dsatest.c

@@ -108,9 +108,11 @@ static int dsa_test(void)
     if (!TEST_int_eq(i, j) || !TEST_mem_eq(buf, i, out_g, i))
         goto end;
 
-    DSA_generate_key(dsa);
-    DSA_sign(0, str1, 20, sig, &siglen, dsa);
-    if (TEST_true(DSA_verify(0, str1, 20, sig, siglen, dsa)))
+    if (!TEST_true(DSA_generate_key(dsa)))
+        goto end;
+    if (!TEST_true(DSA_sign(0, str1, 20, sig, &siglen, dsa)))
+        goto end;
+    if (TEST_int_gt(DSA_verify(0, str1, 20, sig, siglen, dsa), 0))
         ret = 1;
 
  end: