From dac2f23a82dff62bf6c0cdb3872ffec63e906d95 Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Tue, 22 Feb 2022 14:27:17 +0100 Subject: [PATCH] Stop checking against reference vector in pk_rsa_encrypt_test_vec when USE_PSA_CRYPTO The pk_rsa_encrypt_test_vec() reference vector is calculated while using mbedtls_test_rnd_pseudo_rand rng source, but since the RNG souce can't be controlled when USE_PSA_CRYPTO is enabled we can't get the same result. The pk_rsa_encrypt_test_vec() fails when switching to mbedtls_test_rnd_std_rand as rng source. Signed-off-by: Neil Armstrong --- tests/suites/test_suite_pk.function | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/suites/test_suite_pk.function b/tests/suites/test_suite_pk.function index 61447afe3c..c6533c7dee 100644 --- a/tests/suites/test_suite_pk.function +++ b/tests/suites/test_suite_pk.function @@ -812,7 +812,10 @@ void pk_rsa_encrypt_test_vec( data_t * message, int mod, int radix_N, output, &olen, sizeof( output ), mbedtls_test_rnd_pseudo_rand, &rnd_info ) == ret ); TEST_ASSERT( olen == result->len ); +#if !defined(MBEDTLS_USE_PSA_CRYPTO) + // When using PSA crypto, RNG isn't controllable, so reference vector can't be used TEST_ASSERT( memcmp( output, result->x, olen ) == 0 ); +#endif exit: mbedtls_pk_free( &pk );