]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix the "Out of memory" EVP KDF scrypt test
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 27 Aug 2021 11:11:39 +0000 (13:11 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Sat, 28 Aug 2021 14:49:25 +0000 (16:49 +0200)
This test did not really execute, since usually
the OPENSSL_malloc(0) will fail and prevent the
execution of the KDF.

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16446)

test/evp_test.c
test/recipes/30-test_evp_data/evpkdf.txt

index abb51384e877bf33e02d6dc4bbf0acf9e1c4a1aa..d4cca6dbcb36f44f0f3d6b280db0bf9bcbbdfec9 100644 (file)
@@ -1777,7 +1777,7 @@ static int kdf_test_run(EVP_TEST *t)
     unsigned char *got = NULL;
     size_t got_len = expected->output_len;
 
-    if (!TEST_ptr(got = OPENSSL_malloc(got_len))) {
+    if (!TEST_ptr(got = OPENSSL_malloc(got_len == 0 ? 1 : got_len))) {
         t->err = "INTERNAL_ERROR";
         goto err;
     }
index 9a6cc28385367879504d8059aee4d7542c7550f1..8fe0df39720c8449a1f3a8bcc115a26baeab0dff 100644 (file)
@@ -301,5 +301,5 @@ Ctrl.salt = salt:SodiumChloride
 Ctrl.N = N:1048576
 Ctrl.r = r:8
 Ctrl.p = p:1
-Result = INTERNAL_ERROR
+Result = KDF_MISMATCH