You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rp2: Use RP2350 hardware TRNG for os.urandom #18831
The RP2350 has a dedicated hardware TRNG peripheral with built-in health tests aligned with NIST SP 800-90B. The Pico SDK already uses it, pico_rand auto-detects HAS_RP2350_TRNG and sources entropy from it.
The current implementation is using ROSC for both rp2 microcontrollers. The RP2040 datasheet (§2.17.5) warns this "does not meet the requirements of randomness for security systems because it can be compromised."
Code Size
I expect the new code size to be rather small
Implementation
I would like to sponsor development of this feature
I'd be happy to implement this. My approach would be to mix entropy from both TRNG and ROSC (similar to pico_rand), but condition the output through SHA-256 rather than splitmix64/xoroshiro128**. The Linux kernel's RNG used SHA-1 for entropy mixing before switching to BLAKE2s. CircuitPython also conditions through SHA-256 on its RP2 port: https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/common-hal/os/__init__.c
On RP2040, the existing ROSC path would remain unchanged.
Activity
ricksorensen commentedon Feb 17, 2026
Also see discussion #16420. Using 2350 new/updated TRNG should be evaluated in my opinion.
mimi89999 commentedon Feb 17, 2026
I'd be happy to implement this. My approach would be to mix entropy from both TRNG and ROSC (similar to pico_rand), but condition the output through SHA-256 rather than splitmix64/xoroshiro128**. The Linux kernel's RNG used SHA-1 for entropy mixing before switching to BLAKE2s. CircuitPython also conditions through SHA-256 on its RP2 port: https://github.com/adafruit/circuitpython/blob/main/ports/raspberrypi/common-hal/os/__init__.c
On RP2040, the existing ROSC path would remain unchanged.
mimi89999 commentedon Feb 27, 2026
Landed in 158cbd6