Skip to content

Conversation

Vge0rge
Copy link
Contributor

@Vge0rge Vge0rge commented Aug 28, 2025

Use the entropy directly from the TRNG peripheral
of Cracen for Softdevice.

@Vge0rge Vge0rge marked this pull request as ready for review August 28, 2025 10:34
@Vge0rge Vge0rge requested a review from a team as a code owner August 28, 2025 10:34
Copy link

You can find the documentation preview for this PR here.

@eivindj-nordic eivindj-nordic added this to the v0.9.0 milestone Aug 28, 2025
Copy link
Contributor

@lemrey lemrey left a comment

Choose a reason for hiding this comment

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

Could you explain why we are making this change and what's the difference between these two API? I suppose both psa_generate_random and cracen_get_trng are seeded from hardware and give good random numbers back?

@anhmolt
Copy link
Contributor

anhmolt commented Aug 29, 2025

Could you explain why we are making this change and what's the difference between these two API? I suppose both psa_generate_random and cracen_get_trng are seeded from hardware and give good random numbers back?

If I understand correctly,
cracen_get_trng gives true random numbers from the cracen peripheral. Generated in hardware.
psa_generate_random gives psudo random numbers from a generator that have been seeded from true random numbers from cracen.

SoftDevice will generate psudo random numbers internally from the seed we pass to the SoftDevice, so only a true random number for seed i needed. No need to generate twice.

@@ -10,6 +10,7 @@
#include <nrf_sdh_soc.h>
#include <nrf_soc.h>
#include <psa/crypto.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we can get rid of this then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, because the psa_status codes comes from this header.

@eivindj-nordic
Copy link
Contributor

@Vge0rge Please add changelog entry.

@eivindj-nordic eivindj-nordic added the changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. label Aug 29, 2025
Use the entropy directly from the TRNG peripheral
of Cracen for Softdevice.
This is done because softdevice needs true RNG data
and internally calculates the PRNG data needed for
its operation.

Signed-off-by: Georgios Vasilakis <[email protected]>
@Vge0rge Vge0rge requested a review from a team as a code owner September 2, 2025 12:48
@github-actions github-actions bot added the doc-required PR must not be merged without tech writer approval. label Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-entry-required Update changelog before merge. Remove label if entry is not needed or already added. doc-required PR must not be merged without tech writer approval.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants