mirror of
https://github.com/espressif/openthread.git
synced 2026-08-12 05:37:46 +00:00
Require platform TRNG to provide requested output length or error. (#1650)
This commit is contained in:
@@ -338,19 +338,17 @@ extern "C" {
|
||||
#endif
|
||||
}
|
||||
|
||||
ThreadError otPlatRandomSecureGet(uint16_t aInputLength, uint8_t *aOutput, uint16_t *aOutputLength)
|
||||
ThreadError otPlatRandomGetTrue(uint8_t *aOutput, uint16_t aOutputLength)
|
||||
{
|
||||
ThreadError error = kThreadError_None;
|
||||
|
||||
VerifyOrExit(aOutput && aOutputLength, error = kThreadError_InvalidArgs);
|
||||
VerifyOrExit(aOutput, error = kThreadError_InvalidArgs);
|
||||
|
||||
for (uint16_t length = 0; length < aInputLength; length++)
|
||||
for (uint16_t length = 0; length < aOutputLength; length++)
|
||||
{
|
||||
aOutput[length] = (uint8_t)otPlatRandomGet();
|
||||
}
|
||||
|
||||
*aOutputLength = aInputLength;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user