summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libc/crypt/arc4random.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libc/crypt/arc4random.c b/src/lib/libc/crypt/arc4random.c
index 235a5d8d83..37b1ad77c1 100644
--- a/src/lib/libc/crypt/arc4random.c
+++ b/src/lib/libc/crypt/arc4random.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: arc4random.c,v 1.43 2014/07/13 09:32:42 beck Exp $ */ 1/* $OpenBSD: arc4random.c,v 1.44 2014/07/16 00:15:35 bcook Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, David Mazieres <dm@uun.org> 4 * Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -66,6 +66,13 @@ static struct {
66static inline void _rs_rekey(u_char *dat, size_t datlen); 66static inline void _rs_rekey(u_char *dat, size_t datlen);
67 67
68static inline void 68static inline void
69_rs_forkhandler(void)
70{
71 if (rs)
72 rs->rs_count = 0;
73}
74
75static inline void
69_rs_init(u_char *buf, size_t n) 76_rs_init(u_char *buf, size_t n)
70{ 77{
71 if (n < KEYSZ + IVSZ) 78 if (n < KEYSZ + IVSZ)
@@ -78,6 +85,8 @@ _rs_init(u_char *buf, size_t n)
78#ifdef MAP_INHERIT_ZERO 85#ifdef MAP_INHERIT_ZERO
79 if (minherit(rs, sizeof(*rs), MAP_INHERIT_ZERO) == -1) 86 if (minherit(rs, sizeof(*rs), MAP_INHERIT_ZERO) == -1)
80 abort(); 87 abort();
88#else
89 _ARC4_ATFORK(_rs_forkhandler);
81#endif 90#endif
82 } 91 }
83 if (rsx == NULL) { 92 if (rsx == NULL) {