Skip to content

Commit

Permalink
[nrf noup] tests: secure_storage: Fix issues
Browse files Browse the repository at this point in the history
Set CONFIG_TFM_PROFILE_TYPE_MEDIUM for boards with TF-M to enable
ITS and PS.

Enable CONFIG_PSA_WANT_GENERATE_RANDOM to fix persistent_key
tests when TF-M is used.

native_sim target needs CONFIG_PSA_WANT_ALG_ECB_NO_PADDING.

Skip checking of private_reserved field in psa_key_attributes if
present.

Increase maximum ITS asset size.

Signed-off-by: Juha Ylinen <[email protected]>
  • Loading branch information
juhaylinen authored and anangl committed Feb 7, 2025
1 parent 40fc1d8 commit 6696c98
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions tests/subsys/secure_storage/psa/crypto/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ CONFIG_ZTEST=y

CONFIG_PSA_WANT_KEY_TYPE_AES=y
CONFIG_PSA_WANT_ALG_CBC_NO_PADDING=y

# native_sim requires ECB cipher to be enabled
CONFIG_PSA_WANT_ALG_ECB_NO_PADDING=y
7 changes: 6 additions & 1 deletion tests/subsys/secure_storage/psa/crypto/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ ZTEST(secure_storage_psa_crypto, test_its_caller_isolation)

ret = psa_get_key_attributes(ID, &retrieved_key_attributes);
zassert_equal(ret, PSA_SUCCESS);
zassert_mem_equal(&retrieved_key_attributes, &key_attributes, sizeof(key_attributes));
zassert_equal(key_attributes.private_bits, retrieved_key_attributes.private_bits);
zassert_equal(key_attributes.private_id, retrieved_key_attributes.private_id);
zassert_equal(key_attributes.private_lifetime, retrieved_key_attributes.private_lifetime);
zassert_mem_equal(&key_attributes.private_policy, &retrieved_key_attributes.private_policy,
sizeof(key_attributes.private_policy));

ret = psa_destroy_key(ID);
zassert_equal(ret, PSA_SUCCESS);
ret = psa_get_key_attributes(ID, &retrieved_key_attributes);
Expand Down
3 changes: 3 additions & 0 deletions tests/subsys/secure_storage/psa/crypto/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@ tests:
- nrf54l15dk/nrf54l15/cpuapp
secure_storage.psa.crypto.tfm:
filter: CONFIG_BUILD_WITH_TFM
extra_args:
- CONFIG_TFM_PROFILE_TYPE_MEDIUM=y
- CONFIG_PSA_WANT_GENERATE_RANDOM=y
integration_platforms:
- nrf9151dk/nrf9151/ns
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ CONFIG_ZTEST_STACK_SIZE=3072
CONFIG_MAIN_STACK_SIZE=2048

CONFIG_SECURE_STORAGE=y

# native_sim requires ECB cipher to be enabled
CONFIG_PSA_WANT_ALG_ECB_NO_PADDING=y
3 changes: 2 additions & 1 deletion tests/subsys/secure_storage/psa/its/overlay-tfm.conf
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CONFIG_TFM_ITS_MAX_ASSET_SIZE_OVERRIDE=y
CONFIG_TFM_ITS_MAX_ASSET_SIZE=256
CONFIG_TFM_ITS_MAX_ASSET_SIZE=512
CONFIG_TFM_PROFILE_TYPE_MEDIUM=y
1 change: 1 addition & 0 deletions tests/subsys/secure_storage/psa/its/prj.conf
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_STACK_SIZE=3072

0 comments on commit 6696c98

Please sign in to comment.