diff options
Diffstat (limited to 'src/lib/tls')
-rw-r--r-- | src/lib/tls/info.txt | 1 | ||||
-rw-r--r-- | src/lib/tls/tls_handshake_hash.cpp | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/tls/info.txt b/src/lib/tls/info.txt index a43d5619a..1373052e4 100644 --- a/src/lib/tls/info.txt +++ b/src/lib/tls/info.txt @@ -45,6 +45,7 @@ gcm hmac kdf2 md5 +par_hash prf_tls rng rsa diff --git a/src/lib/tls/tls_handshake_hash.cpp b/src/lib/tls/tls_handshake_hash.cpp index 00b8d744c..4f78bebbc 100644 --- a/src/lib/tls/tls_handshake_hash.cpp +++ b/src/lib/tls/tls_handshake_hash.cpp @@ -21,14 +21,19 @@ secure_vector<byte> Handshake_Hash::final(Protocol_Version version, { auto choose_hash = [=]() { if(!version.supports_ciphersuite_specific_prf()) - return "Parallel(MD5,SHA-160)";; + return "Parallel(MD5,SHA-160)"; if(mac_algo == "MD5" || mac_algo == "SHA-1") return "SHA-256"; return mac_algo.c_str(); }; - std::unique_ptr<HashFunction> hash(HashFunction::create(choose_hash())); + const std::string hash_algo = choose_hash(); + std::unique_ptr<HashFunction> hash(HashFunction::create(hash_algo)); + if(!hash) + { + throw Algorithm_Not_Found(hash_algo); + } hash->update(m_data); return hash->final(); } |