aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdlib/arc4random.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/arc4random.c')
-rw-r--r--newlib/libc/stdlib/arc4random.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/arc4random.c b/newlib/libc/stdlib/arc4random.c
index 75cdff3..3cccc3e 100644
--- a/newlib/libc/stdlib/arc4random.c
+++ b/newlib/libc/stdlib/arc4random.c
@@ -180,16 +180,24 @@ arc4random(void)
{
uint32_t val;
+#ifndef __SINGLE_THREAD__
_ARC4_LOCK();
+#endif
_rs_random_u32(&val);
+#ifndef __SINGLE_THREAD__
_ARC4_UNLOCK();
+#endif
return val;
}
void
arc4random_buf(void *buf, size_t n)
{
+#ifndef __SINGLE_THREAD__
_ARC4_LOCK();
+#endif
_rs_random_buf(buf, n);
+#ifndef __SINGLE_THREAD__
_ARC4_UNLOCK();
+#endif
}