diff options
Diffstat (limited to 'src/lib/tls')
-rw-r--r-- | src/lib/tls/tls_cbc/tls_cbc.cpp | 9 | ||||
-rw-r--r-- | src/lib/tls/tls_handshake_hash.cpp | 6 |
2 files changed, 3 insertions, 12 deletions
diff --git a/src/lib/tls/tls_cbc/tls_cbc.cpp b/src/lib/tls/tls_cbc/tls_cbc.cpp index 71ad41114..ef397e44d 100644 --- a/src/lib/tls/tls_cbc/tls_cbc.cpp +++ b/src/lib/tls/tls_cbc/tls_cbc.cpp @@ -33,13 +33,8 @@ TLS_CBC_HMAC_AEAD_Mode::TLS_CBC_HMAC_AEAD_Mode(const std::string& cipher_name, m_mac_keylen(mac_keylen), m_use_encrypt_then_mac(use_encrypt_then_mac) { - m_cipher = BlockCipher::create(m_cipher_name); - if(!m_cipher) - throw Algorithm_Not_Found(m_cipher_name); - - m_mac = MessageAuthenticationCode::create("HMAC(" + m_mac_name + ")"); - if(!m_mac) - throw Algorithm_Not_Found("HMAC(" + m_mac_name + ")"); + m_cipher = BlockCipher::create_or_throw(m_cipher_name); + m_mac = MessageAuthenticationCode::create_or_throw("HMAC(" + m_mac_name + ")"); m_tag_size = m_mac->output_length(); m_block_size = m_cipher->block_size(); diff --git a/src/lib/tls/tls_handshake_hash.cpp b/src/lib/tls/tls_handshake_hash.cpp index 4f78bebbc..540f1de14 100644 --- a/src/lib/tls/tls_handshake_hash.cpp +++ b/src/lib/tls/tls_handshake_hash.cpp @@ -29,11 +29,7 @@ secure_vector<byte> Handshake_Hash::final(Protocol_Version version, }; const std::string hash_algo = choose_hash(); - std::unique_ptr<HashFunction> hash(HashFunction::create(hash_algo)); - if(!hash) - { - throw Algorithm_Not_Found(hash_algo); - } + std::unique_ptr<HashFunction> hash(HashFunction::create_or_throw(hash_algo)); hash->update(m_data); return hash->final(); } |