Skip to content

Commit 3ebf609

Browse files
Vge0rgecvinayak
authored andcommitted
nrf_security: Add experimental legacy and PSA
Add experimental symbol for legacy and PSA crypto usage. This feature might be removed without notice and should not be used in production. Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
1 parent 6b30418 commit 3ebf609

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

subsys/nrf_security/Kconfig

+30
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,36 @@ config NRF_SECURITY
4444
Set this configuration to enable nRF Security. This provides
4545
Arm PSA cryptography APIs with RNG support (optionally).
4646

47+
config NRF_SECURITY_LEGACY_AND_PSA
48+
bool
49+
default y
50+
select EXPERIMENTAL
51+
depends on MBEDTLS_LEGACY_CRYPTO_C && MBEDTLS_PSA_CRYPTO_C
52+
# This configuration doesn't affect TF-M builds since the PSA
53+
# APIs are provided by TF-M.
54+
# When this configuration is enabled we manually enable
55+
# some symbols in the build_config.h file in the Oberon PSA core.
56+
# This requires only the Oberon PSA crypto driver to be enabled,
57+
# it requires the CC3XX platform library to get random data and
58+
# the trusted storage for ITS support. The depenedencies here
59+
# match what we enable in the build_config.h file so if we need to
60+
# modify the dependencies here we also need to modify the build_config.h.
61+
depends on PSA_CRYPTO_DRIVER_OBERON && !PSA_CRYPTO_DRIVER_CC3XX
62+
depends on NRF_CC3XX_PLATFORM
63+
depends on TRUSTED_STORAGE
64+
depends on !BUILD_WITH_TFM
65+
help
66+
This is an option to support legacy mbedTLS and PSA crypto APIs
67+
at the same time. This is not recommended as it is not fully
68+
supported in our system. This feature might get changed/removed at
69+
any time in the future. You are advised to use the PSA APIs
70+
for any new developments.
71+
72+
This option doesn't use the nrf_security for the internal
73+
PSA configuration. It always use the Oberon PSA driver
74+
for all the crypto operations expect for the PRNG which
75+
uses the nrf_cc3xx_platform library.
76+
4777
config PSA_PROMPTLESS
4878
bool
4979

subsys/nrf_security/src/drivers/nrf_oberon/CMakeLists.txt

+32
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ if(CONFIG_MBEDTLS_PSA_CRYPTO_C)
2424
)
2525
endif()
2626

27+
if (COMPILE_PSA_APIS OR CONFIG_NRF_SECURITY_LEGACY_AND_PSA)
28+
2729
if (COMPILE_PSA_APIS)
2830
list(APPEND src_crypto_oberon
2931
${drivers_path}/oberon_helpers.c
@@ -55,6 +57,35 @@ if (COMPILE_PSA_APIS)
5557
append_with_prefix_ifdef(CONFIG_PSA_NEED_OBERON_CTR_DRBG_DRIVER src_crypto_oberon ${drivers_path} oberon_ctr_drbg.c)
5658
append_with_prefix_ifdef(CONFIG_PSA_NEED_OBERON_HMAC_DRBG_DRIVER src_crypto_oberon ${drivers_path} oberon_hmac_drbg.c)
5759

60+
61+
elseif(CONFIG_NRF_SECURITY_LEGACY_AND_PSA)
62+
# When legacy and PSA are enabled, we need to include all the oberon drivers
63+
# since we don't have PSA_NEED_* symbols in Kconfig.
64+
list(APPEND src_crypto_oberon
65+
${drivers_path}/oberon_helpers.c
66+
${drivers_path}/oberon_ecdh.c
67+
${drivers_path}/oberon_ecdsa.c
68+
${drivers_path}/oberon_ec_keys.c
69+
${drivers_path}/oberon_jpake.c
70+
${drivers_path}/oberon_spake2p.c
71+
${drivers_path}/oberon_srp.c
72+
${drivers_path}/oberon_rsa.c
73+
${drivers_path}/oberon_key_management.c
74+
${drivers_path}/oberon_aead.c
75+
${drivers_path}/oberon_key_derivation.c
76+
${drivers_path}/oberon_mac.c
77+
${drivers_path}/oberon_cipher.c
78+
${drivers_path}/oberon_hash.c
79+
${drivers_path}/oberon_key_agreement.c
80+
${drivers_path}/oberon_pake.c
81+
${drivers_path}/oberon_asymmetric_signature.c
82+
${drivers_path}/oberon_asymmetric_encrypt.c
83+
${drivers_path}/oberon_ctr_drbg.c
84+
${drivers_path}/oberon_hmac_drbg.c)
85+
86+
87+
endif()
88+
5889
target_sources(${mbedcrypto_target} PRIVATE ${src_crypto_oberon})
5990

6091
# Turn off warnings that Oberon are systematically
@@ -66,4 +97,5 @@ if (COMPILE_PSA_APIS)
6697
-Wno-uninitialized
6798
-Wno-maybe-uninitialized
6899
)
100+
69101
endif()

0 commit comments

Comments
 (0)