ricardgb opened a new pull request, #19400:
URL: https://github.com/apache/nuttx/pull/19400

   ## Summary
   
   The RP2350 (rp23xx) 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 —
   but there is no driver for it, so `/dev/urandom` on rp23xx is the software
   xorshift PRNG.
   
   This adds `arch/arm/src/rp23xx/rp23xx_rng.c`, a polling driver that serves 
the
   conditioned hardware 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; health-test failures discard the
   block and re-arm the source, so only conditioned entropy is ever returned.
   
   New `CONFIG_RP23XX_TRNG` `select`s `ARCH_HAVE_RNG`, which switches 
`/dev/urandom`
   from the software PRNG to the hardware source (backing `getrandom()` and 
thus any
   entropy consumer, e.g. mbedtls).
   
   ## Impact
   
   - rp23xx gains a real hardware entropy source; opt-in via 
`CONFIG_RP23XX_TRNG`.
   - No change when the option is off (default `n`).
   
   ## Testing
   
   Tested on a Raspberry Pi Pico 2 W:
   - `/dev/random` and `/dev/urandom` register from the TRNG;
   - a 32-byte read returns at real ring-oscillator sampling latency (~10 ms);
   - two independent 32-byte samples differ (live, non-stuck source);
   - the CryptoCell CRNGT continuous test — which would stall a stuck source —
     passes, and mbedtls seeds its CTR_DRBG from `/dev/urandom` successfully.
   
   ---
   
   *Disclosure: this change was prepared by an AI agent (Claude Code) at the
   direction of the author, who reviewed and tested it on hardware before
   submission.*
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to