summary refs log tree commit diff
path: root/crypto/src/tls/TlsUtilities.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/tls/TlsUtilities.cs')
-rw-r--r--crypto/src/tls/TlsUtilities.cs8
1 files changed, 2 insertions, 6 deletions
diff --git a/crypto/src/tls/TlsUtilities.cs b/crypto/src/tls/TlsUtilities.cs

index 4cec13bae..52b554801 100644 --- a/crypto/src/tls/TlsUtilities.cs +++ b/crypto/src/tls/TlsUtilities.cs
@@ -1491,14 +1491,10 @@ namespace Org.BouncyCastle.Tls : securityParameters.BaseKeyClient; TlsSecret finishedKey = DeriveSecret(securityParameters, baseKey, "finished", EmptyBytes); + int cryptoHashAlgorithm = TlsCryptoUtilities.GetHash(securityParameters.PrfHashAlgorithm); byte[] transcriptHash = GetCurrentPrfHash(handshakeHash); - TlsCrypto crypto = context.Crypto; - byte[] hmacKey = crypto.AdoptSecret(finishedKey).Extract(); - TlsHmac hmac = crypto.CreateHmacForHash(TlsCryptoUtilities.GetHash(securityParameters.PrfHashAlgorithm)); - hmac.SetKey(hmacKey, 0, hmacKey.Length); - hmac.Update(transcriptHash, 0, transcriptHash.Length); - return hmac.CalculateMac(); + return finishedKey.CalculateHmac(cryptoHashAlgorithm, transcriptHash, 0, transcriptHash.Length); } if (negotiatedVersion.IsSsl)