--- old/src/share/classes/java/util/SplittableRandom.java 2014-06-25 13:41:09.329125599 +0200 +++ new/src/share/classes/java/util/SplittableRandom.java 2014-06-25 13:41:09.245127043 +0200 @@ -25,7 +25,13 @@ package java.util; +import sun.misc.JavaNetAccess; +import sun.misc.SharedSecrets; + import java.net.NetworkInterface; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.SecureRandom; import java.util.concurrent.atomic.AtomicLong; import java.util.function.IntConsumer; import java.util.function.LongConsumer; @@ -230,8 +236,22 @@ String pp = java.security.AccessController.doPrivileged( new sun.security.action.GetPropertyAction( "java.util.secureRandomSeed")); - if (pp != null && pp.equalsIgnoreCase("true")) { - byte[] seedBytes = java.security.SecureRandom.getSeed(8); + if (pp != null) { + SecureRandom sr; + if (pp.equalsIgnoreCase("true")) { + sr = new SecureRandom(); + } else { + String[] args = pp.split(",", 2); + try { + sr = args.length > 1 + ? SecureRandom.getInstance(args[0], args[1]) + : SecureRandom.getInstance(args[0]); + } catch (NoSuchAlgorithmException | NoSuchProviderException e) { + throw new IllegalArgumentException( + "Invalid java.util.secureRandomSeed property: " + pp, e); + } + } + byte[] seedBytes = sr.generateSeed(8); long s = (long)(seedBytes[0]) & 0xffL; for (int i = 1; i < 8; ++i) s = (s << 8) | ((long)(seedBytes[i]) & 0xffL); @@ -241,11 +261,12 @@ try { Enumeration ifcs = NetworkInterface.getNetworkInterfaces(); + JavaNetAccess jna = SharedSecrets.getJavaNetAccess(); boolean retry = false; // retry once if getHardwareAddress is null while (ifcs.hasMoreElements()) { NetworkInterface ifc = ifcs.nextElement(); if (!ifc.isVirtual()) { // skip fake addresses - byte[] bs = ifc.getHardwareAddress(); + byte[] bs = jna.getHardwareAddress0(ifc); if (bs != null) { int n = bs.length; int m = Math.min(n >>> 1, 4);