mirror of
https://github.com/espressif/openthread.git
synced 2026-10-11 18:27:43 +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
|
#ifndef OPENTHREAD_RADIO
|
||||||
sEntropy.Init();
|
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));
|
error = otPlatEntropyGet(reinterpret_cast<uint8_t *>(&seed), sizeof(seed));
|
||||||
assert(error == OT_ERROR_NONE);
|
assert(error == OT_ERROR_NONE);
|
||||||
|
#endif
|
||||||
|
|
||||||
sPrng.Init(seed);
|
sPrng.Init(seed);
|
||||||
|
|
||||||
#ifndef OPENTHREAD_RADIO
|
|
||||||
sCtrDrbg.Init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
sInitCount++;
|
sInitCount++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user