From 314af07af71868326dd0796d4082d7856b261323 Mon Sep 17 00:00:00 2001 From: Waleed Elmelegy Date: Tue, 3 Dec 2024 15:56:08 +0000 Subject: [PATCH] Rename interruptible_key_agreement_get_min_num_ops() Rename interruptible_key_agreement_get_min_num_ops() testing helper function to interruptible_operations_get_min_num_ops() since it's values are not only specefic to key agreement but to any resartable ecp operation. Also add different key sizes and rounding up for keys where there are no data available. Signed-off-by: Waleed Elmelegy --- tf-psa-crypto/tests/suites/test_suite_psa_crypto.function | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function b/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function index 6be0f60c117..24fe75f0058 100644 --- a/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function +++ b/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function @@ -1246,11 +1246,13 @@ static void interruptible_signverify_get_minmax_completes(uint32_t max_ops, /* ECP need to block for a minimum number of operations even if max_ops is set to a lower value. This functions calculates this minimum value given the curve size and the window size. */ -static uint32_t interruptible_key_agreement_get_min_num_ops(size_t key_bits) +static uint32_t interruptible_operations_get_min_num_ops(size_t key_bits) { /* Those values are taken from documentation of mbedtls_ecp_set_max_ops() in ecp.h. Those values can change at any time. */ switch (key_bits) { + case 192: + case 255: case 256: { const uint32_t min_values[5] = { 208, 208, 160, 136, 124 }; // P-256 @@ -1263,6 +1265,7 @@ static uint32_t interruptible_key_agreement_get_min_num_ops(size_t key_bits) return min_values[6 - MBEDTLS_ECP_WINDOW_SIZE]; break; } + case 448: case 512: case 521: { @@ -9968,7 +9971,7 @@ void key_agreement_interruptible(int alg_arg, mbedtls_ecp_check_pubkey() */ TEST_EQUAL(num_ops_prior, MBEDTLS_ECP_OPS_CHK); - min_num_ops = interruptible_key_agreement_get_min_num_ops(key_bits); + min_num_ops = interruptible_operations_get_min_num_ops(key_bits); do {