mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-23 11:42:31 +00:00
test_suite_psa_crypto_storage_format: improve input bit length specification for static key buffer
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
parent
4d9a8219ac
commit
2b9d180f8e
@ -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
|
/* Create a persistent key which is intentionally larger than the specified
|
||||||
* bit size. */
|
* bit size. */
|
||||||
if (flags & TEST_FLAG_OVERSIZED_KEY) {
|
if (flags & TEST_FLAG_OVERSIZED_KEY) {
|
||||||
TEST_CALLOC(custom_key_data, 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) + 1);
|
memset(custom_key_data, 0xAA, PSA_BITS_TO_BYTES(bits));
|
||||||
material->len = PSA_BITS_TO_BYTES(bits) + 1;
|
material->len = PSA_BITS_TO_BYTES(bits);
|
||||||
material->x = custom_key_data;
|
material->x = custom_key_data;
|
||||||
|
|
||||||
/* 36 bytes are the overhead of psa_persistent_key_storage_format */
|
/* 36 bytes are the overhead of psa_persistent_key_storage_format */
|
||||||
TEST_CALLOC(custom_storage_data, 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) + 1 + 36;
|
representation->len = PSA_BITS_TO_BYTES(bits) + 36;
|
||||||
representation->x = custom_storage_data;
|
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);
|
&attributes, custom_storage_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.
|
# 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
|
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
|
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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user