Merge pull request #595 from mrdeep1/coap_prng_impl

coap_prng.c: Fix missing coap_prng_impl function.
This commit is contained in:
obgm authored and GitHub committed 2021-02-15 10:05:33 +01:00
commit 475654021e
1 file changed
+8 -1
+8 -1
View File
@@ -39,14 +39,21 @@ coap_prng_impl( unsigned char *buf, size_t len ) {
return 1;
}
#endif
#endif /* _WIN32 */
static int
coap_prng_default(void *buf, size_t len) {
#ifdef HAVE_GETRANDOM
return getrandom(buf, len, 0);
#else /* !HAVE_GETRANDOM */
#if defined(_WIN32)
return coap_prng_impl(buf,len);
#else /* !_WIN32 */
unsigned char *dst = (unsigned char *)buf;
while (len--)
*dst++ = rand() & 0xFF;
return 1;
#endif /* !_WIN32 */
#endif /* !HAVE_GETRANDOM */
}