gnu-crypto-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNU Crypto] Patches to jessie 1.0.1 and gnu-crypto 2.0.1


From: Doug
Subject: [GNU Crypto] Patches to jessie 1.0.1 and gnu-crypto 2.0.1
Date: Thu, 1 Jun 2006 08:05:50 -0300
User-agent: KMail/1.7.2

Here are patches for changes I made to compile with jikes, and to close some 
files left open.


diff -ru /usr/src/jessie-1.0.1/org/metastatic/jessie/provider/SSLSocket.java 
jessie-1.0.1-customized/org/metastatic/jessie/provider/SSLSocket.java
--- /usr/src/jessie-1.0.1/org/metastatic/jessie/provider/SSLSocket.java 
2006-06-01 07:01:36.000000000 -0300
+++ jessie-1.0.1-customized/org/metastatic/jessie/provider/SSLSocket.java       
2006-05-21 20:03:23.000000000 -0300
@@ -108,7 +108,6 @@
 import javax.security.auth.callback.TextInputCallback;
 
 import gnu.crypto.Registry;
-import gnu.crypto.auth.callback.DefaultCallbackHandler;
 import gnu.crypto.hash.HashFactory;
 import gnu.crypto.hash.IMessageDigest;
 import gnu.crypto.key.IKeyAgreementParty;
@@ -136,6 +135,7 @@
 import gnu.crypto.sig.rsa.EME_PKCS1_V1_5;
 import gnu.crypto.sig.rsa.RSA;
 
+import org.metastatic.callbacks.DefaultCallbackHandler;
 import org.metastatic.jessie.SRPTrustManager;
 
 /**
diff 
-ru 
/usr/src/jessie-1.0.1/org/metastatic/jessie/provider/SynchronizedRandom.java 
jessie-1.0.1-customized/org/metastatic/jessie/provider/SynchronizedRandom.java
--- 
/usr/src/jessie-1.0.1/org/metastatic/jessie/provider/SynchronizedRandom.java    
    
2006-06-01 07:01:36.000000000 -0300
+++ 
jessie-1.0.1-customized/org/metastatic/jessie/provider/SynchronizedRandom.java  
2006-05-21 19:40:41.000000000 -0300
@@ -51,7 +51,7 @@
   // Field.
   // 
-------------------------------------------------------------------------
 
-  private final IRandom random;
+  private IRandom random;
 
   // Constructor.
   // 
-------------------------------------------------------------------------



diff -ru /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/Properties.java 
gnu-crypto-2.0.1-customized/source/gnu/crypto/Properties.java
--- /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/Properties.java 2004-01-14 
21:17:42.000000000 -0200
+++ gnu-crypto-2.0.1-customized/source/gnu/crypto/Properties.java       
2005-11-01 
00:12:57.000000000 -0200
@@ -298,9 +298,10 @@
          if (DEBUG) debug("Reading property "+PROPERTIES_FILE+" not allowed. 
Ignored.");
       }
       if (propFile != null) {
+        FileInputStream fin = null;
          try {
+            fin = new FileInputStream(propFile);
             final java.util.Properties temp = new java.util.Properties();
-            final FileInputStream fin = new FileInputStream(propFile);
             temp.load(fin);
             temp.list(System.out);
             props.putAll(temp);
@@ -308,6 +309,13 @@
             if (DEBUG) debug("IO error reading "+propFile+": 
"+ioe.getMessage());
          } catch (SecurityException se) {
             if (DEBUG) debug("Security error reading "+propFile+": 
"+se.getMessage());
+         } finally {
+             if (fin != null) {
+                 try {
+                     fin.close();
+                 } catch (IOException ignored) {
+                 }
+             }
          }
       }
 
diff -ru /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/mac/TMMH16.java 
gnu-crypto-2.0.1-customized/source/gnu/crypto/mac/TMMH16.java
--- /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/mac/TMMH16.java 2002-11-07 
15:17:45.000000000 -0200
+++ gnu-crypto-2.0.1-customized/source/gnu/crypto/mac/TMMH16.java       
2006-05-21 
19:46:38.000000000 -0300
@@ -126,7 +126,11 @@
       this();
 
       this.tagWords = that.tagWords;
-      this.keystream = (IRandom) that.keystream.clone();
+      try {
+         this.keystream = (IRandom) that.keystream.clone();
+      } catch (CloneNotSupportedException x) {
+         /* probably important to do something here */
+      }
       this.keyWords = that.keyWords;
       this.msgLength = that.msgLength;
       this.msgWords = that.msgWords;
diff -ru /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/prng/IRandom.java 
gnu-crypto-2.0.1-customized/source/gnu/crypto/prng/IRandom.java
--- /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/prng/IRandom.java       
2003-10-25 
01:55:06.000000000 -0200
+++ gnu-crypto-2.0.1-customized/source/gnu/crypto/prng/IRandom.java     
2006-05-21 
19:41:28.000000000 -0300
@@ -142,5 +142,5 @@
     *
     * @return a clone copy of this instance.
     */
