Fix from review

This commit is contained in:
Eric Blankenhorn
2026-05-05 10:23:36 -05:00
parent 4191d46d95
commit 8ce4e126ae
+9 -4
View File
@@ -52574,16 +52574,21 @@ static wc_test_ret_t dilithium_sign_cache_alloc_test(int param, WC_RNG* rng)
key = (dilithium_key*)XMALLOC(sizeof(*key), HEAP_HINT,
DYNAMIC_TYPE_TMP_BUFFER);
sig = (byte*)XMALLOC(DILITHIUM_MAX_SIG_SIZE, HEAP_HINT,
DYNAMIC_TYPE_TMP_BUFFER);
if (key == NULL || sig == NULL) {
if (key == NULL) {
ERROR_OUT(WC_TEST_RET_ENC_ERRNO, out);
}
/* Init before further allocations so wc_dilithium_free() in the cleanup
* path operates on a zeroed struct, not garbage cached-pointer fields. */
ret = wc_dilithium_init_ex(key, NULL, devId);
if (ret != 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
sig = (byte*)XMALLOC(DILITHIUM_MAX_SIG_SIZE, HEAP_HINT,
DYNAMIC_TYPE_TMP_BUFFER);
if (sig == NULL) {
ERROR_OUT(WC_TEST_RET_ENC_ERRNO, out);
}
ret = wc_dilithium_set_level(key, param);
if (ret != 0)
ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);