summaryrefslogtreecommitdiffstats
path: root/lib/libc/crypt/arc4random.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2014-07-17 14:30:41 +0000
committerderaadt <deraadt@openbsd.org>2014-07-17 14:30:41 +0000
commit29a8d8f8233aa7f86e86994c7b6886165d09ae25 (patch)
treeb6d726aa28cfe51789e914e2f0a62be190eea14a /lib/libc/crypt/arc4random.c
parentzero random buf for sysctl too, just in case (diff)
downloadwireguard-openbsd-29a8d8f8233aa7f86e86994c7b6886165d09ae25.tar.xz
wireguard-openbsd-29a8d8f8233aa7f86e86994c7b6886165d09ae25.zip
"Race-free because we're running single-threaded in a new
address space, and once allocated rs is never deallocated." document the forkhandler to save reviewers time, with matthew
Diffstat (limited to 'lib/libc/crypt/arc4random.c')
-rw-r--r--lib/libc/crypt/arc4random.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/crypt/arc4random.c b/lib/libc/crypt/arc4random.c
index 3b7f34faed5..565bfa03336 100644
--- a/lib/libc/crypt/arc4random.c
+++ b/lib/libc/crypt/arc4random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc4random.c,v 1.45 2014/07/16 00:18:54 deraadt Exp $ */
+/* $OpenBSD: arc4random.c,v 1.46 2014/07/17 14:30:41 deraadt Exp $ */
/*
* Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -69,6 +69,10 @@ static inline void _rs_rekey(u_char *dat, size_t datlen);
static inline void
_rs_forkhandler(void)
{
+ /*
+ * Race-free because we're running single-threaded in a new
+ * address space, and once allocated rs is never deallocated.
+ */
if (rs)
rs->rs_count = 0;
}