diff --git a/core/java/src/net/i2p/util/RandomSource.java b/core/java/src/net/i2p/util/RandomSource.java index c7c87239c9db5484c311d0158a2722e83465f0b9..fe042915212baa352031616a60fba01f91e9f9ca 100644 --- a/core/java/src/net/i2p/util/RandomSource.java +++ b/core/java/src/net/i2p/util/RandomSource.java @@ -146,14 +146,18 @@ public class RandomSource extends SecureRandom implements EntropyHarvester { public final boolean initSeed(byte buf[]) { // why urandom? because /dev/random blocks, and there are arguments // suggesting such blockages are largely meaningless - boolean ok = seedFromFile("/dev/urandom", buf); + boolean ok = seedFromFile(new File("/dev/urandom"), buf); // we merge (XOR) in the data from /dev/urandom with our own seedfile - ok = seedFromFile("prngseed.rnd", buf) || ok; + File localFile = new File(_context.getConfigDir(), SEEDFILE); + ok = seedFromFile(localFile, buf) || ok; return ok; } - private static final boolean seedFromFile(String filename, byte buf[]) { - File f = new File(I2PAppContext.getGlobalContext().getConfigDir(), filename); + /** + * @param f absolute path + * @return success + */ + private static final boolean seedFromFile(File f, byte buf[]) { if (f.exists()) { FileInputStream fis = null; try {