summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-08-24 17:09:43 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-08-24 17:09:43 +0700
commit73f5dba3f2de4b35e9aec4580ffdf4c365f6fd6a (patch)
tree0122b54a537827da87137b2ec31bbf99a9185170 /crypto/src
parentFix TLS test namespace (diff)
downloadBouncyCastle.NET-ed25519-73f5dba3f2de4b35e9aec4580ffdf4c365f6fd6a.tar.xz
Fix initial bugs revealed by new TLS test
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/crypto/tls/DefaultTlsSignerCredentials.cs2
-rw-r--r--crypto/src/crypto/tls/DeferredHash.cs10
2 files changed, 8 insertions, 4 deletions
diff --git a/crypto/src/crypto/tls/DefaultTlsSignerCredentials.cs b/crypto/src/crypto/tls/DefaultTlsSignerCredentials.cs
index ef80c4b06..c7a136573 100644
--- a/crypto/src/crypto/tls/DefaultTlsSignerCredentials.cs
+++ b/crypto/src/crypto/tls/DefaultTlsSignerCredentials.cs
@@ -51,6 +51,8 @@ namespace Org.BouncyCastle.Crypto.Tls
                 throw new ArgumentException("type not supported: " + privateKey.GetType().FullName, "privateKey");
             }
 
+            this.mSigner.Init(context);
+
             this.mContext = context;
             this.mCertificate = certificate;
             this.mPrivateKey = privateKey;
diff --git a/crypto/src/crypto/tls/DeferredHash.cs b/crypto/src/crypto/tls/DeferredHash.cs
index c2d5ab5b6..1112d4a3c 100644
--- a/crypto/src/crypto/tls/DeferredHash.cs
+++ b/crypto/src/crypto/tls/DeferredHash.cs
@@ -73,12 +73,13 @@ namespace Org.BouncyCastle.Crypto.Tls
 
         public virtual TlsHandshakeHash StopTracking()
         {
-            IDigest prfHash = TlsUtilities.CloneHash((byte)mPrfHashAlgorithm, (IDigest)mHashes[mPrfHashAlgorithm]);
+            byte prfHashAlgorithm = (byte)mPrfHashAlgorithm;
+            IDigest prfHash = TlsUtilities.CloneHash(prfHashAlgorithm, (IDigest)mHashes[prfHashAlgorithm]);
             if (mBuf != null)
             {
                 mBuf.UpdateDigest(prfHash);
             }
-            DeferredHash result = new DeferredHash((byte)mPrfHashAlgorithm, prfHash);
+            DeferredHash result = new DeferredHash(prfHashAlgorithm, prfHash);
             result.Init(mContext);
             return result;
         }
@@ -87,14 +88,15 @@ namespace Org.BouncyCastle.Crypto.Tls
         {
             CheckStopBuffering();
 
+            byte prfHashAlgorithm = (byte)mPrfHashAlgorithm;
             if (mBuf != null)
             {
-                IDigest prfHash = TlsUtilities.CreateHash((byte)mPrfHashAlgorithm);
+                IDigest prfHash = TlsUtilities.CreateHash(prfHashAlgorithm);
                 mBuf.UpdateDigest(prfHash);
                 return prfHash;
             }
 
-            return TlsUtilities.CloneHash((byte)mPrfHashAlgorithm, (IDigest)mHashes[mPrfHashAlgorithm]);
+            return TlsUtilities.CloneHash(prfHashAlgorithm, (IDigest)mHashes[prfHashAlgorithm]);
         }
 
         public virtual byte[] GetFinalHash(byte hashAlgorithm)