diff options
author | 2014-07-16 00:15:35 +0000 | |
---|---|---|
committer | 2014-07-16 00:15:35 +0000 | |
commit | 98694cd0ec41a7ac75e0931ca7c6bb12df1307bc (patch) | |
tree | d89c8bcc1f4db56a28212f356dcd1a79cdd8278b /lib/libc/crypt/arc4random.c | |
parent | tidy up the script (diff) | |
download | wireguard-openbsd-98694cd0ec41a7ac75e0931ca7c6bb12df1307bc.tar.xz wireguard-openbsd-98694cd0ec41a7ac75e0931ca7c6bb12df1307bc.zip |
added handler for an atfork hook from kettenis@
ok deraadt@ beck@ kettenis@
Diffstat (limited to 'lib/libc/crypt/arc4random.c')
-rw-r--r-- | lib/libc/crypt/arc4random.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libc/crypt/arc4random.c b/lib/libc/crypt/arc4random.c index 235a5d8d83b..37b1ad77c18 100644 --- a/lib/libc/crypt/arc4random.c +++ b/lib/libc/crypt/arc4random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc4random.c,v 1.43 2014/07/13 09:32:42 beck Exp $ */ +/* $OpenBSD: arc4random.c,v 1.44 2014/07/16 00:15:35 bcook Exp $ */ /* * Copyright (c) 1996, David Mazieres <dm@uun.org> @@ -66,6 +66,13 @@ static struct { static inline void _rs_rekey(u_char *dat, size_t datlen); static inline void +_rs_forkhandler(void) +{ + if (rs) + rs->rs_count = 0; +} + +static inline void _rs_init(u_char *buf, size_t n) { if (n < KEYSZ + IVSZ) @@ -78,6 +85,8 @@ _rs_init(u_char *buf, size_t n) #ifdef MAP_INHERIT_ZERO if (minherit(rs, sizeof(*rs), MAP_INHERIT_ZERO) == -1) abort(); +#else + _ARC4_ATFORK(_rs_forkhandler); #endif } if (rsx == NULL) { |