JDK-8202608 : CommonSeeder test needs a white-box testing mechanism to replace the default entropy source
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2018-05-03
  • Updated: 2018-07-07
  • Resolved: 2018-06-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12
11 b20Fixed 12Fixed
Related Reports
Relates :  
Description
test/jdk/sun/security/provider/SecureRandom/CommonSeeder.java

This test currently uses reflection to hack into a Field object of a static final field to "non-final".   It needs a white-box testing mechanism to replace this reflection hack.

    static void setDefaultSeeder(EntropySource es) throws Exception {
        Field f = AbstractDrbg.class.getDeclaredField("defaultES");
        f.setAccessible(true);  // no more private
        Field f2 = Field.class.getDeclaredField("modifiers");
        f2.setAccessible(true);
        f2.setInt(f, f2.getInt(f) - Modifier.FINAL);    // no more final
        f.set(null, es);
    }
Comments
URL: http://hg.openjdk.java.net/jdk/jdk/rev/11e7eb8cb583 User: weijun Date: 2018-06-26 02:44:18 +0000
26-06-2018