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>
This commit is contained in:
Corinna Vinschen 2016-03-18 14:39:58 +01:00
parent f74cf1350e
commit 5ccdcf0219
1 changed files with 18 additions and 0 deletions

View File

@ -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();
}