nuttx/arch
Ricard Rosson 02a9798a82 rp23xx: add TRNG driver (hardware /dev/random and /dev/urandom)
The RP2350 embeds an Arm CryptoCell-style true random number generator:
a sampled ring oscillator conditioned by von-Neumann, CRNGT and
autocorrelation health tests, presenting 192 bits in the six EHR_DATA
words.  Add a polling driver that serves those conditioned bits as
/dev/random and /dev/urandom.  Entropy is drawn rarely (an mbedtls
CTR_DRBG seeds once and reseeds occasionally), so a blocking poll is
used rather than interrupt plumbing; the hardware health-test failures
discard the block and re-arm the source, so only conditioned entropy is
returned.

A startup self-test gates the source before it is trusted: it draws a
sample of the conditioned output and rejects a stuck source (identical
consecutive 192-bit blocks), a constant byte, or an absurd run of equal
bytes.  On failure the source is marked unhealthy and every read returns
-EIO, so an entropy consumer fail-stops rather than minting keys on a
broken source.  (The statistical quality is covered by the hardware
VN/CRNGT/autocorr tests; this catches the gross, silent failure modes.)

New CONFIG_RP23XX_TRNG selects ARCH_HAVE_RNG, which switches
/dev/urandom from the software xorshift PRNG to the hardware source
(backing getrandom() and thus any entropy consumer such as mbedtls).

Tested on a Raspberry Pi Pico 2 W: /dev/random and /dev/urandom
register, the startup self-test passes, a read returns at real ring-
oscillator sampling latency (~10 ms / 32 B), two independent samples
differ, and mbedtls seeds its CTR_DRBG from /dev/urandom successfully.

Assisted-by: Claude (Anthropic Claude Code)
Signed-off-by: Ricard Rosson <ricard@groundbits.com>
2026-07-23 16:51:03 +01:00
..
arm rp23xx: add TRNG driver (hardware /dev/random and /dev/urandom) 2026-07-23 16:51:03 +01:00
arm64 fs/hostfs: Return ENOTTY for unsupported ioctl 2026-07-23 08:30:29 +02:00
avr arch/avr/src/avrdx/avrdx_delay: add custom up_udelay function 2026-06-12 09:55:11 -04:00
ceva arch/ceva: Replace board_app_initialize 2026-05-02 18:36:46 +08:00
dummy
hc style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
mips arch/mips/jz4780: Add support for L2 cache operations 2026-07-21 16:40:08 +08:00
misoc include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
or1k include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
renesas drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
risc-v fs/hostfs: Return ENOTTY for unsupported ioctl 2026-07-23 08:30:29 +02:00
sim fs/hostfs: Handle POSIX byte-range locks 2026-07-23 15:34:02 +08:00
sparc drivers: Fix comment typos — 'Pubic' → 'Public' across drivers and headers. 2026-07-02 13:29:48 +08:00
tricore arch/tricore: Add hardware debug breakpoint and watchpoint support. 2026-05-22 15:38:36 +08:00
x86 drivers/efuse/efuse: Drivers Registered With World Write Permissions(Part 1) 2026-07-13 12:08:01 +02:00
x86_64 !include/fcntl.h: align open flags with Linux values 2026-06-30 13:43:44 +08:00
xtensa fs/hostfs: Return ENOTTY for unsupported ioctl 2026-07-23 08:30:29 +02:00
z16 include/debug.h: Move to include/nuttx/debug.h 2026-04-07 07:50:06 -03:00
z80 style: fix checkpatch issues after debug.h move 2026-04-07 07:50:06 -03:00
CMakeLists.txt
Kconfig sched/clock/clock_delay: added config flag to remove weak up_udelay 2026-06-12 09:55:11 -04:00