Author: nextgens
Date: 2008-08-16 18:31:24 +0000 (Sat, 16 Aug 2008)
New Revision: 21934

Modified:
   trunk/freenet/src/freenet/node/NodeCrypto.java
   trunk/freenet/src/freenet/node/NodeInitException.java
Log:
Spare a signature verification on signature if we aren't debugging the node

Modified: trunk/freenet/src/freenet/node/NodeCrypto.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeCrypto.java      2008-08-16 16:22:23 UTC 
(rev 21933)
+++ trunk/freenet/src/freenet/node/NodeCrypto.java      2008-08-16 18:31:24 UTC 
(rev 21934)
@@ -352,9 +352,8 @@
                        BigInteger m = new BigInteger(1, SHA256.digest(ref));
                        if(logMINOR) Logger.minor(this, "m = "+m.toString(16));
                        DSASignature _signature = DSA.sign(cryptoGroup, 
privKey, m, random);
-                       // FIXME remove this ... eventually
-                       if(!DSA.verify(pubKey, _signature, m, false))
-                               Logger.error(this, "Signature failed!");
+                       if(logMINOR && !DSA.verify(pubKey, _signature, m, 
false))
+                               throw new 
NodeInitException(NodeInitException.EXIT_EXCEPTION_TO_DEBUG, mySignedReference);
                        return _signature;
                } catch(UnsupportedEncodingException e){
                        //duh ?

Modified: trunk/freenet/src/freenet/node/NodeInitException.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeInitException.java       2008-08-16 
16:22:23 UTC (rev 21933)
+++ trunk/freenet/src/freenet/node/NodeInitException.java       2008-08-16 
18:31:24 UTC (rev 21934)
@@ -36,6 +36,7 @@
        public static final int EXIT_STORE_FILE_NOT_FOUND = 1;
        public static final int EXIT_NODE_UPPER_LIMIT = 1024;
        public static final int EXIT_BROKE_WRAPPER_CONF = 28;
+       public static final int EXIT_EXCEPTION_TO_DEBUG = 1023;
        private static final long serialVersionUID = -1;

        NodeInitException(int exitCode, String msg) {


Reply via email to