summaryrefslogtreecommitdiff
path: root/lib/isc/entropy.c
diff options
context:
space:
mode:
authorCy Schubert <cy@FreeBSD.org>2014-12-20 22:52:39 +0000
committerCy Schubert <cy@FreeBSD.org>2014-12-20 22:52:39 +0000
commitb5e14a1344528861a7016aa2c6b0f2e9630d1526 (patch)
treef04bed14f7e8aed5c0e9d2f7785175c7951036d3 /lib/isc/entropy.c
parent2b45e011ca352ce509bc83ae148230aeee0c7e0d (diff)
Diffstat (limited to 'lib/isc/entropy.c')
-rw-r--r--lib/isc/entropy.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/isc/entropy.c b/lib/isc/entropy.c
index 25ab00218956b..da9e81fb3129a 100644
--- a/lib/isc/entropy.c
+++ b/lib/isc/entropy.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007, 2009, 2010 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: entropy.c,v 1.18.332.2 2009/01/18 23:47:41 tbox Exp $ */
+/* $Id: entropy.c,v 1.22 2010/08/10 23:48:19 tbox Exp $ */
/*! \file
* \brief
@@ -283,8 +283,11 @@ entropypool_add_word(isc_entropypool_t *rp, isc_uint32_t val) {
val ^= rp->pool[(rp->cursor + TAP3) & (RND_POOLWORDS - 1)];
val ^= rp->pool[(rp->cursor + TAP4) & (RND_POOLWORDS - 1)];
val ^= rp->pool[(rp->cursor + TAP5) & (RND_POOLWORDS - 1)];
- rp->pool[rp->cursor++] ^=
- ((val << rp->rotate) | (val >> (32 - rp->rotate)));
+ if (rp->rotate == 0)
+ rp->pool[rp->cursor++] ^= val;
+ else
+ rp->pool[rp->cursor++] ^=
+ ((val << rp->rotate) | (val >> (32 - rp->rotate)));
/*
* If we have looped around the pool, increment the rotate