aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/kdf
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/kdf')
-rw-r--r--src/lib/kdf/hkdf/hkdf.cpp2
-rw-r--r--src/lib/kdf/kdf.cpp51
-rw-r--r--src/lib/kdf/kdf1/kdf1.cpp2
-rw-r--r--src/lib/kdf/kdf2/kdf2.cpp2
-rw-r--r--src/lib/kdf/prf_tls/prf_tls.cpp3
-rw-r--r--src/lib/kdf/prf_x942/prf_x942.cpp2
6 files changed, 49 insertions, 13 deletions
diff --git a/src/lib/kdf/hkdf/hkdf.cpp b/src/lib/kdf/hkdf/hkdf.cpp
index b643db6d9..df6e49fad 100644
--- a/src/lib/kdf/hkdf/hkdf.cpp
+++ b/src/lib/kdf/hkdf/hkdf.cpp
@@ -10,8 +10,6 @@
namespace Botan {
-BOTAN_REGISTER_NAMED_T(KDF, "HKDF", HKDF, HKDF::make);
-
HKDF* HKDF::make(const Spec& spec)
{
if(auto mac = get_mac(spec.arg(0)))
diff --git a/src/lib/kdf/kdf.cpp b/src/lib/kdf/kdf.cpp
index 793cd3d62..89bb8d58a 100644
--- a/src/lib/kdf/kdf.cpp
+++ b/src/lib/kdf/kdf.cpp
@@ -6,8 +6,31 @@
*/
#include <botan/kdf.h>
-#include <botan/internal/algo_registry.h>
-#include <botan/exceptn.h>
+#include <botan/internal/kdf_utils.h>
+
+#if defined(BOTAN_HAS_HKDF)
+#include <botan/hkdf.h>
+#endif
+
+#if defined(BOTAN_HAS_KDF1)
+#include <botan/kdf1.h>
+#endif
+
+#if defined(BOTAN_HAS_KDF2)
+#include <botan/kdf2.h>
+#endif
+
+#if defined(BOTAN_HAS_TLS_V10_PRF)
+#include <botan/prf_tls.h>
+#endif
+
+#if defined(BOTAN_HAS_TLS_V12_PRF)
+#include <botan/prf_tls.h>
+#endif
+
+#if defined(BOTAN_HAS_X942_PRF)
+#include <botan/prf_x942.h>
+#endif
namespace Botan {
@@ -23,4 +46,28 @@ KDF* get_kdf(const std::string& algo_spec)
throw Algorithm_Not_Found(algo_spec);
}
+#if defined(BOTAN_HAS_HKDF)
+BOTAN_REGISTER_NAMED_T(KDF, "HKDF", HKDF, HKDF::make);
+#endif
+
+#if defined(BOTAN_HAS_KDF1)
+BOTAN_REGISTER_KDF_1HASH(KDF1, "KDF1");
+#endif
+
+#if defined(BOTAN_HAS_KDF2)
+BOTAN_REGISTER_KDF_1HASH(KDF2, "KDF2");
+#endif
+
+#if defined(BOTAN_HAS_TLS_V10_PRF)
+BOTAN_REGISTER_KDF_NOARGS(TLS_PRF, "TLS-PRF");
+#endif
+
+#if defined(BOTAN_HAS_TLS_V12_PRF)
+BOTAN_REGISTER_NAMED_T(KDF, "TLS-12-PRF", TLS_12_PRF, TLS_12_PRF::make);
+#endif
+
+#if defined(BOTAN_HAS_X942_PRF)
+BOTAN_REGISTER_KDF_NAMED_1STR(X942_PRF, "X9.42-PRF");
+#endif
+
}
diff --git a/src/lib/kdf/kdf1/kdf1.cpp b/src/lib/kdf/kdf1/kdf1.cpp
index fa3432467..c87bacd27 100644
--- a/src/lib/kdf/kdf1/kdf1.cpp
+++ b/src/lib/kdf/kdf1/kdf1.cpp
@@ -10,8 +10,6 @@
namespace Botan {
-BOTAN_REGISTER_KDF_1HASH(KDF1, "KDF1");
-
size_t KDF1::kdf(byte key[], size_t key_len,
const byte secret[], size_t secret_len,
const byte salt[], size_t salt_len) const
diff --git a/src/lib/kdf/kdf2/kdf2.cpp b/src/lib/kdf/kdf2/kdf2.cpp
index 9deb1a22f..1b1c3638a 100644
--- a/src/lib/kdf/kdf2/kdf2.cpp
+++ b/src/lib/kdf/kdf2/kdf2.cpp
@@ -10,8 +10,6 @@
namespace Botan {
-BOTAN_REGISTER_KDF_1HASH(KDF2, "KDF2");
-
size_t KDF2::kdf(byte key[], size_t key_len,
const byte secret[], size_t secret_len,
const byte salt[], size_t salt_len) const
diff --git a/src/lib/kdf/prf_tls/prf_tls.cpp b/src/lib/kdf/prf_tls/prf_tls.cpp
index 4fdec8fef..ef130d5ba 100644
--- a/src/lib/kdf/prf_tls/prf_tls.cpp
+++ b/src/lib/kdf/prf_tls/prf_tls.cpp
@@ -20,9 +20,6 @@ TLS_12_PRF* TLS_12_PRF::make(const Spec& spec)
return nullptr;
}
-BOTAN_REGISTER_NAMED_T(KDF, "TLS-12-PRF", TLS_12_PRF, TLS_12_PRF::make);
-BOTAN_REGISTER_KDF_NOARGS(TLS_PRF, "TLS-PRF");
-
TLS_PRF::TLS_PRF() :
m_hmac_md5(make_message_auth("HMAC(MD5)")),
m_hmac_sha1(make_message_auth("HMAC(SHA-1)"))
diff --git a/src/lib/kdf/prf_x942/prf_x942.cpp b/src/lib/kdf/prf_x942/prf_x942.cpp
index 622d68c1a..e8f234e49 100644
--- a/src/lib/kdf/prf_x942/prf_x942.cpp
+++ b/src/lib/kdf/prf_x942/prf_x942.cpp
@@ -15,8 +15,6 @@
namespace Botan {
-BOTAN_REGISTER_KDF_NAMED_1STR(X942_PRF, "X9.42-PRF");
-
namespace {
/*