mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-19 00:40:14 +00:00
Fix tests where tests were done prior to init
Variables that are in any way destructed on exit should be initialised prior to any tests that might jump to exit, to save potential uninitialised memory accesses. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
0b8b7a1ee1
commit
29fe76b843
@ -365,12 +365,12 @@ void ctr_drbg_threads(data_t *expected_result, int reseed, int arg_thread_count)
|
||||
|
||||
AES_PSA_INIT();
|
||||
|
||||
TEST_CALLOC(threads, sizeof(mbedtls_test_thread_t) * thread_count);
|
||||
memset(out, 0, sizeof(out));
|
||||
|
||||
mbedtls_ctr_drbg_context ctx;
|
||||
mbedtls_ctr_drbg_init(&ctx);
|
||||
|
||||
TEST_CALLOC(threads, sizeof(mbedtls_test_thread_t) * thread_count);
|
||||
memset(out, 0, sizeof(out));
|
||||
|
||||
test_offset_idx = 0;
|
||||
|
||||
/* Need to set a non-default fixed entropy len, to ensure same output across
|
||||
|
@ -297,11 +297,12 @@ void x509_csr_check_opaque(char *key_file, int md_type, int key_usage,
|
||||
mbedtls_test_rnd_pseudo_info rnd_info;
|
||||
|
||||
mbedtls_x509write_csr_init(&req);
|
||||
mbedtls_pk_init(&key);
|
||||
|
||||
MD_OR_USE_PSA_INIT();
|
||||
|
||||
memset(&rnd_info, 0x2a, sizeof(mbedtls_test_rnd_pseudo_info));
|
||||
|
||||
mbedtls_pk_init(&key);
|
||||
TEST_ASSERT(mbedtls_pk_parse_keyfile(&key, key_file, NULL,
|
||||
mbedtls_test_rnd_std_rand, NULL) == 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user