Skip to content

boot: zephyr: Fix RNG/entropy being enabled by default - #2939

Merged
nordicjm merged 1 commit into
mcu-tools:mainfrom
nordicjm:fixpsarng
Nov 4, 2026
Merged

nordicjm merged 1 commit into
mcu-tools:mainfrom
nordicjm:fixpsarng

Conversation

@nordicjm

@nordicjm nordicjm commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes an issue whereby RNG/entropy in PSA crypto is enabled by default, this is not needed and just serves to slow down boot times and increase the output image size. It is only needed when FIH high mode is enabled, or when encryption is enabled, therefore leave it enabled in those modes. Users are free to override this from out of tree, if their specific crypto engines need it

This also fixes an issue whereby a Kconfig warning was emitted stating that a non-secure Kconfig was enabled, despite not actually being needed or used (unless encryption/FIH high is selected without a true entropy source, in which case it will still be emitted, validly)

@valeriosetti

@nordicjm
nordicjm requested a review from de-nordic as a code owner November 2, 2026 10:52
Comment thread boot/zephyr/Kconfig Outdated
Comment on lines +147 to +154
config MBEDTLS_ENTROPY_C
default n

config MBEDTLS_HMAC_DRBG_C
default n

config TEST_RANDOM_GENERATOR
default n

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These defaults should not be required. I tried to build with and without them and I get the same results in terms of footprint on the nrf52840dk.
Please double-check on your end, but if confirmed I would drop them.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reworked it, was missing that the test entropy source was being selected by default anyway and causing a Kconfig warning about an insecure Kconfig being selected, so fixed that, kept these because they are not needed in this mode

Comment thread boot/zephyr/Kconfig Outdated
endif # BOOT_USE_PSA_CRYPTO

# In the default mode, MCUboot uses PSA crypto for generating hashes and check signature validity,
# it does not need an entropy source as it is not generating signatures. Therefore default to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would either complete the sentence to match all the limitations related to the removal of entropy source, like this:

it does not need an entropy source as it is not generating signatures, decrypting images or using randomized instructions timing for hardening.

or just drop the final part of the sentence:

so it does not need an entropy source.

Wdyt?

That's minor though, so feel free to ignore if you deem this not to be relevant.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

Fixes an issue whereby RNG/entropy in PSA crypto is enabled by
default, this is not needed and just serves to slow down boot times
and increase the output image size. It is only needed when FIH high
mode is enabled, or when encryption is enabled, therefore leave it
enabled in those modes. Users are free to override this from out
of tree, if their specific crypto engines need it.

This also fixes an issue whereby a Kconfig warning was emitted
stating that a non-secure Kconfig was enabled, despite not
actually being needed or used (unless encryption/FIH high is
selected without a true entropy source, in which case it will
still be emitted, validly)

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
@nordicjm
nordicjm merged commit 2c4a5c4 into mcu-tools:main Nov 4, 2026
87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants