diff options
author | Jack Lloyd <[email protected]> | 2015-09-21 14:59:01 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-09-21 14:59:01 -0400 |
commit | 04319af23bf8ed467b17f9b74c814343e051ab6b (patch) | |
tree | 630d1a0cc931e77e7e1f07319e5cf89d00af4458 /src/lib/kdf/prf_tls/prf_tls.cpp | |
parent | 408ea0a9b8ed0f575f8ee26891473920b42ef026 (diff) |
Remove use of lookup.h in favor of new T::create API.
Diffstat (limited to 'src/lib/kdf/prf_tls/prf_tls.cpp')
-rw-r--r-- | src/lib/kdf/prf_tls/prf_tls.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/kdf/prf_tls/prf_tls.cpp b/src/lib/kdf/prf_tls/prf_tls.cpp index 382f527ea..547b0c9c8 100644 --- a/src/lib/kdf/prf_tls/prf_tls.cpp +++ b/src/lib/kdf/prf_tls/prf_tls.cpp @@ -7,23 +7,26 @@ #include <botan/prf_tls.h> #include <botan/hmac.h> -#include <botan/lookup.h> namespace Botan { TLS_12_PRF* TLS_12_PRF::make(const Spec& spec) { - if(auto mac = get_mac(spec.arg(0))) - return new TLS_12_PRF(mac); - if(auto hash = get_hash_function(spec.arg(0))) - return new TLS_12_PRF(new HMAC(hash)); + if(auto mac = MessageAuthenticationCode::create(spec.arg(0))) + return new TLS_12_PRF(mac.release()); + + if(auto mac = MessageAuthenticationCode::create("HMAC(" + spec.arg(0) + ")")) + return new TLS_12_PRF(mac.release()); + return nullptr; } TLS_PRF::TLS_PRF() : - m_hmac_md5(make_message_auth("HMAC(MD5)")), - m_hmac_sha1(make_message_auth("HMAC(SHA-1)")) + m_hmac_md5(MessageAuthenticationCode::create("HMAC(MD5)")), + m_hmac_sha1(MessageAuthenticationCode::create("HMAC(SHA-1)")) { + if(!m_hmac_md5 || !m_hmac_sha1) + throw Algorithm_Not_Found("TLS_PRF HMACs not available"); } namespace { |