diff --git a/tf-psa-crypto/tests/suites/test_suite_psa_crypto_storage_format.function b/tf-psa-crypto/tests/suites/test_suite_psa_crypto_storage_format.function index ca70d20f67..5788742aa5 100644 --- a/tf-psa-crypto/tests/suites/test_suite_psa_crypto_storage_format.function +++ b/tf-psa-crypto/tests/suites/test_suite_psa_crypto_storage_format.function @@ -305,17 +305,17 @@ void key_storage_read(int lifetime_arg, int type_arg, int bits_arg, /* Create a persistent key which is intentionally larger than the specified * bit size. */ if (flags & TEST_FLAG_OVERSIZED_KEY) { - TEST_CALLOC(custom_key_data, PSA_BITS_TO_BYTES(bits) + 1); - memset(custom_key_data, 0xAA, PSA_BITS_TO_BYTES(bits) + 1); - material->len = PSA_BITS_TO_BYTES(bits) + 1; + TEST_CALLOC(custom_key_data, PSA_BITS_TO_BYTES(bits)); + memset(custom_key_data, 0xAA, PSA_BITS_TO_BYTES(bits)); + material->len = PSA_BITS_TO_BYTES(bits); material->x = custom_key_data; /* 36 bytes are the overhead of psa_persistent_key_storage_format */ - TEST_CALLOC(custom_storage_data, PSA_BITS_TO_BYTES(bits) + 1 + 36); - representation->len = PSA_BITS_TO_BYTES(bits) + 1 + 36; + TEST_CALLOC(custom_storage_data, PSA_BITS_TO_BYTES(bits) + 36); + representation->len = PSA_BITS_TO_BYTES(bits) + 36; representation->x = custom_storage_data; - psa_format_key_data_for_storage(custom_key_data, PSA_BITS_TO_BYTES(bits) + 1, + psa_format_key_data_for_storage(custom_key_data, PSA_BITS_TO_BYTES(bits), &attributes, custom_storage_data); } diff --git a/tf-psa-crypto/tests/suites/test_suite_psa_crypto_storage_format.misc.data b/tf-psa-crypto/tests/suites/test_suite_psa_crypto_storage_format.misc.data index 8aabe4cb2c..359053ec0d 100644 --- a/tf-psa-crypto/tests/suites/test_suite_psa_crypto_storage_format.misc.data +++ b/tf-psa-crypto/tests/suites/test_suite_psa_crypto_storage_format.misc.data @@ -14,4 +14,4 @@ key_storage_save:PSA_KEY_LIFETIME_PERSISTENT:PSA_KEY_TYPE_AES:128:PSA_KEY_USAGE_ # so that when psa_get_key_attributes() tries to load it from the storage it will fail. PSA storage read: key larger than MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE depends_on:PSA_WANT_KEY_TYPE_RAW_DATA:MBEDTLS_PSA_STATIC_KEY_SLOTS -key_storage_read:PSA_KEY_LIFETIME_PERSISTENT:PSA_KEY_TYPE_RAW_DATA:MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE*8:PSA_KEY_USAGE_EXPORT:PSA_ALG_NONE:PSA_ALG_NONE:"":"":TEST_FLAG_OVERSIZED_KEY +key_storage_read:PSA_KEY_LIFETIME_PERSISTENT:PSA_KEY_TYPE_RAW_DATA:PSA_BYTES_TO_BITS(MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE + 1):PSA_KEY_USAGE_EXPORT:PSA_ALG_NONE:PSA_ALG_NONE:"":"":TEST_FLAG_OVERSIZED_KEY