Skip to content

Commit 5cbe193

Browse files
committed
Add test to check that key ID's from the vendor range are accepted for storing externally
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
1 parent 223f287 commit 5cbe193

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

tests/suites/test_suite_psa_crypto_se_driver_hal.data

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,28 @@ Key generation smoke test: HMAC-SHA-256
130130
generate_key_smoke:PSA_KEY_TYPE_HMAC:256:PSA_ALG_HMAC( PSA_ALG_SHA_256 )
131131

132132
Key registration: smoke test
133-
register_key_smoke_test:TEST_SE_PERSISTENT_LIFETIME:1:PSA_SUCCESS
133+
register_key_smoke_test:TEST_SE_PERSISTENT_LIFETIME:1:1:PSA_SUCCESS
134134

135-
Key registration: invalid lifetime (volatile)
136-
register_key_smoke_test:PSA_KEY_LIFETIME_VOLATILE:1:PSA_ERROR_INVALID_ARGUMENT
135+
Key registration: invalid lifetime (volatile internal storage)
136+
register_key_smoke_test:PSA_KEY_LIFETIME_VOLATILE:1:1:PSA_ERROR_INVALID_ARGUMENT
137137

138138
Key registration: invalid lifetime (internal storage)
139-
register_key_smoke_test:PSA_KEY_LIFETIME_PERSISTENT:1:PSA_ERROR_INVALID_ARGUMENT
139+
register_key_smoke_test:PSA_KEY_LIFETIME_PERSISTENT:1:1:PSA_ERROR_INVALID_ARGUMENT
140140

141141
Key registration: invalid lifetime (no registered driver)
142-
register_key_smoke_test:PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION( PSA_KEY_PERSISTENCE_DEFAULT, TEST_DRIVER_LOCATION + 1 ):1:PSA_ERROR_INVALID_ARGUMENT
142+
register_key_smoke_test:PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION( PSA_KEY_PERSISTENCE_DEFAULT, TEST_DRIVER_LOCATION + 1 ):1:1:PSA_ERROR_INVALID_ARGUMENT
143143

144144
Key registration: rejected
145-
register_key_smoke_test:TEST_SE_PERSISTENT_LIFETIME:0:PSA_ERROR_NOT_PERMITTED
145+
register_key_smoke_test:TEST_SE_PERSISTENT_LIFETIME:1:0:PSA_ERROR_NOT_PERMITTED
146146

147147
Key registration: not supported
148-
register_key_smoke_test:TEST_SE_PERSISTENT_LIFETIME:-1:PSA_ERROR_NOT_SUPPORTED
148+
register_key_smoke_test:TEST_SE_PERSISTENT_LIFETIME:1:-1:PSA_ERROR_NOT_SUPPORTED
149+
150+
Key registration: key id out of range
151+
register_key_smoke_test:TEST_SE_PERSISTENT_LIFETIME:PSA_KEY_ID_VENDOR_MAX+1:-1:PSA_ERROR_INVALID_ARGUMENT
152+
153+
Key registration: key id in vendor range
154+
register_key_smoke_test:TEST_SE_PERSISTENT_LIFETIME:PSA_KEY_ID_VENDOR_MAX:1:PSA_SUCCESS
149155

150156
Import-sign-verify: sign in driver, ECDSA
151157
depends_on:MBEDTLS_ECDSA_C:MBEDTLS_ECP_C:MBEDTLS_ECP_DP_SECP256R1_ENABLED

tests/suites/test_suite_psa_crypto_se_driver_hal.function

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,6 +1410,7 @@ exit:
14101410

14111411
/* BEGIN_CASE */
14121412
void register_key_smoke_test( int lifetime_arg,
1413+
int id_arg,
14131414
int validate,
14141415
int expected_status_arg )
14151416
{
@@ -1419,7 +1420,7 @@ void register_key_smoke_test( int lifetime_arg,
14191420
psa_drv_se_t driver;
14201421
psa_drv_se_key_management_t key_management;
14211422
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
1422-
psa_key_id_t id = 1;
1423+
psa_key_id_t id = id_arg;
14231424
size_t bit_size = 48;
14241425
psa_key_slot_number_t wanted_slot = 0x123456789;
14251426
psa_key_handle_t handle = 0;

0 commit comments

Comments
 (0)