diff src/ch/ethz/ssh2/crypto/dh/DhGroupExchange.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 cb179051f0f2
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/crypto/dh/DhGroupExchange.java	Wed Jul 30 12:09:51 2014 -0700
+++ b/src/ch/ethz/ssh2/crypto/dh/DhGroupExchange.java	Wed Jul 30 14:16:58 2014 -0700
@@ -23,16 +23,16 @@
     private BigInteger p;
     private BigInteger g;
 
-	/* Client public and private */
+    /* Client public and private */
 
     private BigInteger e;
     private BigInteger x;
 
-	/* Server public */
+    /* Server public */
 
     private BigInteger f;
 
-	/* Shared secret */
+    /* Shared secret */
 
     private BigInteger k;
 
@@ -43,7 +43,6 @@
 
     public void init(SecureRandom rnd) {
         k = null;
-
         x = new BigInteger(p.bitLength() - 1, rnd);
         e = g.modPow(x, p);
     }
@@ -52,7 +51,7 @@
      * @return Returns the e.
      */
     public BigInteger getE() {
-        if(e == null) {
+        if (e == null) {
             throw new IllegalStateException("Not initialized!");
         }
 
@@ -63,7 +62,7 @@
      * @return Returns the shared secret k.
      */
     public BigInteger getK() {
-        if(k == null) {
+        if (k == null) {
             throw new IllegalStateException("Shared secret not yet known, need f first!");
         }
 
@@ -74,13 +73,13 @@
      * Sets f and calculates the shared secret.
      */
     public void setF(BigInteger f) {
-        if(e == null) {
+        if (e == null) {
             throw new IllegalStateException("Not initialized!");
         }
 
         BigInteger zero = BigInteger.valueOf(0);
 
-        if(zero.compareTo(f) >= 0 || p.compareTo(f) <= 0) {
+        if (zero.compareTo(f) >= 0 || p.compareTo(f) <= 0) {
             throw new IllegalArgumentException("Invalid f specified!");
         }
 
@@ -91,25 +90,27 @@
     public byte[] calculateH(byte[] clientversion, byte[] serverversion, byte[] clientKexPayload,
                              byte[] serverKexPayload, byte[] hostKey, DHGexParameters para) throws IOException {
         HashForSSH2Types hash = new HashForSSH2Types("SHA1");
-
         hash.updateByteString(clientversion);
         hash.updateByteString(serverversion);
         hash.updateByteString(clientKexPayload);
         hash.updateByteString(serverKexPayload);
         hash.updateByteString(hostKey);
-        if(para.getMin_group_len() > 0) {
+
+        if (para.getMin_group_len() > 0) {
             hash.updateUINT32(para.getMin_group_len());
         }
+
         hash.updateUINT32(para.getPref_group_len());
-        if(para.getMax_group_len() > 0) {
+
+        if (para.getMax_group_len() > 0) {
             hash.updateUINT32(para.getMax_group_len());
         }
+
         hash.updateBigInt(p);
         hash.updateBigInt(g);
         hash.updateBigInt(e);
         hash.updateBigInt(f);
         hash.updateBigInt(k);
-
         return hash.getDigest();
     }
 }