mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-06 09:42:54 +03:00
coap_prng.c: Fix missing coap_prng_impl function.
PR #590 unfortunately broke the standard builds.
This commit is contained in:
1 parent
9b45575cdf
commit
b0d46deef6
1 file changed
+8
-1
+8
-1
@@ -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 */
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user