am 6bee9d2d: am 0f55bd8a: Merge "Make sure seed values use full range" into jb-dev

* commit '6bee9d2dece0b8a6b3cbd8dcb2bb3c3c04a17f46':
  Make sure seed values use full range
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,