Merge pull request #8790 from paul-elliott-arm/fix_ctr_drbg_comment

Fix confusing comment in ctr drbg thread test
This commit is contained in:
Tom Cosgrove 2024-02-08 11:11:50 +00:00 committed by GitHub
commit 1dbfc8ad3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -354,7 +354,12 @@ void ctr_drbg_threads(data_t *expected_result, int reseed, int arg_thread_count)
const size_t n_random_calls = thread_count * thread_random_reps + 1; const size_t n_random_calls = thread_count * thread_random_reps + 1;
/* Based on the size of MBEDTLS_CTR_DRBG_ENTROPY_LEN for SHA512. */ /* This is a known-answer test, and although tests use a mock entropy
* function the input entropy length will still affect the output.
* We therefore need to pick a fixed entropy length, rather than using the
* default entropy length (MBEDTLS_CTR_DRBG_ENTROPY_LEN). We've chosen to
* use the default value of MBEDTLS_CTR_DRBG_ENTROPY_LEN for SHA-512,
* as this was the value used when the expected answers were calculated. */
const size_t entropy_len = 48; const size_t entropy_len = 48;
AES_PSA_INIT(); AES_PSA_INIT();
@ -367,8 +372,8 @@ void ctr_drbg_threads(data_t *expected_result, int reseed, int arg_thread_count)
test_offset_idx = 0; test_offset_idx = 0;
/* Need to do this, otherwise if we are forced into using SHA256 for /* Need to set a non-default fixed entropy len, to ensure same output across
* whaever reason, output will differ. */ * all configs - see above for details. */
mbedtls_ctr_drbg_set_entropy_len(&ctx, entropy_len); mbedtls_ctr_drbg_set_entropy_len(&ctx, entropy_len);
if (reseed == 0) { if (reseed == 0) {