forked from I2P_Developers/i2p.i2p
2005-10-22 jrandom
* Integrated GNU-Crypto's Fortuna PRNG, seeding it off /dev/urandom and
./prngseed.rnd (if they exist), and reseeding it with data out of
various crypto operations (unused bits in a DH exchange, intermediary
bits in a DSA signature generation, extra bits in an ElGamal decrypt).
The Fortuna implementation under gnu.crypto.prng has been modified to
use BouncyCastle's SHA256 and Cryptix's AES (since those are the ones
I2P uses), and the resulting gnu.crypto.prng.* are therefor available
under GPL+Classpath's linking exception (~= LGPL). I2P's SecureRandom
wrapper around it is, of course, public domain.
This commit is contained in:
@@ -26,6 +26,7 @@ import net.i2p.util.Clock;
|
||||
import net.i2p.util.LogManager;
|
||||
import net.i2p.util.RandomSource;
|
||||
import net.i2p.util.PooledRandomSource;
|
||||
import net.i2p.util.FortunaRandomSource;
|
||||
|
||||
/**
|
||||
* <p>Provide a base scope for accessing singletons that I2P exposes. Rather than
|
||||
@@ -456,7 +457,9 @@ public class I2PAppContext {
|
||||
private void initializeRandom() {
|
||||
synchronized (this) {
|
||||
if (_random == null) {
|
||||
if ("true".equals(getProperty("i2p.weakPRNG", "false")))
|
||||
if (true)
|
||||
_random = new FortunaRandomSource(this);
|
||||
else if ("true".equals(getProperty("i2p.weakPRNG", "false")))
|
||||
_random = new DummyPooledRandomSource(this);
|
||||
else
|
||||
_random = new PooledRandomSource(this);
|
||||
@@ -464,4 +467,4 @@ public class I2PAppContext {
|
||||
_randomInitialized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user