summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-05-05 01:22:38 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-05-05 01:22:38 +0700
commitc49b23e895313210ed9b53855f873c7650018773 (patch)
tree9071f994a7e5ea88477790104b8736fce54492a0
parentTLS PSS raw signatures (diff)
downloadBouncyCastle.NET-ed25519-c49b23e895313210ed9b53855f873c7650018773.tar.xz
Followup fix for PSS changes
-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)
         {