* combine radio's entropy with CC310 RNG

This commit is contained in:
Scott Powell
2026-08-14 17:46:43 +10:00
parent 50a51a6479
commit fcb9bdf209
+3 -1
View File
@@ -92,8 +92,10 @@ public:
void random(uint8_t* dest, size_t sz) override {
#ifdef USE_CC310_HW_CRYPTO
// CC310 TRNG is higher quality and environment-independent vs radio RSSI noise.
nRFCrypto.Random.generate(dest, (uint16_t)sz);
for (int i = 0; i < sz; i++) {
dest[i] ^= _radio->randomByte() ^ (::random(0, 256) & 0xFF); // combine with Radio's entropy
}
#else
for (int i = 0; i < sz; i++) {
dest[i] = _radio->randomByte() ^ (::random(0, 256) & 0xFF);