99import java .security .SecureRandom ;
1010import java .security .SecureRandomSpi ;
1111import java .security .Security ;
12- import java .util .concurrent .ConcurrentLinkedDeque ;
12+ import java .util .concurrent .ConcurrentLinkedQueue ;
1313import java .util .concurrent .atomic .AtomicBoolean ;
1414import java .util .concurrent .atomic .AtomicInteger ;
1515import java .util .concurrent .atomic .AtomicReference ;
1616import java .util .logging .Level ;
1717import java .util .logging .Logger ;
1818
19- import org .bouncycastle .crypto .CryptoServicesRegistrar ;
2019import org .bouncycastle .crypto .digests .SHA512Digest ;
2120import org .bouncycastle .crypto .macs .HMac ;
2221import org .bouncycastle .crypto .prng .EntropySource ;
3332
3433/**
3534 * <b>DRBG Configuration</b><br/>
36- * <p>org.bouncycastle.drbg.gather_pause_secs - is to stop the entropy collection thread from grabbing all
35+ * <p>
36+ * org.bouncycastle.drbg.gather_pause_secs - is to stop the entropy collection thread from grabbing all
3737 * available entropy on the system. The original motivation for the hybrid infrastructure was virtual machines
3838 * sometimes produce very few bits of entropy a second, the original approach (which "worked" at least for BC) was
3939 * to just read on the second thread and allow things to progress around it, but it did tend to hog the system
4242 * enough to allow everyone to work together, but small enough to ensure the provider's DRBG is being regularly
4343 * reseeded.
4444 * </p>
45- * <p>org.bouncycastle.drbg.entropysource - is the class name for an implementation of EntropySourceProvider.
45+ * <p>
46+ * org.bouncycastle.drbg.entropysource - is the class name for an implementation of EntropySourceProvider.
4647 * For example, one could be provided which just reads directly from /dev/random and the extra infrastructure used here
47- * could be avoided.</p>
48+ * could be avoided.
49+ * </p>
4850 */
4951public class DRBG
5052{
@@ -301,7 +303,7 @@ private static byte[] generateNonceIVPersonalizationString(byte[] seed)
301303 private static class EntropyDaemon
302304 implements Runnable
303305 {
304- private final ConcurrentLinkedDeque <Runnable > tasks = new ConcurrentLinkedDeque <Runnable >();
306+ private final ConcurrentLinkedQueue <Runnable > tasks = new ConcurrentLinkedQueue <Runnable >();
305307
306308 void addTask (Runnable task )
307309 {
@@ -313,7 +315,7 @@ public void run()
313315 {
314316 while (!Thread .currentThread ().isInterrupted ())
315317 {
316- Runnable task = tasks .pollFirst ();
318+ Runnable task = tasks .poll ();
317319
318320 if (task != null )
319321 {
0 commit comments