update to 9.7.2rc1
[tridge/bind9.git] / lib / isc / entropy.c
index 2d817c6adf53b84dbd0eda17f85c499955ce2803..8b24c7b15a58e21430f17346376606dee38b8b29 100644 (file)
@@ -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.20 2009/01/18 23:48:14 tbox Exp $ */
+/* $Id: entropy.c,v 1.20.186.2 2010/08/10 23:47:45 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