commit | 341cfb18f9ef761eddbc87859583e19f09fbbfdd | [log] [tgz] |
---|---|---|
author | Kenny Root <kroot@google.com> | Thu Aug 15 15:17:27 2013 -0700 |
committer | Kenny Root <kroot@google.com> | Thu Sep 05 10:35:44 2013 -0700 |
tree | e50d9815ca359dd6891fde6c36d7176ab1efe984 | |
parent | 44e8930b48015aacbad027c5a8d9a4c7e00e329e [diff] |
Make sure seed values use full range (cherry picked from commit 004435719afbe62d7ce6b39d69181b5dd801d598) Bug: 6642616 Change-Id: I773dd31d92207151df05122920170851fa021fd5
diff --git a/luni/src/main/java/org/apache/harmony/security/provider/crypto/SHA1PRNG_SecureRandomImpl.java b/luni/src/main/java/org/apache/harmony/security/provider/crypto/SHA1PRNG_SecureRandomImpl.java index 2420fbe..4d99d62 100644 --- a/luni/src/main/java/org/apache/harmony/security/provider/crypto/SHA1PRNG_SecureRandomImpl.java +++ b/luni/src/main/java/org/apache/harmony/security/provider/crypto/SHA1PRNG_SecureRandomImpl.java
@@ -288,6 +288,11 @@ updateSeed(RandomBitsSupplier.getRandomBits(DIGEST_LENGTH)); nextBIndex = HASHBYTES_TO_USE; + // updateSeed(...) updates where the last word of the seed is, so we + // have to read it again. + lastWord = seed[BYTES_OFFSET] == 0 ? 0 + : (seed[BYTES_OFFSET] + extrabytes) >> 3 - 1; + } else if (state == SET_SEED) { System.arraycopy(seed, HASH_OFFSET, copies, HASHCOPY_OFFSET,