diff options
Diffstat (limited to 'crypto/src/tls/DeferredHash.cs')
-rw-r--r-- | crypto/src/tls/DeferredHash.cs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/crypto/src/tls/DeferredHash.cs b/crypto/src/tls/DeferredHash.cs index f97e9c088..ac66c8f0c 100644 --- a/crypto/src/tls/DeferredHash.cs +++ b/crypto/src/tls/DeferredHash.cs @@ -38,7 +38,7 @@ namespace Org.BouncyCastle.Tls throw new InvalidOperationException("Not buffering"); } - m_buf.CopyTo(output); + m_buf.CopyInputTo(output); } public void ForceBuffering() @@ -97,8 +97,8 @@ namespace Org.BouncyCastle.Tls case PrfAlgorithm.ssl_prf_legacy: case PrfAlgorithm.tls_prf_legacy: { - CloneHash(newHashes, HashAlgorithm.md5); - CloneHash(newHashes, HashAlgorithm.sha1); + CloneHash(newHashes, CryptoHashAlgorithm.md5); + CloneHash(newHashes, CryptoHashAlgorithm.sha1); break; } default: @@ -126,7 +126,9 @@ namespace Org.BouncyCastle.Tls case PrfAlgorithm.ssl_prf_legacy: case PrfAlgorithm.tls_prf_legacy: { - prfHash = new CombinedHash(m_context, CloneHash(HashAlgorithm.md5), CloneHash(HashAlgorithm.sha1)); + TlsHash md5Hash = CloneHash(CryptoHashAlgorithm.md5); + TlsHash sha1Hash = CloneHash(CryptoHashAlgorithm.sha1); + prfHash = new CombinedHash(m_context, md5Hash, sha1Hash); break; } default: @@ -146,20 +148,20 @@ namespace Org.BouncyCastle.Tls public byte[] GetFinalHash(int cryptoHashAlgorithm) { - TlsHash d = (TlsHash)m_hashes[cryptoHashAlgorithm]; - if (d == null) + TlsHash hash = (TlsHash)m_hashes[cryptoHashAlgorithm]; + if (hash == null) throw new InvalidOperationException("CryptoHashAlgorithm." + cryptoHashAlgorithm + " is not being tracked"); CheckStopBuffering(); - d = d.CloneHash(); + hash = hash.CloneHash(); if (m_buf != null) { - m_buf.UpdateDigest(d); + m_buf.UpdateDigest(hash); } - return d.CalculateHash(); + return hash.CalculateHash(); } public void Update(byte[] input, int inOff, int len) |