mirror of https://github.com/openssl/openssl.git
Fix the "Out of memory" EVP KDF scrypt test
This test did not really execute, since usually the OPENSSL_malloc(0) will fail and prevent the execution of the KDF. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16444)
This commit is contained in:
parent
20b39175b5
commit
cce935b23c
|
@ -2664,7 +2664,7 @@ static int kdf_test_run(EVP_TEST *t)
|
|||
t->err = "KDF_CTRL_ERROR";
|
||||
return 1;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -2760,7 +2760,7 @@ static int pkey_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;
|
||||
}
|
||||
|
|
|
@ -60,4 +60,4 @@ Ctrl.salt = salt:SodiumChloride
|
|||
Ctrl.N = n:1048576
|
||||
Ctrl.r = r:8
|
||||
Ctrl.p = p:1
|
||||
Result = INTERNAL_ERROR
|
||||
Result = KDF_MISMATCH
|
||||
|
|
|
@ -60,4 +60,4 @@ Ctrl.salt = salt:SodiumChloride
|
|||
Ctrl.N = N:1048576
|
||||
Ctrl.r = r:8
|
||||
Ctrl.p = p:1
|
||||
Result = INTERNAL_ERROR
|
||||
Result = KDF_MISMATCH
|
||||
|
|
Loading…
Reference in New Issue