JDK-5108581 : SecureRandom class unable to generate faster random nos on faster machines
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: linux_suse_sles_8.2
  • CPU: x86
  • Submitted: 2004-09-29
  • Updated: 2004-09-29
  • Resolved: 2004-09-29
Related Reports
Relates :  
Description
SecureRandom class takes a longer time to generate PRNG on Linux-Amd -SuSE 8.2 systems.    

Ideally, this process of PRNG should be faster on a faster machine & slower on a slower machine.

But below are some timings on a different os/hw for generating 20000 random bits, & checking their randomness as per FIPS 140-1.

j2sesqe.india.sun.com - Solaris9-Sun-Fire-280R-UltraSPARC-III+   - Time 2 sec
jbackupblr.india.sun.com -Solaris10-Ultra-5/10-UltraSPARC-IIi    - Time 5 sec
jdsn10.india.sun.com - Linux RH-AS3.0 Intel P4 CPU 2.6GHz        - Time 2 sec
jlab324.india.sun.com - Linux-SuSE 8.2-Amd-Athlon HX-1.3 GHz     - Time 11 min
jdsn8.india.sun.com  - WinXP Pro-Intel P4 CPU 2.4 GHz            - Time 2 sec

I have attached the source file for testing on any other machines & for debugging & another bug details http://hestia.sfbay.sun.com/cgi-bin/bug?id=5046409, which is the source for this bug.

Comments
EVALUATION The test calls 'SecureRandom.getInstance("SHA1PRNG").generateSeed(2500)'. On Linux/Solaris9+ systems, all this does is read 2500 bytes from /dev/random. How long that takes is entirely dependent on the OS implementation of /dev/random and beyond our control. On some Linux kernels it is extremely slow, but that is their issue and not ours. Also note that typical real world applications never calls secureRandom.generateSeed(). They call secureRandom.nextBytes(), which in Tiger does not have any of these issues. Closing as not-a-bug. ###@###.### 2004-09-28
28-09-2004