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 a793404ece..6be0f60c11 100644 --- a/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function +++ b/tf-psa-crypto/tests/suites/test_suite_psa_crypto.function @@ -1929,7 +1929,7 @@ void import_export_public_key(data_t *data, } /* Adjust expected_status for interruptible export public-key. - * Interruptible export public-key is only supported for ECC key pairs and even + * Interruptible export public-key is only supported for ECC keys and even * for those only when MBEDTLS_ECP_RESTARTABLE is on. */ if ((PSA_KEY_TYPE_IS_KEY_PAIR(type) || PSA_KEY_TYPE_IS_PUBLIC_KEY(type)) && @@ -1953,6 +1953,8 @@ void import_export_public_key(data_t *data, expected_export_status = PSA_ERROR_BAD_STATE; } + memset(exported, 0, export_size); + do { status = psa_export_public_key_iop_complete(&export_key_operation, exported, @@ -1962,16 +1964,6 @@ void import_export_public_key(data_t *data, TEST_EQUAL(status, expected_export_status); if (status == PSA_SUCCESS) { - psa_key_type_t public_type = PSA_KEY_TYPE_PUBLIC_KEY_OF_KEY_PAIR(type); - size_t bits; - PSA_ASSERT(psa_get_key_attributes(key, &attributes)); - bits = psa_get_key_bits(&attributes); - TEST_LE_U(expected_public_key->len, - PSA_EXPORT_KEY_OUTPUT_SIZE(public_type, bits)); - TEST_LE_U(expected_public_key->len, - PSA_EXPORT_PUBLIC_KEY_OUTPUT_SIZE(public_type, bits)); - TEST_LE_U(expected_public_key->len, - PSA_EXPORT_PUBLIC_KEY_MAX_SIZE); TEST_MEMORY_COMPARE(expected_public_key->x, expected_public_key->len, exported, exported_length); }