aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-09-21 14:59:01 -0400
committerJack Lloyd <[email protected]>2015-09-21 14:59:01 -0400
commit04319af23bf8ed467b17f9b74c814343e051ab6b (patch)
tree630d1a0cc931e77e7e1f07319e5cf89d00af4458 /src/lib/tls
parent408ea0a9b8ed0f575f8ee26891473920b42ef026 (diff)
Remove use of lookup.h in favor of new T::create API.
Diffstat (limited to 'src/lib/tls')
-rw-r--r--src/lib/tls/msg_hello_verify.cpp3
-rw-r--r--src/lib/tls/sessions_sql/tls_session_manager_sql.cpp1
-rw-r--r--src/lib/tls/tls_ciphersuite.cpp10
-rw-r--r--src/lib/tls/tls_handshake_hash.cpp3
-rw-r--r--src/lib/tls/tls_record.cpp22
5 files changed, 14 insertions, 25 deletions
diff --git a/src/lib/tls/msg_hello_verify.cpp b/src/lib/tls/msg_hello_verify.cpp
index a3c439750..c1dc574d4 100644
--- a/src/lib/tls/msg_hello_verify.cpp
+++ b/src/lib/tls/msg_hello_verify.cpp
@@ -7,7 +7,6 @@
#include <botan/internal/tls_messages.h>
#include <botan/mac.h>
-#include <botan/lookup.h>
namespace Botan {
@@ -36,7 +35,7 @@ Hello_Verify_Request::Hello_Verify_Request(const std::vector<byte>& client_hello
const std::string& client_identity,
const SymmetricKey& secret_key)
{
- std::unique_ptr<MessageAuthenticationCode> hmac(get_mac("HMAC(SHA-256)"));
+ std::unique_ptr<MessageAuthenticationCode> hmac(MessageAuthenticationCode::create("HMAC(SHA-256)"));
hmac->set_key(secret_key);
hmac->update_be(client_hello_bits.size());
diff --git a/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp b/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp
index 508f8ff2f..ed207972e 100644
--- a/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp
+++ b/src/lib/tls/sessions_sql/tls_session_manager_sql.cpp
@@ -8,7 +8,6 @@
#include <botan/tls_session_manager_sql.h>
#include <botan/database.h>
#include <botan/pbkdf.h>
-#include <botan/lookup.h>
#include <botan/hex.h>
#include <botan/loadstor.h>
#include <chrono>
diff --git a/src/lib/tls/tls_ciphersuite.cpp b/src/lib/tls/tls_ciphersuite.cpp
index c0f9dbf76..4fdf33811 100644
--- a/src/lib/tls/tls_ciphersuite.cpp
+++ b/src/lib/tls/tls_ciphersuite.cpp
@@ -7,7 +7,6 @@
#include <botan/tls_ciphersuite.h>
#include <botan/parsing.h>
-#include <botan/lookup.h>
#include <botan/block_cipher.h>
#include <botan/stream_cipher.h>
#include <botan/hash.h>
@@ -104,16 +103,13 @@ namespace {
bool have_hash(const std::string& prf)
{
- return (!get_hash_function_providers(prf).empty());
+ return (HashFunction::providers(prf).size() > 0);
}
bool have_cipher(const std::string& cipher)
{
- if(!get_block_cipher_providers(cipher).empty())
- return true;
- if(!get_stream_cipher_providers(cipher).empty())
- return true;
- return false;
+ return (BlockCipher::providers(cipher).size() > 0) ||
+ (StreamCipher::providers(cipher).size() > 0);
}
}
diff --git a/src/lib/tls/tls_handshake_hash.cpp b/src/lib/tls/tls_handshake_hash.cpp
index 94c2774c5..615767cc2 100644
--- a/src/lib/tls/tls_handshake_hash.cpp
+++ b/src/lib/tls/tls_handshake_hash.cpp
@@ -7,7 +7,6 @@
#include <botan/internal/tls_handshake_hash.h>
#include <botan/tls_exceptn.h>
-#include <botan/lookup.h>
#include <botan/hash.h>
namespace Botan {
@@ -29,7 +28,7 @@ secure_vector<byte> Handshake_Hash::final(Protocol_Version version,
return mac_algo.c_str();
};
- std::unique_ptr<HashFunction> hash(make_hash_function(choose_hash()));
+ std::unique_ptr<HashFunction> hash(HashFunction::create(choose_hash()));
hash->update(data);
return hash->final();
}
diff --git a/src/lib/tls/tls_record.cpp b/src/lib/tls/tls_record.cpp
index 53521c5da..71542de16 100644
--- a/src/lib/tls/tls_record.cpp
+++ b/src/lib/tls/tls_record.cpp
@@ -12,7 +12,6 @@
#include <botan/internal/tls_seq_numbers.h>
#include <botan/internal/tls_session_key.h>
#include <botan/internal/rounding.h>
-#include <botan/lookup.h>
#include <botan/rng.h>
namespace Botan {
@@ -62,20 +61,17 @@ Connection_Cipher_State::Connection_Cipher_State(Protocol_Version version,
return;
}
- if(BlockCipher* bc = get_block_cipher(cipher_algo))
- {
- m_block_cipher.reset(bc);
- m_block_cipher->set_key(cipher_key);
- m_block_cipher_cbc_state = iv.bits_of();
- m_block_size = bc->block_size();
-
- if(version.supports_explicit_cbc_ivs())
- m_iv_size = m_block_size;
- }
- else
+ m_block_cipher = BlockCipher::create(cipher_algo);
+ m_mac = MessageAuthenticationCode::create("HMAC(" + mac_algo + ")");
+ if(!m_block_cipher)
throw Invalid_Argument("Unknown TLS cipher " + cipher_algo);
- m_mac.reset(get_mac("HMAC(" + mac_algo + ")"));
+ m_block_cipher->set_key(cipher_key);
+ m_block_cipher_cbc_state = iv.bits_of();
+ m_block_size = m_block_cipher->block_size();
+
+ if(version.supports_explicit_cbc_ivs())
+ m_iv_size = m_block_size;
m_mac->set_key(mac_key);
}