-   Object clone();
+   public Object clone() throws CloneNotSupportedException;
 }
diff 
-ru /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/sasl/crammd5/PasswordFile.java 
gnu-crypto-2.0.1-customized/source/gnu/crypto/sasl/crammd5/PasswordFile.java
--- /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/sasl/crammd5/PasswordFile.java  
2003-12-24 23:59:44.000000000 -0200
+++ 
gnu-crypto-2.0.1-customized/source/gnu/crypto/sasl/crammd5/PasswordFile.java    
2005-10-31 23:18:41.000000000 -0200
@@ -152,7 +152,9 @@
 
    private synchronized void update() throws IOException {
       lastmod = passwdFile.lastModified();
-      readPasswd(new FileInputStream(passwdFile));
+      FileInputStream fis = new FileInputStream(passwdFile); 
+      readPasswd(fis);
+      fis.close();
    }
 
    private void checkCurrent() throws IOException {
diff 
-ru /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/sasl/plain/PasswordFile.java 
gnu-crypto-2.0.1-customized/source/gnu/crypto/sasl/plain/PasswordFile.java
--- /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/sasl/plain/PasswordFile.java    
2003-05-10 15:53:57.000000000 -0300
+++ gnu-crypto-2.0.1-customized/source/gnu/crypto/sasl/plain/PasswordFile.java  
2005-10-31 23:20:36.000000000 -0200
@@ -153,7 +153,9 @@
 
    private synchronized void update() throws IOException {
       lastmod = passwdFile.lastModified();
-      readPasswd(new FileInputStream(passwdFile));
+      FileInputStream fis = new FileInputStream(passwdFile); 
+      readPasswd(fis);
+      fis.close();
    }
 
    private void checkCurrent() throws IOException {
diff 
-ru /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/sasl/srp/PasswordFile.java 
gnu-crypto-2.0.1-customized/source/gnu/crypto/sasl/srp/PasswordFile.java
--- /usr/src/gnu-crypto-2.0.1/source/gnu/crypto/sasl/srp/PasswordFile.java      
2003-12-24 23:51:20.000000000 -0200
+++ gnu-crypto-2.0.1-customized/source/gnu/crypto/sasl/srp/PasswordFile.java    
2005-11-01 00:11:47.000000000 -0200
@@ -381,7 +381,7 @@
 
    private synchronized void readOrCreateConf() throws IOException {
       configurations.clear();
-      final FileInputStream fis;
+      FileInputStream fis = null;
       configFile = new File(confName);
       try {
          fis = new FileInputStream(configFile);
@@ -408,6 +408,11 @@
             }
          }
       }
+      finally {
+          if (fis != null) {
+              fis.close();
+          }
+      }
    }
 
    private void readConf(final InputStream in) throws IOException {
@@ -480,13 +485,18 @@
    private synchronized void update() throws IOException {
       entries.clear();
 
-      FileInputStream fis;
+      FileInputStream fis = null;
       passwdFile = new File(pwName);
       lastmodPasswdFile = passwdFile.lastModified();
       try {
          fis = new FileInputStream(passwdFile);
          readPasswd(fis);
+         fis.close();
       } catch (FileNotFoundException ignored) {
+      } finally {
+          if (fis != null) {
+              fis.close();
+          }
       }
       passwd2File = new File(pw2Name);
       lastmodPasswd2File = passwd2File.lastModified();
@@ -494,6 +504,8 @@
          fis = new FileInputStream(passwd2File);
          readPasswd2(fis);
       } catch (FileNotFoundException ignored) {
+      } finally {
+         fis.close();
       }
    }
 
diff 
-ru /usr/src/gnu-crypto-2.0.1/source/gnu/testlet/gnu/crypto/jce/TestOfMac.java 
gnu-crypto-2.0.1-customized/source/gnu/testlet/gnu/crypto/jce/TestOfMac.java
--- /usr/src/gnu-crypto-2.0.1/source/gnu/testlet/gnu/crypto/jce/TestOfMac.java  
2003-09-26 21:05:29.000000000 -0300
+++ 
gnu-crypto-2.0.1-customized/source/gnu/testlet/gnu/crypto/jce/TestOfMac.java    
2006-05-21 19:44:42.000000000 -0300
@@ -135,7 +135,11 @@
             rand.init(new HashMap());
             Integer tagLen = new Integer(4);
             params = new TMMHParameterSpec(rand, tagLen);
-            attrib.put(TMMH16.KEYSTREAM, rand.clone());
+            try {
+               attrib.put(TMMH16.KEYSTREAM, rand.clone());
+            } catch (CloneNotSupportedException x) {
+               harness.fail("MacFactory.getInstance("+macName+"): 
"+String.valueOf(x));
+            }
             attrib.put(TMMH16.TAG_LENGTH, tagLen);
          }
 

____________________________________________________________________________
Tiger Envelopes warning: Sent this message without an envelope. Anyone could 
have read it.
Stop snoops reading your email. For free. Forever. http://TigerPrivacy.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]