[kaffe] CVS kaffe (stack): Fix SecureRandom.next()

Kaffe CVS cvs-commits at kaffe.org
Mon Oct 27 11:35:03 PST 2003


PatchSet 4129 
Date: 2003/10/27 19:33:02
Author: stack
Branch: HEAD
Tag: (none) 
Log:
Fix SecureRandom.next()

Members: 
	ChangeLog:1.1721->1.1722 
	libraries/javalib/java/security/SecureRandom.java:1.4->1.5 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1721 kaffe/ChangeLog:1.1722
--- kaffe/ChangeLog:1.1721	Mon Oct 27 16:56:59 2003
+++ kaffe/ChangeLog	Mon Oct 27 19:33:02 2003
@@ -1,3 +1,10 @@
+2003-10-27  Timothy S. Stack <stack at cs.utah.edu>
+
+	* libraries/javalib/java/security/SecureRandom.java:
+	Fix computation of next(int).
+	
+	Reported by: jrandom
+
 2003-10-27  Ross Martin <hacker at ross.interwrx.com>
 
 	* libraries/javalib/java/awt/ImageLoader.java:
Index: kaffe/libraries/javalib/java/security/SecureRandom.java
diff -u kaffe/libraries/javalib/java/security/SecureRandom.java:1.4 kaffe/libraries/javalib/java/security/SecureRandom.java:1.5
--- kaffe/libraries/javalib/java/security/SecureRandom.java:1.4	Thu Feb 20 13:52:09 2003
+++ kaffe/libraries/javalib/java/security/SecureRandom.java	Mon Oct 27 19:33:04 2003
@@ -83,7 +83,7 @@
 	nextBytes(res);
 	for( lpc = res.length - 1; lpc >= 0; lpc-- )
 	{
-		retval |= (res[res.length - lpc - 1] << (8 * lpc)) & 0xFF;
+		retval |= ((res[res.length - lpc - 1] & 0xFF) << (8 * lpc));
 	}
 	return retval >> (res.length * 8 - numBits);
 




More information about the kaffe mailing list