diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-10-22 12:18:49 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2018-10-22 12:18:49 +0700 |
commit | 05243058a15f56cf8793d7a0e81467a0fa25672b (patch) | |
tree | 683ed8e80c53c3a08dc1ca5e5f846a8b377dfb14 | |
parent | DH_anon cipher suites are considered ephemeral DH (diff) | |
download | BouncyCastle.NET-ed25519-05243058a15f56cf8793d7a0e81467a0fa25672b.tar.xz |
Don't try to track unrecognized hash algorithms
-rw-r--r-- | crypto/src/crypto/tls/HashAlgorithm.cs | 16 | ||||
-rw-r--r-- | crypto/src/crypto/tls/TlsUtilities.cs | 7 |
2 files changed, 21 insertions, 2 deletions
diff --git a/crypto/src/crypto/tls/HashAlgorithm.cs b/crypto/src/crypto/tls/HashAlgorithm.cs index 0f38e2d7c..a6b42d4ed 100644 --- a/crypto/src/crypto/tls/HashAlgorithm.cs +++ b/crypto/src/crypto/tls/HashAlgorithm.cs @@ -45,5 +45,21 @@ namespace Org.BouncyCastle.Crypto.Tls { return 224 <= hashAlgorithm && hashAlgorithm <= 255; } + + public static bool IsRecognized(byte hashAlgorithm) + { + switch (hashAlgorithm) + { + case md5: + case sha1: + case sha224: + case sha256: + case sha384: + case sha512: + return true; + default: + return false; + } + } } } diff --git a/crypto/src/crypto/tls/TlsUtilities.cs b/crypto/src/crypto/tls/TlsUtilities.cs index 48eb9d375..698bf6da6 100644 --- a/crypto/src/crypto/tls/TlsUtilities.cs +++ b/crypto/src/crypto/tls/TlsUtilities.cs @@ -1199,11 +1199,14 @@ namespace Org.BouncyCastle.Crypto.Tls { byte hashAlgorithm = signatureAndHashAlgorithm.Hash; - // TODO Support values in the "Reserved for Private Use" range - if (!HashAlgorithm.IsPrivate(hashAlgorithm)) + if (HashAlgorithm.IsRecognized(hashAlgorithm)) { handshakeHash.TrackHashAlgorithm(hashAlgorithm); } + else //if (HashAlgorithm.IsPrivate(hashAlgorithm)) + { + // TODO Support values in the "Reserved for Private Use" range + } } } } |