diff src/ch/ethz/ssh2/crypto/KeyMaterial.java @ 307:071eccdff8ea ganymed

fix java formatting
author Carl Byington <carl@five-ten-sg.com>
date Wed, 30 Jul 2014 14:16:58 -0700
parents 91a31873c42a
children
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/crypto/KeyMaterial.java	Wed Jul 30 12:09:51 2014 -0700
+++ b/src/ch/ethz/ssh2/crypto/KeyMaterial.java	Wed Jul 30 14:16:58 2014 -0700
@@ -26,38 +26,30 @@
     private static byte[] calculateKey(HashForSSH2Types sh, BigInteger K, byte[] H, byte type, byte[] SessionID,
                                        int keyLength) throws IOException {
         byte[] res = new byte[keyLength];
-
         int dglen = sh.getDigestLength();
         int numRounds = (keyLength + dglen - 1) / dglen;
-
         byte[][] tmp = new byte[numRounds][];
-
         sh.reset();
         sh.updateBigInt(K);
         sh.updateBytes(H);
         sh.updateByte(type);
         sh.updateBytes(SessionID);
-
         tmp[0] = sh.getDigest();
-
         int off = 0;
         int produced = Math.min(dglen, keyLength);
-
         System.arraycopy(tmp[0], 0, res, off, produced);
-
         keyLength -= produced;
         off += produced;
 
-        for(int i = 1; i < numRounds; i++) {
+        for (int i = 1; i < numRounds; i++) {
             sh.updateBigInt(K);
             sh.updateBytes(H);
 
-            for(int j = 0; j < i; j++) {
+            for (int j = 0; j < i; j++) {
                 sh.updateBytes(tmp[j]);
             }
 
             tmp[i] = sh.getDigest();
-
             produced = Math.min(dglen, keyLength);
             System.arraycopy(tmp[i], 0, res, off, produced);
             keyLength -= produced;
@@ -69,23 +61,15 @@
 
     public static KeyMaterial create(String hashType, byte[] H, BigInteger K, byte[] SessionID, int keyLengthCS,
                                      int blockSizeCS, int macLengthCS, int keyLengthSC, int blockSizeSC, int macLengthSC)
-            throws IOException {
+    throws IOException {
         KeyMaterial km = new KeyMaterial();
-
         HashForSSH2Types sh = new HashForSSH2Types(hashType);
-
         km.initial_iv_client_to_server = calculateKey(sh, K, H, (byte) 'A', SessionID, blockSizeCS);
-
         km.initial_iv_server_to_client = calculateKey(sh, K, H, (byte) 'B', SessionID, blockSizeSC);
-
         km.enc_key_client_to_server = calculateKey(sh, K, H, (byte) 'C', SessionID, keyLengthCS);
-
         km.enc_key_server_to_client = calculateKey(sh, K, H, (byte) 'D', SessionID, keyLengthSC);
-
         km.integrity_key_client_to_server = calculateKey(sh, K, H, (byte) 'E', SessionID, macLengthCS);
-
         km.integrity_key_server_to_client = calculateKey(sh, K, H, (byte) 'F', SessionID, macLengthSC);
-
         return km;
     }
 }