From c2790c60a0a1f1e0e552dc8f927711ea7ac1e74f Mon Sep 17 00:00:00 2001 From: Waleed Elmelegy Date: Wed, 27 Nov 2024 15:46:21 +0000 Subject: [PATCH] Add negative tests for interruptible export public-key Signed-off-by: Waleed Elmelegy --- tf-psa-crypto/tests/suites/test_suite_psa_crypto.data | 8 ++++++++ tf-psa-crypto/tests/suites/test_suite_psa_crypto.function | 8 -------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tf-psa-crypto/tests/suites/test_suite_psa_crypto.data b/tf-psa-crypto/tests/suites/test_suite_psa_crypto.data index 8cb7eeb2e2..2e8d75abc1 100644 --- a/tf-psa-crypto/tests/suites/test_suite_psa_crypto.data +++ b/tf-psa-crypto/tests/suites/test_suite_psa_crypto.data @@ -7961,6 +7961,14 @@ PSA interruptible export public key: ECC, brainpool384r1, good depends_on:PSA_WANT_ALG_ECDSA:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE:PSA_WANT_ECC_BRAINPOOL_P_R1_384 export_public_key:PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_BRAINPOOL_P_R1):384:PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_ECDSA_ANY:PSA_SUCCESS +PSA interruptible export public key: RSA, not ECC key, Not supported +depends_on:PSA_WANT_ALG_RSA_PSS:PSA_WANT_ALG_SHA_256:PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE:PSA_VENDOR_RSA_GENERATE_MIN_KEY_BITS <= 1024 +export_public_key:PSA_KEY_TYPE_RSA_KEY_PAIR:1024:PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH:PSA_ALG_RSA_PSS(PSA_ALG_SHA_256):PSA_ERROR_NOT_SUPPORTED + +PSA interruptible export public key: AES, not keypair, Invalid argument +depends_on:PSA_WANT_ALG_GCM:PSA_WANT_KEY_TYPE_AES +export_public_key:PSA_KEY_TYPE_AES:128:PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT:PSA_ALG_GCM:PSA_ERROR_INVALID_ARGUMENT + PSA export public-key interruptible object initializers zero properly export_public_key_iop_init: 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 b28ffd7ec0..f27730397e 100644 --- a/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function +++ b/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function @@ -10374,14 +10374,6 @@ void export_public_key( psa_set_key_type(&attributes, type); psa_set_key_bits(&attributes, bits); - /* Adjust expected_status for interruptible export public-key. - * Interruptible export public-key is only supported for ECC key pairs and even - * for those only when MBEDTLS_ECP_RESTARTABLE is on. - */ - if (!PSA_KEY_TYPE_IS_ECC(type)) { - expected_status = PSA_ERROR_NOT_SUPPORTED; - } - #if !defined(MBEDTLS_ECP_RESTARTABLE) expected_status = PSA_ERROR_NOT_SUPPORTED; #endif