[crypto] seed PRNG from DRBG when possible (#4141)

This commit is contained in:
Kamil Sroka
2019-09-04 12:06:27 -07:00
committed by Jonathan Hui
parent fac99c7091
commit e7ea31b16f
+5 -5
View File
@@ -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++;
}