summaryrefslogtreecommitdiff
path: root/sys/dev/rnd.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-11-03 18:24:29 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-11-03 18:24:29 +0000
commit660262a24f8daae1e5417ca94b02bce0585f726a (patch)
treefcc4422c67a7bd2334244172293bd117832d1d04 /sys/dev/rnd.c
parente9a344f9ce8e4163c4a4ca745b27915030cbbbf1 (diff)
add arc4random_bytes. input ok mickey@
Diffstat (limited to 'sys/dev/rnd.c')
-rw-r--r--sys/dev/rnd.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c
index a99dfb30c8a..a830b5fcef9 100644
--- a/sys/dev/rnd.c
+++ b/sys/dev/rnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rnd.c,v 1.65 2003/10/21 05:24:40 jmc Exp $ */
+/* $OpenBSD: rnd.c,v 1.66 2003/11/03 18:24:28 tedu Exp $ */
/*
* rnd.c -- A strong random number generator
@@ -596,6 +596,17 @@ arc4random(void)
}
void
+arc4random_bytes(void *buf, size_t n)
+{
+ u_int8_t *cp = buf;
+ u_int8_t *end = cp + n;
+
+ arc4maybeinit();
+ while (cp < end)
+ *cp++ = arc4_getbyte();
+}
+
+void
randomattach(void)
{
int i;