diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-04-04 15:04:06 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-04-04 15:04:06 +0700 |
commit | c94fb8a244c23984a5a2e1ad46b15037351bb636 (patch) | |
tree | e32d335f18c059773f35a6e55544c2b4ab480c6a | |
parent | Use the TLS 1.0 PRF for the random block (diff) | |
download | BouncyCastle.NET-ed25519-c94fb8a244c23984a5a2e1ad46b15037351bb636.tar.xz |
Remove redundant Mac.Init calls
-rw-r--r-- | crypto/src/crypto/tls/TlsUtilities.cs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/src/crypto/tls/TlsUtilities.cs b/crypto/src/crypto/tls/TlsUtilities.cs index 5ed659ce7..2309fc3da 100644 --- a/crypto/src/crypto/tls/TlsUtilities.cs +++ b/crypto/src/crypto/tls/TlsUtilities.cs @@ -316,7 +316,7 @@ namespace Org.BouncyCastle.Crypto.Tls private static void hmac_hash(IDigest digest, byte[] secret, byte[] seed, byte[] output) { HMac mac = new HMac(digest); - KeyParameter param = new KeyParameter(secret); + mac.Init(new KeyParameter(secret)); byte[] a = seed; int size = digest.GetDigestSize(); int iterations = (output.Length + size - 1) / size; @@ -324,11 +324,9 @@ namespace Org.BouncyCastle.Crypto.Tls byte[] buf2 = new byte[mac.GetMacSize()]; for (int i = 0; i < iterations; i++) { - mac.Init(param); mac.BlockUpdate(a, 0, a.Length); mac.DoFinal(buf, 0); a = buf; - mac.Init(param); mac.BlockUpdate(a, 0, a.Length); mac.BlockUpdate(seed, 0, seed.Length); mac.DoFinal(buf2, 0); |