From 210f7d8ea3166dc7bb13e55960241bb4bf823cf4 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Tue, 8 Oct 2024 10:51:18 +0200 Subject: [PATCH 1/4] manifest: Zephyr with removed Nordic PSA_WANTs The Nordic only PSA_WANTs are moved from Zephyr to nrf_security to reduce the noup commits in sdk-zephyr. Signed-off-by: Georgios Vasilakis --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 3e99f7582f8..19f1327a318 100644 --- a/west.yml +++ b/west.yml @@ -72,7 +72,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: 8ceab93c866d584201621703dee15a77107e7363 + revision: be00e5a236d2cd71583a36e4c93cb3400a2faff0 import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above From 3f4d254e01c0e9bf682fdd38bcdc007522546843 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Tue, 15 Oct 2024 13:19:17 +0200 Subject: [PATCH 2/4] nrf_security: Add Nordic PSA WANTs in nrf_security To avoid noup commits in Zephyr. Signed-off-by: Georgios Vasilakis --- subsys/nrf_security/Kconfig | 3 + subsys/nrf_security/Kconfig.psa.nordic | 394 +++++++++++++++++++++++++ 2 files changed, 397 insertions(+) create mode 100644 subsys/nrf_security/Kconfig.psa.nordic diff --git a/subsys/nrf_security/Kconfig b/subsys/nrf_security/Kconfig index deb76568892..dd451efc809 100644 --- a/subsys/nrf_security/Kconfig +++ b/subsys/nrf_security/Kconfig @@ -48,6 +48,9 @@ config NRF_SECURITY Set this configuration to enable nRF Security. This provides Arm PSA cryptography APIs with RNG support (optionally). +# Include Nordic-only PSA configurations +rsource "Kconfig.psa.nordic" + config PSA_PROMPTLESS bool diff --git a/subsys/nrf_security/Kconfig.psa.nordic b/subsys/nrf_security/Kconfig.psa.nordic new file mode 100644 index 00000000000..bcbf1078393 --- /dev/null +++ b/subsys/nrf_security/Kconfig.psa.nordic @@ -0,0 +1,394 @@ +# +# Copyright (c) 2024 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +comment "Nordic-added meta types" + +config PSA_HAS_AEAD_SUPPORT + bool + default y + depends on PSA_WANT_ALG_CCM || \ + PSA_WANT_ALG_GCM || \ + PSA_WANT_ALG_CHACHA20_POLY1305 + help + Prompt-less configuration that states that AEAD is supported. + +config PSA_HAS_ASYM_ENCRYPT_SUPPORT + bool + default y + depends on PSA_WANT_ALG_RSA_OAEP || \ + PSA_WANT_ALG_RSA_PKCS1V15_CRYPT + help + Prompt-less configuration that states that asymmetric encryption + is supported. + +config PSA_HAS_ASYM_SIGN_SUPPORT + bool + default y + depends on PSA_WANT_ALG_DETERMINISTIC_ECDSA || \ + PSA_WANT_ALG_ECDSA || \ + PSA_WANT_ALG_ECDSA_ANY || \ + PSA_WANT_ALG_ED25519PH || \ + PSA_WANT_ALG_ED448PH || \ + PSA_WANT_ALG_PURE_EDDSA || \ + PSA_WANT_ALG_RSA_PKCS1V15_SIGN || \ + PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW || \ + PSA_WANT_ALG_RSA_PSS || \ + PSA_WANT_ALG_RSA_PSS_ANY_SALT + help + Prompt-less configuration that states that asymmetric signing + is supported. + +config PSA_HAS_CIPHER_SUPPORT + bool + default y + depends on PSA_WANT_ALG_ECB_NO_PADDING || \ + PSA_WANT_ALG_CBC_NO_PADDING || \ + PSA_WANT_ALG_CBC_PKCS7 || \ + PSA_WANT_ALG_CCM_STAR_NO_TAG || \ + PSA_WANT_ALG_CTR || \ + PSA_WANT_ALG_XTS || \ + PSA_WANT_ALG_STREAM_CIPHER + help + Prompt-less configuration that states that cipher is supported. + +config PSA_HAS_HASH_SUPPORT + bool + default y + depends on PSA_WANT_ALG_MD5 || \ + PSA_WANT_ALG_SHA_1 || \ + PSA_WANT_ALG_SHA_224 || \ + PSA_WANT_ALG_SHA_256 || \ + PSA_WANT_ALG_SHA_384 || \ + PSA_WANT_ALG_SHA_512 || \ + PSA_WANT_ALG_SHA_512_224 || \ + PSA_WANT_ALG_SHA_512_256 || \ + PSA_WANT_ALG_SHA3_224 || \ + PSA_WANT_ALG_SHA3_256 || \ + PSA_WANT_ALG_SHA3_384 || \ + PSA_WANT_ALG_SHA3_512 + help + Prompt-less configuration that states that hash is supported. + +config PSA_HAS_KEY_AGREEMENT + bool + default y + depends on PSA_WANT_ALG_ECDH + help + Promt-less configuration that states that key agreement is supported. + +config PSA_HAS_KEY_DERIVATION + bool + default y + depends on PSA_WANT_ALG_HKDF || \ + PSA_WANT_ALG_HKDF_EXPAND || \ + PSA_WANT_ALG_HKDF_EXTRACT || \ + PSA_WANT_ALG_PBKDF2_HMAC || \ + PSA_WANT_ALG_PBKDF2_AES_CMAC_PRF_128 || \ + PSA_WANT_ALG_TLS12_PRF || \ + PSA_WANT_ALG_TLS12_PSK_TO_MS || \ + PSA_WANT_ALG_TLS12_ECJPAKE_TO_PMS + help + Prompt-less configuration that states that key derivation is supported. + +config PSA_HAS_KEY_SUPPORT + bool + default y + depends on PSA_WANT_KEY_TYPE_AES || \ + PSA_WANT_KEY_TYPE_CHACHA20 || \ + PSA_WANT_KEY_TYPE_DERIVE || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_GENERATE || \ + PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_DERIVE || \ + PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_HMAC || \ + PSA_WANT_KEY_TYPE_PASSWORD || \ + PSA_WANT_KEY_TYPE_PASSWORD_HASH || \ + PSA_WANT_KEY_TYPE_PEPPER || \ + PSA_WANT_KEY_TYPE_RAW_DATA || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE || \ + PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_DERIVE || \ + PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_GENERATE || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_DERIVE || \ + PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_GENERATE || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_DERIVE || \ + PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + help + Prompt-less configuration that states that key types are supported. + +config PSA_HAS_MAC_SUPPORT + bool + default y + depends on PSA_WANT_ALG_CMAC || \ + PSA_WANT_ALG_HMAC + help + Prompt-less configuration that states that MAC is supported. + +config PSA_HAS_PAKE_SUPPORT + bool + default y + depends on PSA_WANT_ALG_JPAKE || \ + PSA_WANT_ALG_SPAKE2P_HMAC || \ + PSA_WANT_ALG_SPAKE2P_CMAC || \ + PSA_WANT_ALG_SPAKE2P_MATTER || \ + PSA_WANT_ALG_SRP_6 || \ + PSA_WANT_ALG_SRP_PASSWORD_HASH + help + Prompt-less configuration that states that PAKE is supported. + +comment "Nordic added alg types" + +config PSA_WANT_ALG_ECDSA_ANY + bool "PSA ECDSA support, without hashing" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_ED25519PH + bool "PSA ED25519PH support" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_ED448PH + bool "PSA ED448PH support" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_PURE_EDDSA + bool "PSA PURE_EDDSA support" if !PSA_PROMPTLESS + +config PSA_WANT_ALG_RSA_PKCS1V15_SIGN_RAW + bool "PSA RSA raw PKCS#1 v1.5 message signature support, without hashing)" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_RSA_PSS_ANY_SALT + bool "PSA RSA PSS message signature support, any salt length" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_SHA_512_224 + bool "PSA SHA-512/224 support" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_SHA_512_256 + bool "PSA SHA-512/256 support" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_SPAKE2P_HMAC + bool "PSA SPAKE2+ HMAC support" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_SPAKE2P_CMAC + bool "PSA SPAKE2+ CMAC support" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_SPAKE2P_MATTER + bool "PSA SPAKE2+ MATTER support" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_SP800_108_COUNTER_HMAC + bool "Add PSA SP800-108r1 CTR HMAC KBKDF support" + default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_HMAC + +config PSA_WANT_ALG_SP800_108_COUNTER_CMAC + bool "Add PSA SP800-108r1 CTR CMAC KBKDF support" + default y if PSA_CRYPTO_ENABLE_ALL + depends on PSA_WANT_ALG_CMAC + +config PSA_WANT_ALG_SRP_6 + bool "PSA SRP-6 support" if !PSA_PROMPTLESS + select EXPERIMENTAL + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_SRP_PASSWORD_HASH + bool "PSA SRP password hash support" if !PSA_PROMPTLESS + select EXPERIMENTAL + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_XTS + bool "PSA XTS block cipher mode support" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +comment "Nordic added ECC curve types" + +config PSA_WANT_ECC_BRAINPOOL_P_R1_160 + bool "PSA ECC BrainpoolP160r1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 160-bit curve brainpoolP160r1 is weak and deprecated and + is only recommended for use in legacy protocols. + +config PSA_WANT_ECC_BRAINPOOL_P_R1_192 + bool "PSA ECC BrainpoolP192r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_224 + bool "PSA ECC BrainpoolP224r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_BRAINPOOL_P_R1_320 + bool "PSA ECC BrainpoolP320r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_TWISTED_EDWARDS_255 + bool "PSA ECC Edwards25519 (Ed25519) support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_TWISTED_EDWARDS_448 + bool "PSA ECC Edwards448 (Ed448) support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_K1_224 + bool "PSA ECC secp224k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECP_R2_160 + bool "PSA ECC secp160r2 support (weak)" if !PSA_PROMPTLESS + help + Warning: his family of curves is weak and deprecated. + +config PSA_WANT_ECC_SECT_K1_163 + bool "PSA ECC sect163k1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 163-bit curve sect163k1 is weak and deprecated and is + only recommended for use in legacy protocols. + +config PSA_WANT_ECC_SECT_K1_233 + bool "PSA ECC sect233k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_239 + bool "PSA ECC sect239k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_283 + bool "PSA ECC sect283k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_409 + bool "PSA ECC sect409k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_K1_571 + bool "PSA ECC sect571k1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_163 + bool "PSA ECC sect163r1 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 163-bit curve sect163r1 is weak and deprecated and is + only recommended for use in legacy protocols. + +config PSA_WANT_ECC_SECT_R1_233 + bool "PSA ECC sect233r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_283 + bool "PSA ECC sect283r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_409 + bool "PSA ECC sect409r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R1_571 + bool "PSA ECC sect571r1 support" if !PSA_PROMPTLESS + +config PSA_WANT_ECC_SECT_R2_163 + bool "PSA ECC sect163r2 support (weak)" if !PSA_PROMPTLESS + help + Warning: The 163-bit curve sect163r2 is weak and deprecated and is + only recommended for use in legacy protocols. + +config PSA_WANT_ECC_FRP_V1_256 + bool "PSA ECC FRP256v1 support" if !PSA_PROMPTLESS + +comment "Nordic addded RNG configuration" + +config PSA_WANT_GENERATE_RANDOM + bool "PSA RNG support" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +comment "Nordic added key types" + +config PSA_WANT_KEY_TYPE_PEPPER + bool "PSA pepper key type support" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_GENERATE || \ + PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_DERIVE + help + SPAKE2+ key pair: Basic key support + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_IMPORT + bool "SPAKE2+ key pair import support" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + default y if PSA_CRYPTO_ENABLE_ALL + help + SPAKE2+ key pair: Import key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_EXPORT + bool "SPAKE2+ key pair export support" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + default y if PSA_CRYPTO_ENABLE_ALL + help + SPAKE2+ key pair: Export key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_GENERATE + bool "SPAKE2+ key pair generate support" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + default y if PSA_CRYPTO_ENABLE_ALL + help + SPAKE2+ key pair: Generate key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_KEY_PAIR_DERIVE + bool "SPAKE2+ key pair derive support" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + default y if PSA_CRYPTO_ENABLE_ALL + help + SPAKE2+ key pair: Derive key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SPAKE2P_PUBLIC_KEY + bool "SPAKE2+ public key support" if !MBEDTLS_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + help + SPAKE2+ public key support. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_BASIC + bool + default y + depends on PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_IMPORT || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_EXPORT || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_GENERATE || \ + PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_DERIVE + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_IMPORT + bool "SRP key pair import support" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + default y if PSA_CRYPTO_ENABLE_ALL + help + SRP key pair: import key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_EXPORT + bool "SRP key pair export support" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + default y if PSA_CRYPTO_ENABLE_ALL + help + SRP key pair: export key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_GENERATE + bool "SRP key pair export support" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + default y if PSA_CRYPTO_ENABLE_ALL + help + SRP key pair: export key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SRP_KEY_PAIR_DERIVE + bool "SRP key pair derive support" if !MBEDTLS_PROMPTLESS + select PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + default y if PSA_CRYPTO_ENABLE_ALL + help + SRP key pair: derive key for both the private and public key. + +config PSA_WANT_KEY_TYPE_SRP_PUBLIC_KEY + bool "SRP public key support" if !MBEDTLS_PROMPTLESS + help + SRP public key support. From 1ac8ed81bee3f604edeb1252a0294887f4f95493 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Tue, 8 Oct 2024 10:49:14 +0200 Subject: [PATCH 3/4] nrf_security: Move PSA_WANTS from drivers Kconfig Move some PSA_WANTs from the drivers Kconfig in nrf_security to the Kconfig file which contains the rest of the PSA_WANT configurations. During the upmerge support for OFB and CFB modes of AES was removed so here we remove the relevant code in the drivers as well. Signed-off-by: Georgios Vasilakis --- .../nrf_security/doc/driver_config.rst | 8 -- subsys/nrf_security/Kconfig | 2 - subsys/nrf_security/Kconfig.psa.nordic | 8 ++ subsys/nrf_security/src/drivers/Kconfig | 12 --- .../drivers/cracen/cracenpsa/src/blkcipher.c | 15 --- .../src/drivers/cracen/psa_driver.Kconfig | 12 --- .../sxsymcrypt/include/sxsymcrypt/aes.h | 100 ------------------ .../sxsymcrypt/include/sxsymcrypt/blkcipher.h | 2 - .../drivers/cracen/sxsymcrypt/src/blkcipher.c | 32 ------ .../cracen/sxsymcrypt/src/blkcipherdefs.h | 2 - .../src/drivers/nrf_cc3xx/Kconfig | 12 --- 11 files changed, 8 insertions(+), 197 deletions(-) diff --git a/doc/nrf/libraries/security/nrf_security/doc/driver_config.rst b/doc/nrf/libraries/security/nrf_security/doc/driver_config.rst index 8495f3c0d86..75945472b69 100644 --- a/doc/nrf/libraries/security/nrf_security/doc/driver_config.rst +++ b/doc/nrf/libraries/security/nrf_security/doc/driver_config.rst @@ -122,12 +122,8 @@ To enable cipher modes, set one or more of the Kconfig options in the following +-----------------------+------------------------------------------------------+ | CBC PKCS#7 padding | :kconfig:option:`CONFIG_PSA_WANT_ALG_CBC_PKCS7` | +-----------------------+------------------------------------------------------+ -| CFB | :kconfig:option:`CONFIG_PSA_WANT_ALG_CFB` | -+-----------------------+------------------------------------------------------+ | CTR | :kconfig:option:`CONFIG_PSA_WANT_ALG_CTR` | +-----------------------+------------------------------------------------------+ -| OFB | :kconfig:option:`CONFIG_PSA_WANT_ALG_OFB` | -+-----------------------+------------------------------------------------------+ | CCM* no tag | :kconfig:option:`CONFIG_PSA_WANT_ALG_CCM_STAR_NO_TAG`| +-----------------------+------------------------------------------------------+ | XTS | :kconfig:option:`CONFIG_PSA_WANT_ALG_XTS` | @@ -149,12 +145,8 @@ The following table shows cipher algorithm support for each driver: +-----------------------+---------------------------+----------------------------+---------------------------+ | CBC PKCS#7 padding | Supported | Supported | Supported | +-----------------------+---------------------------+----------------------------+---------------------------+ -| CFB | Not supported | Not supported | Not supported | -+-----------------------+---------------------------+----------------------------+---------------------------+ | CTR | Supported | Supported | Supported | +-----------------------+---------------------------+----------------------------+---------------------------+ -| OFB | Supported | Not supported | Supported | -+-----------------------+---------------------------+----------------------------+---------------------------+ | CCM* no tag | Not supported | Supported | Not supported | +-----------------------+---------------------------+----------------------------+---------------------------+ | XTS | Not supported | Not supported | Not supported | diff --git a/subsys/nrf_security/Kconfig b/subsys/nrf_security/Kconfig index dd451efc809..ee69e589577 100644 --- a/subsys/nrf_security/Kconfig +++ b/subsys/nrf_security/Kconfig @@ -193,9 +193,7 @@ config MBEDTLS_CIPHER_ALL_ENABLED select PSA_WANT_ALG_ECB_NO_PADDING select PSA_WANT_ALG_CBC_NO_PADDING select PSA_WANT_ALG_CBC_PKCS7 - select PSA_WANT_ALG_CFB select PSA_WANT_ALG_CTR - select PSA_WANT_ALG_OFB select PSA_WANT_ALG_CCM select PSA_WANT_ALG_GCM select PSA_WANT_KEY_TYPE_CHACHA20 diff --git a/subsys/nrf_security/Kconfig.psa.nordic b/subsys/nrf_security/Kconfig.psa.nordic index bcbf1078393..21074e56208 100644 --- a/subsys/nrf_security/Kconfig.psa.nordic +++ b/subsys/nrf_security/Kconfig.psa.nordic @@ -296,6 +296,14 @@ config PSA_WANT_ECC_SECT_R2_163 config PSA_WANT_ECC_FRP_V1_256 bool "PSA ECC FRP256v1 support" if !PSA_PROMPTLESS +config PSA_WANT_ALG_CHACHA20 + bool "PSA CHACHA20 stream cipher support" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + +config PSA_WANT_ALG_SHAKE256_512 + bool "PSA SHAKE256 512 bits support" if !PSA_PROMPTLESS + default y if PSA_CRYPTO_ENABLE_ALL + comment "Nordic addded RNG configuration" config PSA_WANT_GENERATE_RANDOM diff --git a/subsys/nrf_security/src/drivers/Kconfig b/subsys/nrf_security/src/drivers/Kconfig index f13b735ab15..5581badb09a 100644 --- a/subsys/nrf_security/src/drivers/Kconfig +++ b/subsys/nrf_security/src/drivers/Kconfig @@ -59,18 +59,6 @@ config PSA_USE_HMAC_DRBG_DRIVER endmenu -config PSA_WANT_ALG_CFB - bool "PSA stream cipher using CFB block cipher mode support" - -config PSA_WANT_ALG_OFB - bool "PSA stream cipher using OFB block cipher mode support" - -config PSA_WANT_ALG_CHACHA20 - bool "PSA stream cipher using CHACHA20 support" - -config PSA_WANT_ALG_SHAKE256_512 - bool "PSA SHAKE256 512 bits support" - menu "CryptoCell PSA Driver Configuration" if PSA_CRYPTO_DRIVER_CC3XX diff --git a/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/blkcipher.c b/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/blkcipher.c index f148e68e4ce..1862ca6b796 100644 --- a/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/blkcipher.c +++ b/subsys/nrf_security/src/drivers/cracen/cracenpsa/src/blkcipher.c @@ -228,10 +228,6 @@ static bool is_alg_supported(psa_algorithm_t alg, const psa_key_attributes_t *at IF_ENABLED(PSA_NEED_CRACEN_ECB_NO_PADDING_AES, (is_supported = psa_get_key_type(attributes) == PSA_KEY_TYPE_AES)); break; - case PSA_ALG_OFB: - IF_ENABLED(PSA_NEED_CRACEN_OFB_AES, - (is_supported = psa_get_key_type(attributes) == PSA_KEY_TYPE_AES)); - break; default: is_supported = false; break; @@ -267,17 +263,6 @@ static psa_status_t initialize_cipher(cracen_cipher_operation_t *operation) operation->iv); } break; - case PSA_ALG_OFB: - if (IS_ENABLED(PSA_NEED_CRACEN_OFB_AES)) { - sx_status = operation->dir == CRACEN_DECRYPT - ? sx_blkcipher_create_aesofb_dec(&operation->cipher, - &operation->keyref, - operation->iv) - : sx_blkcipher_create_aesofb_enc(&operation->cipher, - &operation->keyref, - operation->iv); - } - break; case PSA_ALG_CTR: if (IS_ENABLED(PSA_NEED_CRACEN_CTR_AES)) { sx_status = operation->dir == CRACEN_DECRYPT diff --git a/subsys/nrf_security/src/drivers/cracen/psa_driver.Kconfig b/subsys/nrf_security/src/drivers/cracen/psa_driver.Kconfig index 82419e74a8f..4e6c9b9a72a 100644 --- a/subsys/nrf_security/src/drivers/cracen/psa_driver.Kconfig +++ b/subsys/nrf_security/src/drivers/cracen/psa_driver.Kconfig @@ -89,17 +89,6 @@ config PSA_NEED_CRACEN_ECB_NO_PADDING_AES depends on PSA_WANT_KEY_TYPE_AES depends on PSA_USE_CRACEN_CIPHER_DRIVER -config PSA_NEED_CRACEN_OFB_AES - bool - default y - select PSA_ACCEL_OFB_AES_128 - select PSA_ACCEL_OFB_AES_192 - select PSA_ACCEL_OFB_AES_256 - depends on PSA_WANT_AES_KEY_SIZE_128 || PSA_WANT_AES_KEY_SIZE_192 || PSA_WANT_AES_KEY_SIZE_256 - depends on PSA_WANT_ALG_OFB - depends on PSA_WANT_KEY_TYPE_AES - depends on PSA_USE_CRACEN_CIPHER_DRIVER - config PSA_NEED_CRACEN_STREAM_CIPHER_CHACHA20 bool default y @@ -116,7 +105,6 @@ config PSA_NEED_CRACEN_CIPHER_DRIVER PSA_NEED_CRACEN_CBC_PKCS7_AES || \ PSA_NEED_CRACEN_CBC_NO_PADDING_AES || \ PSA_NEED_CRACEN_ECB_NO_PADDING_AES || \ - PSA_NEED_CRACEN_OFB_AES || \ PSA_NEED_CRACEN_STREAM_CIPHER_CHACHA20 # CRACEN Key Agreement Driver diff --git a/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/aes.h b/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/aes.h index ebfa1a9f042..9fc2c251947 100644 --- a/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/aes.h +++ b/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/aes.h @@ -232,106 +232,6 @@ int sx_blkcipher_create_aescbc_enc(struct sxblkcipher *c, const struct sxkeyref int sx_blkcipher_create_aescbc_dec(struct sxblkcipher *c, const struct sxkeyref *key, const char *iv); -/** Prepares an AES CFB block cipher encryption. - * - * This function initializes the user allocated object \p c with a new block - * cipher operation context needed to run the AES CFB encryption and reserves - * the HW resource. - * - * After successful execution of this function, the context \p c can be passed - * to any of the block cipher functions. - * - * @param[out] c block cipher operation context - * @param[in] key key used for the block cipher operation, expected size - * 16, 24 or 32 bytes - * @param[in] iv initialization vector, size must be 16 bytes - * @return ::SX_OK - * @return ::SX_ERR_INVALID_KEYREF - * @return ::SX_ERR_INVALID_KEY_SZ - * @return ::SX_ERR_INCOMPATIBLE_HW - * @return ::SX_ERR_RETRY - * - * @pre - key reference provided by \p key must be initialized using - * sx_keyref_load_material() or sx_keyref_load_by_id() - */ -int sx_blkcipher_create_aescfb_enc(struct sxblkcipher *c, const struct sxkeyref *key, - const char *iv); - -/** Prepares an AES CFB block cipher decryption - * - * This function initializes the user allocated object \p c with a new block - * cipher operation context needed to run the AES CFB decryption and reserves - * the HW resource. - * - * After successful execution of this function, the context \p c can be passed - * to any of the block cipher functions. - * - * @param[out] c block cipher operation context - * @param[in] key key used for the block cipher operation, expected size - * 16, 24 or 32 bytes - * @param[in] iv initialization vector, size must be 16 bytes - * @return ::SX_OK - * @return ::SX_ERR_INVALID_KEYREF - * @return ::SX_ERR_INVALID_KEY_SZ - * @return ::SX_ERR_INCOMPATIBLE_HW - * @return ::SX_ERR_RETRY - * - * @pre - key reference provided by \p key must be initialized using - * sx_keyref_load_material() or sx_keyref_load_by_id() - */ -int sx_blkcipher_create_aescfb_dec(struct sxblkcipher *c, const struct sxkeyref *key, - const char *iv); - -/** Prepares an AES OFB block cipher encryption. - * - * This function initializes the user allocated object \p c with a new block - * cipher operation context needed to run the AES OFB encryption and reserves - * the HW resource. - * - * After successful execution of this function, the context \p c can be passed - * to any of the block cipher functions. - * - * @param[out] c block cipher operation context - * @param[in] key key used for the block cipher operation, expected size - * 16, 24 or 32 bytes - * @param[in] iv initialization vector, size must be 16 bytes - * @return ::SX_OK - * @return ::SX_ERR_INVALID_KEYREF - * @return ::SX_ERR_INVALID_KEY_SZ - * @return ::SX_ERR_INCOMPATIBLE_HW - * @return ::SX_ERR_RETRY - * - * @pre - key reference provided by \p key must be initialized using - * sx_keyref_load_material() or sx_keyref_load_by_id() - */ -int sx_blkcipher_create_aesofb_enc(struct sxblkcipher *c, const struct sxkeyref *key, - const char *iv); - -/** Prepares an AES OFB block cipher decryption - * - * This function initializes the user allocated object \p c with a new block - * cipher operation context needed to run the AES OFB decryption and reserves - * the HW resource. - * - * After successful execution of this function, the context \p c can be passed - * to any of the block cipher functions. - * - * @param[out] c block cipher operation context - * @param[in] key key used for the block cipher operation, expected size - * 16, 24 or 32 bytes - * @param[in] iv initialization vector, size must be 16 bytes - * @return ::SX_OK - * @return ::SX_ERR_INVALID_KEYREF - * @return ::SX_ERR_INVALID_KEY_SZ - * @return ::SX_ERR_INCOMPATIBLE_HW - * @return ::SX_ERR_RETRY - * - * @pre - key reference provided by \p key must be initialized using - * sx_keyref_load_material() or sx_keyref_load_by_id() - */ -int sx_blkcipher_create_aesofb_dec(struct sxblkcipher *c, const struct sxkeyref *key, - const char *iv); - /** Prepares an AES GCM AEAD encryption operation. * * This function initializes the user allocated object \p c with a new AEAD diff --git a/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/blkcipher.h b/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/blkcipher.h index 6a68c229f41..12f3d4a7121 100644 --- a/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/blkcipher.h +++ b/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/blkcipher.h @@ -81,8 +81,6 @@ struct sxblkcipher; * --------: | :----------: | :----------- * ECB | N * 16 bytes | N > 0 * CBC | N * 16 bytes | N > 0 - * CFB | N * 16 bytes | N > 0 - * OFB | N * 16 bytes | N > 0 * XTS | >= 16 bytes | none * CTR | > 0 bytes | none * diff --git a/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/src/blkcipher.c b/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/src/blkcipher.c index e34cc4cc1b1..d247f2a5f54 100644 --- a/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/src/blkcipher.c +++ b/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/src/blkcipher.c @@ -252,38 +252,6 @@ int sx_blkcipher_create_aescbc_dec(struct sxblkcipher *c, const struct sxkeyref return sx_blkcipher_create_aes_ba411(c, key, iv, BLKCIPHER_MODEID_CBC, ba411cfg.decr); } -int sx_blkcipher_create_aescfb_enc(struct sxblkcipher *c, const struct sxkeyref *key, - const char *iv) -{ - c->inminsz = 16; - c->granularity = 16; - return sx_blkcipher_create_aes_ba411(c, key, iv, BLKCIPHER_MODEID_CFB, ba411cfg.encr); -} - -int sx_blkcipher_create_aescfb_dec(struct sxblkcipher *c, const struct sxkeyref *key, - const char *iv) -{ - c->inminsz = 16; - c->granularity = 16; - return sx_blkcipher_create_aes_ba411(c, key, iv, BLKCIPHER_MODEID_CFB, ba411cfg.decr); -} - -int sx_blkcipher_create_aesofb_enc(struct sxblkcipher *c, const struct sxkeyref *key, - const char *iv) -{ - c->inminsz = 1; - c->granularity = 1; - return sx_blkcipher_create_aes_ba411(c, key, iv, BLKCIPHER_MODEID_OFB, ba411cfg.encr); -} - -int sx_blkcipher_create_aesofb_dec(struct sxblkcipher *c, const struct sxkeyref *key, - const char *iv) -{ - c->inminsz = 1; - c->granularity = 1; - return sx_blkcipher_create_aes_ba411(c, key, iv, BLKCIPHER_MODEID_OFB, ba411cfg.decr); -} - int sx_blkcipher_crypt(struct sxblkcipher *c, const char *datain, size_t sz, char *dataout) { if (!c->dma.hw_acquired) { diff --git a/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/src/blkcipherdefs.h b/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/src/blkcipherdefs.h index d4f448466a7..f2d91977afe 100644 --- a/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/src/blkcipherdefs.h +++ b/subsys/nrf_security/src/drivers/cracen/sxsymcrypt/src/blkcipherdefs.h @@ -14,8 +14,6 @@ #define BLKCIPHER_MODEID_ECB 0 #define BLKCIPHER_MODEID_CBC 1 #define BLKCIPHER_MODEID_CTR 2 -#define BLKCIPHER_MODEID_CFB 3 -#define BLKCIPHER_MODEID_OFB 4 #define BLKCIPHER_MODEID_XTS 7 #define BLKCIPHER_MODEID_CHACH20 8 diff --git a/subsys/nrf_security/src/drivers/nrf_cc3xx/Kconfig b/subsys/nrf_security/src/drivers/nrf_cc3xx/Kconfig index 2af92ef65dc..ad721d5ed0c 100644 --- a/subsys/nrf_security/src/drivers/nrf_cc3xx/Kconfig +++ b/subsys/nrf_security/src/drivers/nrf_cc3xx/Kconfig @@ -91,17 +91,6 @@ config PSA_NEED_CC3XX_ECB_NO_PADDING_AES depends on PSA_WANT_KEY_TYPE_AES depends on PSA_USE_CC3XX_CIPHER_DRIVER -config PSA_NEED_CC3XX_OFB_AES - bool - default y - select PSA_ACCEL_OFB_AES_128 - select PSA_ACCEL_OFB_AES_192 if HAS_HW_NRF_CC312 - select PSA_ACCEL_OFB_AES_256 if HAS_HW_NRF_CC312 - depends on PSA_WANT_AES_KEY_SIZE_128 || !HAS_HW_NRF_CC310 - depends on PSA_WANT_ALG_OFB - depends on PSA_WANT_KEY_TYPE_AES - depends on PSA_USE_CC3XX_CIPHER_DRIVER - config PSA_NEED_CC3XX_STREAM_CIPHER_CHACHA20 bool default y @@ -117,7 +106,6 @@ config PSA_NEED_CC3XX_CIPHER_DRIVER PSA_NEED_CC3XX_CBC_PKCS7_AES || \ PSA_NEED_CC3XX_CBC_NO_PADDING_AES || \ PSA_NEED_CC3XX_ECB_NO_PADDING_AES || \ - PSA_NEED_CC3XX_OFB_AES || \ PSA_NEED_CC3XX_STREAM_CIPHER_CHACHA20 # CC3xx Key Agreement Driver From 3d032b93f2ee10e39f5430e6678c69b3a96551cd Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Tue, 22 Oct 2024 10:34:58 +0200 Subject: [PATCH 4/4] chagelog: Removal of OFB and CFB Add a changelog entry to make it visible that the ciphers OFB and CFB from PSA are no longer supported. Signed-off-by: Georgios Vasilakis --- .../releases/release-notes-changelog.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst b/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst index 02eb234a9fc..5cd8c0c9cac 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst @@ -815,6 +815,13 @@ Gazell libraries |no_changes_yet_note| +Security libraries +------------------ + +* :ref:`nrf_security` library: + + * Removed the Kconfig options ``CONFIG_PSA_WANT_ALG_CFB`` and ``CONFIG_PSA_WANT_ALG_OFB`` since the Cipher Feedback (CFB) mode and the Output Feedback (OFB) mode are not tested in the test framework. + Modem libraries ---------------