@@ -223,7 +223,8 @@ public EntropySource get(int bitsRequired)
223223
224224 // unfortunately new SecureRandom() can cause a regress and it's the only reliable way of getting access
225225 // to the JVM's seed generator.
226- private static EntropySourceProvider createInitialEntropySource ()
226+
227+ private static EntropySourceProvider createCoreEntropySourceProvider ()
227228 {
228229 boolean hasGetInstanceStrong = AccessController .doPrivileged (new PrivilegedAction <Boolean >()
229230 {
@@ -254,20 +255,25 @@ public SecureRandom run()
254255 }
255256 catch (Exception e )
256257 {
257- return new CoreSecureRandom ( findSource ()) ;
258+ return null ;
258259 }
259260 }
260261 });
261262
263+ if (strong == null )
264+ {
265+ return createInitialEntropySource ();
266+ }
267+
262268 return new IncrementalEntropySourceProvider (strong , true );
263269 }
264270 else
265271 {
266- return new IncrementalEntropySourceProvider ( new CoreSecureRandom ( findSource ()), true );
272+ return createInitialEntropySource ( );
267273 }
268274 }
269275
270- private static EntropySourceProvider createCoreEntropySourceProvider ()
276+ private static EntropySourceProvider createInitialEntropySource ()
271277 {
272278 String source = AccessController .doPrivileged (new PrivilegedAction <String >()
273279 {
@@ -279,7 +285,7 @@ public String run()
279285
280286 if (source == null )
281287 {
282- return createInitialEntropySource ( );
288+ return new IncrementalEntropySourceProvider ( new CoreSecureRandom ( findSource ()), true );
283289 }
284290 else
285291 {
@@ -289,7 +295,7 @@ public String run()
289295 }
290296 catch (Exception e )
291297 {
292- return createInitialEntropySource ( );
298+ return new IncrementalEntropySourceProvider ( new CoreSecureRandom ( findSource ()), true );
293299 }
294300 }
295301 }
0 commit comments