esp32: return random count
This commit is contained in:
parent
991f6ec644
commit
98218bd6b7
1 changed files with 2 additions and 1 deletions
|
@ -39,6 +39,7 @@ LWS_VISIBLE int
|
|||
lws_get_random(struct lws_context *context, void *buf, int len)
|
||||
{
|
||||
uint8_t *pb = buf;
|
||||
|
||||
while (len) {
|
||||
uint32_t r = esp_random();
|
||||
uint8_t *p = (uint8_t *)&r;
|
||||
|
@ -53,7 +54,7 @@ lws_get_random(struct lws_context *context, void *buf, int len)
|
|||
*pb++ = p[b];
|
||||
}
|
||||
|
||||
return 0;
|
||||
return pb - (uint8_t *)buf;
|
||||
}
|
||||
|
||||
LWS_VISIBLE int
|
||||
|
|
Loading…
Add table
Reference in a new issue