Author: toad
Date: 2007-02-07 14:22:49 +0000 (Wed, 07 Feb 2007)
New Revision: 11681

Modified:
   trunk/freenet/src/freenet/crypt/CipherInputStream.java
   trunk/freenet/src/freenet/crypt/CipherOutputStream.java
   trunk/freenet/src/freenet/crypt/DecipherOutputStream.java
   trunk/freenet/src/freenet/crypt/EncipherInputStream.java
   trunk/freenet/src/freenet/crypt/PCFBMode.java
Log:
Crypto optimisation wasn't being used.

Modified: trunk/freenet/src/freenet/crypt/CipherInputStream.java
===================================================================
--- trunk/freenet/src/freenet/crypt/CipherInputStream.java      2007-02-06 
08:44:50 UTC (rev 11680)
+++ trunk/freenet/src/freenet/crypt/CipherInputStream.java      2007-02-07 
14:22:49 UTC (rev 11681)
@@ -19,13 +19,13 @@
     private boolean needIV = false;

     public CipherInputStream(BlockCipher c, InputStream in) {
-        this(new PCFBMode(c), in);
+        this(PCFBMode.create(c), in);
     }

     public CipherInputStream(BlockCipher c, InputStream in, boolean readIV) 
         throws IOException {

-        this(new PCFBMode(c), in);
+        this(PCFBMode.create(c), in);
         if (readIV) ctx.readIV(this.in);
     }

@@ -39,7 +39,7 @@
      */
     public CipherInputStream(BlockCipher c, InputStream in, boolean readIV,
                              boolean later) throws IOException {
-        this(new PCFBMode(c), in);
+        this(PCFBMode.create(c), in);
         if (readIV && later)
             needIV = true;
         else if (readIV)

Modified: trunk/freenet/src/freenet/crypt/CipherOutputStream.java
===================================================================
--- trunk/freenet/src/freenet/crypt/CipherOutputStream.java     2007-02-06 
08:44:50 UTC (rev 11680)
+++ trunk/freenet/src/freenet/crypt/CipherOutputStream.java     2007-02-07 
14:22:49 UTC (rev 11681)
@@ -21,11 +21,11 @@
     }

     public CipherOutputStream(BlockCipher c, OutputStream out) {
-        this(new PCFBMode(c), out);
+        this(PCFBMode.create(c), out);
     }

     public CipherOutputStream(BlockCipher c, OutputStream out, byte[] iv) {
-        this(new PCFBMode(c, iv), out);
+        this(PCFBMode.create(c, iv), out);
     }

     public CipherOutputStream(PCFBMode ctx, OutputStream out) {

Modified: trunk/freenet/src/freenet/crypt/DecipherOutputStream.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DecipherOutputStream.java   2007-02-06 
08:44:50 UTC (rev 11680)
+++ trunk/freenet/src/freenet/crypt/DecipherOutputStream.java   2007-02-07 
14:22:49 UTC (rev 11681)
@@ -16,7 +16,7 @@
     private PCFBMode ctx;

     public DecipherOutputStream(OutputStream out, BlockCipher c) {
-        this(out, new PCFBMode(c));
+        this(out, PCFBMode.create(c));
     }

     public DecipherOutputStream(OutputStream out, BlockCipher c, int bufSize) {

Modified: trunk/freenet/src/freenet/crypt/EncipherInputStream.java
===================================================================
--- trunk/freenet/src/freenet/crypt/EncipherInputStream.java    2007-02-06 
08:44:50 UTC (rev 11680)
+++ trunk/freenet/src/freenet/crypt/EncipherInputStream.java    2007-02-07 
14:22:49 UTC (rev 11681)
@@ -15,7 +15,7 @@
     protected PCFBMode ctx;

     public EncipherInputStream(InputStream in, BlockCipher c) {
-        this(in, new PCFBMode(c));
+        this(in, PCFBMode.create(c));
     }

     public EncipherInputStream(InputStream in, BlockCipher c, int bufSize) {

Modified: trunk/freenet/src/freenet/crypt/PCFBMode.java
===================================================================
--- trunk/freenet/src/freenet/crypt/PCFBMode.java       2007-02-06 08:44:50 UTC 
(rev 11680)
+++ trunk/freenet/src/freenet/crypt/PCFBMode.java       2007-02-07 14:22:49 UTC 
(rev 11681)
@@ -32,13 +32,13 @@
        return new PCFBMode(c, iv);
     }

-    PCFBMode(BlockCipher c) {
+    protected PCFBMode(BlockCipher c) {
         this.c = c;
         feedback_register = new byte[c.getBlockSize() >> 3];
         registerPointer = feedback_register.length;
     }

-    PCFBMode(BlockCipher c, byte[] iv) {
+    protected PCFBMode(BlockCipher c, byte[] iv) {
         this(c);
         System.arraycopy(iv, 0, feedback_register, 0, 
feedback_register.length);
     }
@@ -156,7 +156,7 @@

     // Refills the encrypted buffer with data.
     //private synchronized void refillBuffer() {
-    private void refillBuffer() {
+    protected void refillBuffer() {
         // Encrypt feedback into result
         c.encipher(feedback_register, feedback_register);



Reply via email to