hello all,
the attached patch --already committed-- fixes the above PR. the new test
recently added to Mauve: TestOfPR23899 (in
gnu.testlet.java.security.SecureRandom) highlights the bug and validates the
fix.
2006-08-02 Raif S. Naffah <[EMAIL PROTECTED]>
PR Classpath/23899
* java/security/SecureRandom.java (next): Call nextBytes as per specs.
cheers;
rsn
Index: SecureRandom.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/SecureRandom.java,v
retrieving revision 1.22
diff -u -r1.22 SecureRandom.java
--- SecureRandom.java 14 Apr 2006 18:33:43 -0000 1.22
+++ SecureRandom.java 2 Aug 2006 09:44:10 -0000
@@ -374,14 +374,9 @@
if (numBits == 0)
return 0;
- byte[] tmp = new byte[numBits / 8 + (1 * (numBits % 8))];
-
- secureRandomSpi.engineNextBytes(tmp);
- randomBytesUsed += tmp.length;
- counter++;
-
+ byte[] tmp = new byte[(numBits + 7) / 8];
+ this.nextBytes(tmp);
int ret = 0;
-
for (int i = 0; i < tmp.length; i++)
ret |= (tmp[i] & 0xFF) << (8 * i);