summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/tls/TlsUtilities.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/src/tls/TlsUtilities.cs b/crypto/src/tls/TlsUtilities.cs
index 05d38c59c..df098e20b 100644
--- a/crypto/src/tls/TlsUtilities.cs
+++ b/crypto/src/tls/TlsUtilities.cs
@@ -2088,7 +2088,7 @@ namespace Org.BouncyCastle.Tls
 
             TlsHash h = algorithm == null
                 ? new CombinedHash(crypto)
-                : CreateHash(crypto, algorithm.Hash);
+                : CreateHash(crypto, algorithm);
 
             SecurityParameters sp = context.SecurityParameters;
             // NOTE: The implicit copy here is intended (and important)
@@ -4255,6 +4255,14 @@ namespace Org.BouncyCastle.Tls
             return crypto.CreateHash(cryptoHashAlgorithm);
         }
 
+        private static TlsHash CreateHash(TlsCrypto crypto, SignatureAndHashAlgorithm signatureAndHashAlgorithm)
+        {
+            int signatureScheme = SignatureScheme.From(signatureAndHashAlgorithm);
+            int cryptoHashAlgorithm = SignatureScheme.GetCryptoHashAlgorithm(signatureScheme);
+
+            return crypto.CreateHash(cryptoHashAlgorithm);
+        }
+
         /// <exception cref="IOException"/>
         private static TlsKeyExchange CreateKeyExchangeClient(TlsClient client, int keyExchange)
         {