From d21de17f070863c7e0b7e8d254eb35689001a53a Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Thu, 10 Sep 2015 01:45:47 -0400 Subject: Fix static lib registration for block, hash, mac, stream, kdf The support problems from having static libraries not work in the obvious way will be endless trouble. Instead have each set of registrations tag along in a source file for the basic type, at the cost of some extra ifdefs. On shared libs this is harmless - everything is going into the shared object anyway. With static libs, this means pulling in a single block cipher pulls in the text of all the them. But that's still strictly better than the amalgamation (which is really pulling in everything), and it works (unlike status quo). --- src/lib/kdf/kdf.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'src/lib/kdf/kdf.cpp') 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 -#include -#include +#include + +#if defined(BOTAN_HAS_HKDF) +#include +#endif + +#if defined(BOTAN_HAS_KDF1) +#include +#endif + +#if defined(BOTAN_HAS_KDF2) +#include +#endif + +#if defined(BOTAN_HAS_TLS_V10_PRF) +#include +#endif + +#if defined(BOTAN_HAS_TLS_V12_PRF) +#include +#endif + +#if defined(BOTAN_HAS_X942_PRF) +#include +#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 + } -- cgit v1.2.3