diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2011-01-10 05:40:07 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2011-01-10 05:40:07 +0000 |
commit | 68a69b199ec32f5e962f76c1a3d0068db8a48bfe (patch) | |
tree | 013b28a6e27c292b0f3c55f75ba1b28ca3d3d1c6 /sys/dev/rnd.c | |
parent | e6af045810089d5c3cd45c63bb6bdca1b945036a (diff) |
randomread does its own rekeying now, so we don't need the large buf function.
ok deraadt
Diffstat (limited to 'sys/dev/rnd.c')
-rw-r--r-- | sys/dev/rnd.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c index 60eaf9f3446..4db2501920c 100644 --- a/sys/dev/rnd.c +++ b/sys/dev/rnd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rnd.c,v 1.134 2011/01/10 03:23:30 deraadt Exp $ */ +/* $OpenBSD: rnd.c,v 1.135 2011/01/10 05:40:06 tedu Exp $ */ /* * Copyright (c) 2011 Theo de Raadt. @@ -543,7 +543,6 @@ struct timeout arc4_timeout; void arc4_reinit(void *v); /* timeout to start reinit */ void arc4_init(void *, void *); /* actually do the reinit */ -void arc4random_buf_large(void *, size_t); /* Return one word of randomness from an RC4 generator */ u_int32_t @@ -559,36 +558,11 @@ arc4random(void) } /* - * Return a "large" buffer of randomness using an independantly-keyed RC4 - * generator. - */ -void -arc4random_buf_large(void *buf, size_t n) -{ - u_char lbuf[ARC4_KEY_BYTES]; - struct rc4_ctx lctx; - - arc4random_buf(lbuf, sizeof(lbuf)); - - rc4_keysetup(&lctx, lbuf, sizeof(lbuf)); - rc4_skip(&lctx, ARC4_STATE * ARC4_PARANOIA); - rc4_getbytes(&lctx, (u_char *)buf, n); - bzero(lbuf, sizeof(lbuf)); - bzero(&lctx, sizeof(lctx)); -} - -/* * Fill a buffer of arbitrary length with RC4-derived randomness. */ void arc4random_buf(void *buf, size_t n) { - /* Satisfy large requests via an independent ARC4 instance */ - if (n > ARC4_MAIN_MAX_BYTES) { - arc4random_buf_large(buf, n); - return; - } - mtx_enter(&rndlock); rc4_getbytes(&arc4random_state, (u_char *)buf, n); rndstats.arc4_reads += n; |