Update of /cvsroot/freenet/freenet/src/freenet
In directory sc8-pr-cvs1:/tmp/cvs-serv5586/src/freenet
Modified Files:
DSAAuthentity.java Core.java ConnectionHandler.java
Log Message:
Work around problem with ThrottleAsyncEntropyYarrow/Yarrow initialization order.
Made randSource in Core private and started exposing it though a getter instead of
directly.
Index: DSAAuthentity.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/DSAAuthentity.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -w -r1.1.1.1 -r1.2
--- DSAAuthentity.java 13 Jan 2002 05:23:59 -0000 1.1.1.1
+++ DSAAuthentity.java 27 Oct 2003 14:45:17 -0000 1.2
@@ -69,7 +69,7 @@
}
public CryptoElement sign(BigInteger b) {
- return DSA.sign(grp, this, b, Core.randSource);
+ return DSA.sign(grp, this, b, Core.getRandSource());
}
/** @return a FieldSet containing the private key and DSA group primitives
Index: Core.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/Core.java,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -w -r1.48 -r1.49
--- Core.java 17 Oct 2003 23:01:59 -0000 1.48
+++ Core.java 27 Oct 2003 14:45:17 -0000 1.49
@@ -165,12 +165,7 @@
public static int maxPadding;
/** The central PRNG */
- public static RandomSource randSource;
- static {
- randSource =
- new Yarrow((new File("/dev/urandom").exists()
- ? "/dev/urandom" : "prng.seed"), "SHA1", "Rijndael");
- }
+ private static RandomSource randSource;
/** The object that logs events */
public static Logger logger = new Logger();
@@ -704,6 +699,18 @@
// and what have you, with a big
// fat doubling......
}
+ /**
+ * @return Returns the randSource.
+ */
+ public static RandomSource getRandSource() {
+ //Hmmm.. I dont think we need to synchornize on this because:
+ //1. Does it really matter if we would
+ //2. Do we multithread as early as the first call here..
+ if(randSource == null)
+ randSource =new Yarrow((new File("/dev/urandom").exists()?
"/dev/urandom" : "prng.seed"), "SHA1", "Rijndael");
+ return randSource;
+ }
+
}
Index: ConnectionHandler.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/ConnectionHandler.java,v
retrieving revision 1.199
retrieving revision 1.200
diff -u -w -r1.199 -r1.200
--- ConnectionHandler.java 25 Oct 2003 18:28:00 -0000 1.199
+++ ConnectionHandler.java 27 Oct 2003 14:45:17 -0000 1.200
@@ -399,7 +399,7 @@
if(link instanceof FnpLink) {
// Find some way to do this that is less hackish! FIXME!
// Now SEND THE IDENTIFY
- i = new Identify(Core.randSource.nextLong(),
+ i = new Identify(Core.getRandSource().nextLong(),
Main.node.myRef);
}
byte[] toSend;
@@ -881,7 +881,7 @@
//We now have a complete message..
pipe it on to whatever desitny awaits
handleReceivedMessage(msg);
invalid = 0;
-
Core.randSource.acceptTimerEntropy(recvTimer);
+
Core.getRandSource().acceptTimerEntropy(recvTimer);
msgsThisTime++;
}
}
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs