Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nRF54L: Add new entropy driver based on the CRACEN HW #83972

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

aescolar
Copy link
Member

@aescolar aescolar commented Jan 14, 2025

Add new entropy driver based on the CRACEN HW, and the incoming (in a PR) CRACEN CTR DRBG driver.
It also pulls new HW models to be able to use it and test it in simulation.

Note: The PR points the nRF HW models to a branch where the new HAL is forcefully enabled (ahead of its release).

@zephyrbot
Copy link
Collaborator

zephyrbot commented Jan 14, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
hal_nordic zephyrproject-rtos/hal_nordic@ecea8cd (master) zephyrproject-rtos/hal_nordic#272 zephyrproject-rtos/hal_nordic#272/files
nrf_hw_models zephyrproject-rtos/nrf_hw_models@71bcaa8 zephyrproject-rtos/nrf_hw_models@f6d4d3f (zephyr_2025_01_14) zephyrproject-rtos/[email protected]

DNM label due to: 1 project with PR revision

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@zephyrbot zephyrbot added manifest manifest-hal_nordic manifest-nrf_hw_models DNM This PR should not be merged (Do Not Merge) labels Jan 14, 2025
@aescolar aescolar requested a review from anangl January 14, 2025 16:16
@aescolar aescolar force-pushed the cracen_rng branch 3 times, most recently from e3b2096 to 74e9b52 Compare January 15, 2025 09:14
# SPDX-License-Identifier: Apache-2.0

description: |
Nordic nRF54L CRACEN CTR DRBG based (Random Number Generator)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Nordic nRF54L CRACEN CTR DRBG based (Random Number Generator)
Nordic nRF54L CRACEN CTR_DRBG based (Random Number Generator)

CTR_DRBG is the correct naming convention according to NIST SP800-90A

# SPDX-License-Identifier: Apache-2.0

config ENTROPY_NRF54LCRACEN_CTRDRBG
bool "nRF54L entropy driver based on the CRACEN CTR DRBG driver"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bool "nRF54L entropy driver based on the CRACEN CTR DRBG driver"
bool "nRF54L entropy driver based on the CRACEN CTR_DRBG driver"

CTR_DRBG is the correct naming convention according to NIST SP800-90A

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess all CTRDRBG and ctrdrbg be CTR_DRBG and ctr_drbg, too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK we cannot have "_" in DTS names. Anyhow, the name is long enough, so I hope it is ok without it there :)

# SPDX-License-Identifier: Apache-2.0

config ENTROPY_NRF54LCRACEN_CTRDRBG
bool "nRF54L entropy driver based on the CRACEN CTR DRBG driver"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess all CTRDRBG and ctrdrbg be CTR_DRBG and ctr_drbg, too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rettichschnidi
Copy link
Contributor

rettichschnidi commented Jan 16, 2025

At Gardena, @cmair will test this PR using an internal prototype. Since he is not (yet?) part of the Zephyr organization, he will give feedback himself, but I'll approve the PR in his name.

Update with the latest nordic hal

Signed-off-by: Alberto Escolar Piedras <[email protected]>
Update the HW models module to:
1069743a7fc06362e8f8d7f57225b8c7940da9f0

Including the following:
1069743 Fix in cracen hal conditional compile condition
3bbd3bd Enable build of hal/nrf_cracen_*.c
506da1f hal cracen_cm: Add const to prototype
b02d927 BLECrypt_if: For new aes_ecb scramble data if no libCrypto
e41f101 RRAMC nrf hal: Add replacements for new incoming RRAM APIs
4e933cf UART: Do not warn on invalid/unconfigured framesize
716b20c hal cracen_cm: Add replacements for new cracen_cm hal
fc597a4 CRACEN: Add CryptoMaster & CM AES (ECB only)
129f16c CRACEN RNG HAL: Remove senseless static inline

Signed-off-by: Alberto Escolar Piedras <[email protected]>
Update the HW models to the provisional branch zephyr_2025_01_14
which enables the use the not yet released CRACEN RNG & CM HAL

Signed-off-by: Alberto Escolar Piedras <[email protected]>
Add support for the new nrf hal CRACEN CTR DRBG driver including a new
kconfig option to enable it.

Signed-off-by: Alberto Escolar Piedras <[email protected]>
Add a new entropy driver based on the nrf HAL CRACEN CTR DRBG driver

Signed-off-by: Alberto Escolar Piedras <[email protected]>
Let's default to this new driver.
And therefore change the conditions in the BT controller kconfig
which were selecting the native_posix fake entropy driver

Signed-off-by: Alberto Escolar Piedras <[email protected]>

(f) boards nrf54l15bsim: Default to new cracen rng driver
Switch the default entropy driver for 54L05/10/15 devices to the new
CRACEN based one.

Signed-off-by: Alberto Escolar Piedras <[email protected]>
Use the new entropy driver for 54L devices and therefore
claim BT_CTLR_ENTROPY_SUPPORT is always supported
(note 54H remains unsuported)

Signed-off-by: Alberto Escolar Piedras <[email protected]>
@@ -25,6 +25,10 @@ config NRFX_COMP
bool "COMP driver"
depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_COMP))

config NRFX_CRACEN
bool "CRACEN drivers"
depends on SOC_COMPATIBLE_NRF54LX
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should depend on DT.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no device tree node today for cracen itself. I could create one, but it really is just extra steps.

Comment on lines +7 to +10
This driver is only compatible with 54L devices, and may only be used from one processor
core. This driver cannot be used in conjunction with the nRF security PSA solution, as both
would attempt to use the CRACEN HW exclusively; When that is enabled, zephyr,psa-crypto-rng
should be selected instead.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if driver constraints should be included in binding description.
Perhaps it would be better to note that this node is used to describe a subset of CRACEN resources, ie. CRACEN TRNG and CryptoMaster.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it would be better to note that this node is used to describe a subset of CRACEN resources, ie. CRACEN TRNG and CryptoMaster.

This binding is used to describe the CTR_DRBG itself. Not the TRNG or Cryptomaster.

would attempt to use the CRACEN HW exclusively; When that is enabled, zephyr,psa-crypto-rng
should be selected instead.

compatible: "nordic,nrf54lcracen-ctrdrbg"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
compatible: "nordic,nrf54lcracen-ctrdrbg"
compatible: "nordic,cracen-ctrdrbg"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be renamed to drivers/entropy/entropy_nrfx_cracen.c and namespaces aligned.

bool "nRF54L entropy driver based on the CRACEN CTR_DRBG driver"
default y
depends on DT_HAS_NORDIC_NRF54LCRACEN_CTRDRBG_ENABLED
depends on SOC_COMPATIBLE_NRF54LX
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
depends on SOC_COMPATIBLE_NRF54LX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants