File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52574,16 +52574,21 @@ static wc_test_ret_t dilithium_sign_cache_alloc_test(int param, WC_RNG* rng)
5257452574
5257552575 key = (dilithium_key*)XMALLOC(sizeof(*key), HEAP_HINT,
5257652576 DYNAMIC_TYPE_TMP_BUFFER);
52577- sig = (byte*)XMALLOC(DILITHIUM_MAX_SIG_SIZE, HEAP_HINT,
52578- DYNAMIC_TYPE_TMP_BUFFER);
52579- if (key == NULL || sig == NULL) {
52577+ if (key == NULL) {
5258052578 ERROR_OUT(WC_TEST_RET_ENC_ERRNO, out);
5258152579 }
52582-
52580+ /* Init before further allocations so wc_dilithium_free() in the cleanup
52581+ * path operates on a zeroed struct, not garbage cached-pointer fields. */
5258352582 ret = wc_dilithium_init_ex(key, NULL, devId);
5258452583 if (ret != 0)
5258552584 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
5258652585
52586+ sig = (byte*)XMALLOC(DILITHIUM_MAX_SIG_SIZE, HEAP_HINT,
52587+ DYNAMIC_TYPE_TMP_BUFFER);
52588+ if (sig == NULL) {
52589+ ERROR_OUT(WC_TEST_RET_ENC_ERRNO, out);
52590+ }
52591+
5258752592 ret = wc_dilithium_set_level(key, param);
5258852593 if (ret != 0)
5258952594 ERROR_OUT(WC_TEST_RET_ENC_EC(ret), out);
You can’t perform that action at this time.
0 commit comments