mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-08-16 04:49:48 +00:00
* combine radio's entropy with CC310 RNG
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user