From: Andy Green Date: Fri, 28 Apr 2017 03:53:28 +0000 (+0800) Subject: esp32: return random count X-Git-Tag: accepted/tizen/4.0/unified/20171012.191640~126 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98218bd6b7485667accd36d12cc89a3f716addc4;p=platform%2Fupstream%2Flibwebsockets.git esp32: return random count --- diff --git a/lib/lws-plat-esp32.c b/lib/lws-plat-esp32.c index c00c933..1f58945 100644 --- a/lib/lws-plat-esp32.c +++ b/lib/lws-plat-esp32.c @@ -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