mirror of
https://github.com/espressif/openthread.git
synced 2026-09-06 09:10:04 +00:00
Require platform TRNG to provide requested output length or error. (#1650)
This commit is contained in:
@@ -430,14 +430,14 @@ uint32_t otPlatRandomGet()
|
||||
return (uint32_t)RtlRandomEx(&Counter.LowPart);
|
||||
}
|
||||
|
||||
ThreadError otPlatRandomSecureGet(uint16_t aInputLength, uint8_t *aOutput, uint16_t *aOutputLength)
|
||||
ThreadError otPlatRandomGetTrue(uint8_t *aOutput, uint16_t aOutputLength)
|
||||
{
|
||||
// Just use the system-preferred random number generator algorithm
|
||||
NTSTATUS status =
|
||||
BCryptGenRandom(
|
||||
NULL,
|
||||
aOutput,
|
||||
(ULONG)aInputLength,
|
||||
(ULONG)aOutputLength,
|
||||
BCRYPT_USE_SYSTEM_PREFERRED_RNG
|
||||
);
|
||||
NT_ASSERT(NT_SUCCESS(status));
|
||||
@@ -447,8 +447,6 @@ ThreadError otPlatRandomSecureGet(uint16_t aInputLength, uint8_t *aOutput, uint1
|
||||
return kThreadError_Failed;
|
||||
}
|
||||
|
||||
*aOutputLength = aInputLength;
|
||||
|
||||
return kThreadError_None;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user