mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-29 04:20:12 +00:00
Use new thread abstraction for ctr_drbg tests
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
3a4d2f14a8
commit
3dce2327ab
@ -346,7 +346,7 @@ exit:
|
|||||||
void ctr_drbg_threads(data_t *expected_result, int reseed, int arg_thread_count)
|
void ctr_drbg_threads(data_t *expected_result, int reseed, int arg_thread_count)
|
||||||
{
|
{
|
||||||
size_t thread_count = (size_t) arg_thread_count;
|
size_t thread_count = (size_t) arg_thread_count;
|
||||||
pthread_t *threads = NULL;
|
mbedtls_test_thread_t *threads = NULL;
|
||||||
|
|
||||||
unsigned char out[16];
|
unsigned char out[16];
|
||||||
unsigned char *entropy = NULL;
|
unsigned char *entropy = NULL;
|
||||||
@ -358,7 +358,7 @@ void ctr_drbg_threads(data_t *expected_result, int reseed, int arg_thread_count)
|
|||||||
|
|
||||||
AES_PSA_INIT();
|
AES_PSA_INIT();
|
||||||
|
|
||||||
TEST_CALLOC(threads, sizeof(pthread_t) * thread_count);
|
TEST_CALLOC(threads, sizeof(mbedtls_test_thread_t) * thread_count);
|
||||||
memset(out, 0, sizeof(out));
|
memset(out, 0, sizeof(out));
|
||||||
|
|
||||||
mbedtls_ctr_drbg_context ctx;
|
mbedtls_ctr_drbg_context ctx;
|
||||||
@ -392,13 +392,13 @@ void ctr_drbg_threads(data_t *expected_result, int reseed, int arg_thread_count)
|
|||||||
|
|
||||||
for (size_t i = 0; i < thread_count; i++) {
|
for (size_t i = 0; i < thread_count; i++) {
|
||||||
TEST_EQUAL(
|
TEST_EQUAL(
|
||||||
pthread_create(&threads[i], NULL,
|
mbedtls_test_thread_create(&threads[i],
|
||||||
thread_random_function, (void *) &ctx),
|
thread_random_function, (void *) &ctx),
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < thread_count; i++) {
|
for (size_t i = 0; i < thread_count; i++) {
|
||||||
TEST_EQUAL(pthread_join(threads[i], NULL), 0);
|
TEST_EQUAL(mbedtls_test_thread_join(&threads[i]), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Take a last output for comparing and thus verifying the DRBG state */
|
/* Take a last output for comparing and thus verifying the DRBG state */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user