Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-03-18 16:39:58 +0300
committerCorinna Vinschen <corinna@vinschen.de>2016-03-18 16:39:58 +0300
commit5ccdcf02192aa7dad6bf29fe661c0ca666c4d00f (patch)
tree7e03d74371a1869be92c89562728db8fe89931bb /newlib/libc
parentf74cf1350e4633892b6ee6db3664eec38579a709 (diff)
Add arc4random_stir and arc4random_addrandom for OpenBSD compatibility
* libc/stdlib/arc4random.c (arc4random_stir): New function. (arc4random_addrandom): Ditto. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc')
-rw-r--r--newlib/libc/stdlib/arc4random.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/arc4random.c b/newlib/libc/stdlib/arc4random.c
index 75cdff3bc..146e1762c 100644
--- a/newlib/libc/stdlib/arc4random.c
+++ b/newlib/libc/stdlib/arc4random.c
@@ -193,3 +193,21 @@ arc4random_buf(void *buf, size_t n)
_rs_random_buf(buf, n);
_ARC4_UNLOCK();
}
+
+void
+arc4random_stir(void)
+{
+ _ARC4_LOCK();
+ _rs_stir();
+ _ARC4_UNLOCK();
+}
+
+void
+arc4random_addrandom(u_char *dat, int datlen)
+{
+ _ARC4_LOCK();
+ if (!rs)
+ _rs_stir();
+ _rs_rekey(dat, datlen);
+ _ARC4_UNLOCK();
+}