test_suite_psa_crypto_storage_format: improve input bit length specification for static key buffer

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/tests/suites/test_suite_psa_crypto_storage_format.function b/tests/suites/test_suite_psa_crypto_storage_format.function
index ca70d20..5788742 100644
--- a/tests/suites/test_suite_psa_crypto_storage_format.function
+++ b/tests/suites/test_suite_psa_crypto_storage_format.function
@@ -305,17 +305,17 @@
     /* 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/tests/suites/test_suite_psa_crypto_storage_format.misc.data b/tests/suites/test_suite_psa_crypto_storage_format.misc.data
index 8aabe4c..359053e 100644
--- a/tests/suites/test_suite_psa_crypto_storage_format.misc.data
+++ b/tests/suites/test_suite_psa_crypto_storage_format.misc.data
@@ -14,4 +14,4 @@
 # 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