Skip to content

Commit 4bd569e

Browse files
frkvbjarki-andreasen
authored andcommitted
crypto: Add unit tests for PSA core lite
-This adds unit-tests for PSA core lite for nRF54L15 devices. This only supports CRACEN PSA crypto driver. The test does the following: -Provision keys (Ed25519, ECDSA with secp256r1, AES-256) -Run verify signature (Ed25519 and ECDSA with secp256r1) -Optionally AES CTR encryption -Optionally PSA generate random -Revoke provisioned keys (that are revokable) -Lock provisioned keys (that are read-only) -For size comparison and configuration consistency there are targets in testcase.yaml for the original oberon-psa-crypto as well as PSA core lite. -Provisioning of keys is using PSA crypto APIs. This is only valid for the unit-test. To be able to support this, specialized versions of psa_import_key and psa_export_key, which is not part of PSA core lite Note: Since keys provisioned are revokable and read-only it is required to use ERASEALL or fully recover the device with nrfutil to clear out KMU slots before running the unit-tests ref: NCSDK-30323 Signed-off-by: Frank Audun Kvamtrø <[email protected]>
1 parent 905ad3b commit 4bd569e

File tree

11 files changed

+1071
-0
lines changed

11 files changed

+1071
-0
lines changed

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,7 @@
916916
/tests/subsys/nrf_compress/ @nordicjm
917917
/tests/subsys/nrf_profiler/ @nrfconnect/ncs-si-bluebagel
918918
/tests/subsys/nrf_rpc/ @nrfconnect/ncs-protocols-serialization
919+
/tests/subsys/nrf_security/psa_core_lite/ @nrfconnect/ncs-aegir
919920
/tests/subsys/partition_manager/region/ @nordicjm @tejlmand
920921
/tests/subsys/partition_manager/static_pm_file/ @nordicjm @tejlmand
921922
/tests/subsys/pcd/ @nrfconnect/ncs-pluto
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project("PSA core lite unit tests")
11+
12+
# Add test sources
13+
target_sources(app PRIVATE src/main.c)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
CONFIG_PSA_CRYPTO_DRIVER_OBERON=n
7+
CONFIG_PSA_CRYPTO_DRIVER_CRACEN=y
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY=y
7+
CONFIG_PSA_WANT_ALG_ECDSA=y
8+
CONFIG_PSA_WANT_ECC_SECP_R1_256=y
9+
CONFIG_PSA_WANT_ALG_SHA_256=y
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
CONFIG_PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY=y
7+
CONFIG_PSA_WANT_ALG_PURE_EDDSA=y
8+
CONFIG_PSA_WANT_ECC_TWISTED_EDWARDS_255=y
9+
CONFIG_PSA_WANT_ALG_SHA_512=y
10+
CONFIG_PSA_CORE_LITE_NSIB_ED25519_OPTIMIZATIONS=y
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
CONFIG_PSA_WANT_AES_KEY_SIZE_256=y
7+
CONFIG_PSA_WANT_KEY_TYPE_AES=y
8+
CONFIG_PSA_WANT_ALG_CTR=y
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
CONFIG_PSA_CORE_LITE=y
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
CONFIG_PSA_WANT_GENERATE_RANDOM=y
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
CONFIG_ZTEST=y
7+
8+
# The Zephyr CMSIS emulation assumes that ticks are ms, currently
9+
CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000
10+
11+
CONFIG_MAIN_STACK_SIZE=8192
12+
CONFIG_HEAP_MEM_POOL_SIZE=8192
13+
14+
# Enable logging
15+
CONFIG_CONSOLE=y
16+
CONFIG_LOG=y
17+
18+
# Enable nordic security backend and PSA APIs
19+
CONFIG_NRF_SECURITY=y
20+
CONFIG_MBEDTLS_PSA_CRYPTO_C=y

0 commit comments

Comments
 (0)