Author: toad
Date: 2009-03-18 19:35:03 +0000 (Wed, 18 Mar 2009)
New Revision: 26102

Modified:
   branches/db4o/freenet/src/freenet/client/async/InsertCompressor.java
Log:
If inserting an SSK, don't compress unless we can get it under 1K.
REVIEW: CRYPTO: Should we insert compressed data even if it doesn't save us any 
keys, to make cryptanalysis harder? IIRC GPG does this... If so, need to change 
InsertCompressor, SFI.tryCompress, Key


Modified: branches/db4o/freenet/src/freenet/client/async/InsertCompressor.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/InsertCompressor.java        
2009-03-18 19:34:33 UTC (rev 26101)
+++ branches/db4o/freenet/src/freenet/client/async/InsertCompressor.java        
2009-03-18 19:35:03 UTC (rev 26102)
@@ -7,6 +7,7 @@
 import com.db4o.query.Query;
 
 import freenet.client.InsertException;
+import freenet.keys.CHKBlock;
 import freenet.keys.NodeCHK;
 import freenet.node.PrioRunnable;
 import freenet.support.Logger;
@@ -142,7 +143,10 @@
                                        shouldFreeOnFinally = false;
                                        break;
                                }
-                               if(resultSize < bestCompressedDataSize) {
+                               if(resultSize < bestCompressedDataSize && 
+                                               // If compressing to CHK, 
origSize will always be greater
+                                               // If compressing to SSK, we 
are not interested unless we can get it small enough to fit in the SSK itself
+                                               origSize > 
CHKBlock.DATA_LENGTH) {
                                        if(logMINOR)
                                                Logger.minor(this, "New size 
"+resultSize+" better than old best "+bestCompressedDataSize);
                                        if(bestCompressedData != null && 
bestCompressedData != origData)

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to