aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls/tls_cbc
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-11-03 13:11:18 -0400
committerJack Lloyd <[email protected]>2016-11-03 13:11:18 -0400
commit660d985e92d030f4ec0c3503bc14363825183371 (patch)
tree8daeec407eab8f5dc7c00f83b08fc687abe9a8d9 /src/lib/tls/tls_cbc
parente42d1513fd6f80dcd2ae4109fddf53b61e935116 (diff)
Simplify some code by using T::create_or_throw
Diffstat (limited to 'src/lib/tls/tls_cbc')
-rw-r--r--src/lib/tls/tls_cbc/tls_cbc.cpp9
1 files changed, 2 insertions, 7 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();