mirror of
https://github.com/espressif/openthread.git
synced 2026-08-13 14:17:47 +00:00
[crypto] seed PRNG from DRBG when possible (#4141)
This commit is contained in:
committed by
Jonathan Hui
parent
fac99c7091
commit
e7ea31b16f
@@ -65,17 +65,17 @@ RandomManager::RandomManager(void)
|
||||
|
||||
#ifndef OPENTHREAD_RADIO
|
||||
sEntropy.Init();
|
||||
#endif
|
||||
sCtrDrbg.Init();
|
||||
|
||||
error = Random::Crypto::FillBuffer(reinterpret_cast<uint8_t *>(&seed), sizeof(seed));
|
||||
assert(error == OT_ERROR_NONE);
|
||||
#else
|
||||
error = otPlatEntropyGet(reinterpret_cast<uint8_t *>(&seed), sizeof(seed));
|
||||
assert(error == OT_ERROR_NONE);
|
||||
#endif
|
||||
|
||||
sPrng.Init(seed);
|
||||
|
||||
#ifndef OPENTHREAD_RADIO
|
||||
sCtrDrbg.Init();
|
||||
#endif
|
||||
|
||||
exit:
|
||||
sInitCount++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user