forked from wolfSSL/wolfssl
Fix for InTime RTOS v5. The arc4random_buf
wasn't added until v6, so opting to use arc4random
. ZD 11760.
This commit is contained in:
@ -2236,19 +2236,24 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
|||||||
#elif defined(INTIME_RTOS)
|
#elif defined(INTIME_RTOS)
|
||||||
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
uint32_t rand;
|
||||||
|
word32 len = sizeof(rand);
|
||||||
(void)os;
|
|
||||||
|
|
||||||
if (output == NULL) {
|
if (output == NULL) {
|
||||||
return BUFFER_E;
|
return BUFFER_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: Investigate better solution */
|
while (sz > 0) {
|
||||||
/* no return to check */
|
if (sz < len)
|
||||||
arc4random_buf(output, sz);
|
len = sz;
|
||||||
|
rand = arc4random(); /* returns 32-bits of random */
|
||||||
|
XMEMCPY(output, &rand, len);
|
||||||
|
output += len;
|
||||||
|
sz -= len;
|
||||||
|
}
|
||||||
|
(void)os;
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(WOLFSSL_WICED)
|
#elif defined(WOLFSSL_WICED)
|
||||||
|
Reference in New Issue
Block a user