diff options
Diffstat (limited to 'src/lib/pbkdf')
-rw-r--r-- | src/lib/pbkdf/info.txt | 4 | ||||
-rw-r--r-- | src/lib/pbkdf/pbkdf.cpp | 20 | ||||
-rw-r--r-- | src/lib/pbkdf/pbkdf1/pbkdf1.cpp | 3 | ||||
-rw-r--r-- | src/lib/pbkdf/pbkdf2/pbkdf2.cpp | 4 | ||||
-rw-r--r-- | src/lib/pbkdf/pbkdf_utils.h | 23 |
5 files changed, 21 insertions, 33 deletions
diff --git a/src/lib/pbkdf/info.txt b/src/lib/pbkdf/info.txt index 81f7c1260..3addbdb58 100644 --- a/src/lib/pbkdf/info.txt +++ b/src/lib/pbkdf/info.txt @@ -7,7 +7,3 @@ base <header:public> pbkdf.h </header:public> - -<header:internal> -pbkdf_utils.h -</header:internal> diff --git a/src/lib/pbkdf/pbkdf.cpp b/src/lib/pbkdf/pbkdf.cpp index 7f0a68a01..f11fbc44d 100644 --- a/src/lib/pbkdf/pbkdf.cpp +++ b/src/lib/pbkdf/pbkdf.cpp @@ -6,10 +6,30 @@ */ #include <botan/pbkdf.h> +#include <botan/internal/algo_registry.h> #include <stdexcept> +#if defined(BOTAN_HAS_PBKDF1) +#include <botan/pbkdf1.h> +#endif + +#if defined(BOTAN_HAS_PBKDF2) +#include <botan/pbkdf2.h> +#endif + namespace Botan { +#define BOTAN_REGISTER_PBKDF_1HASH(type, name) \ + BOTAN_REGISTER_NAMED_T(PBKDF, name, type, (make_new_T_1X<type, HashFunction>)) + +#if defined(BOTAN_HAS_PBKDF1) +BOTAN_REGISTER_PBKDF_1HASH(PKCS5_PBKDF1, "PBKDF1"); +#endif + +#if defined(BOTAN_HAS_PBKDF2) +BOTAN_REGISTER_NAMED_T(PBKDF, "PBKDF2", PKCS5_PBKDF2, PKCS5_PBKDF2::make); +#endif + void PBKDF::pbkdf_timed(byte out[], size_t out_len, const std::string& passphrase, const byte salt[], size_t salt_len, diff --git a/src/lib/pbkdf/pbkdf1/pbkdf1.cpp b/src/lib/pbkdf/pbkdf1/pbkdf1.cpp index 28bac9572..49e1cf268 100644 --- a/src/lib/pbkdf/pbkdf1/pbkdf1.cpp +++ b/src/lib/pbkdf/pbkdf1/pbkdf1.cpp @@ -5,14 +5,11 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/internal/pbkdf_utils.h> #include <botan/pbkdf1.h> #include <botan/exceptn.h> namespace Botan { -BOTAN_REGISTER_PBKDF_1HASH(PKCS5_PBKDF1, "PBKDF1"); - size_t PKCS5_PBKDF1::pbkdf(byte output_buf[], size_t output_len, const std::string& passphrase, const byte salt[], size_t salt_len, diff --git a/src/lib/pbkdf/pbkdf2/pbkdf2.cpp b/src/lib/pbkdf/pbkdf2/pbkdf2.cpp index a27b9b15c..a5b7f011e 100644 --- a/src/lib/pbkdf/pbkdf2/pbkdf2.cpp +++ b/src/lib/pbkdf/pbkdf2/pbkdf2.cpp @@ -5,16 +5,14 @@ * Botan is released under the Simplified BSD License (see license.txt) */ -#include <botan/internal/pbkdf_utils.h> #include <botan/pbkdf2.h> +#include <botan/lookup.h> #include <botan/get_byte.h> #include <botan/internal/xor_buf.h> #include <botan/internal/rounding.h> namespace Botan { -BOTAN_REGISTER_NAMED_T(PBKDF, "PBKDF2", PKCS5_PBKDF2, PKCS5_PBKDF2::make); - PKCS5_PBKDF2* PKCS5_PBKDF2::make(const Spec& spec) { if(auto mac = get_mac(spec.arg(0))) diff --git a/src/lib/pbkdf/pbkdf_utils.h b/src/lib/pbkdf/pbkdf_utils.h deleted file mode 100644 index 480fc70eb..000000000 --- a/src/lib/pbkdf/pbkdf_utils.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -* PBKDF Utility Header -* (C) 2015 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#ifndef BOTAN_PBKDF_UTILS_H__ -#define BOTAN_PBKDF_UTILS_H__ - -#include <botan/pbkdf.h> -#include <botan/internal/algo_registry.h> - -namespace Botan { - -#define BOTAN_REGISTER_PBKDF_1HASH(type, name) \ - BOTAN_REGISTER_NAMED_T(PBKDF, name, type, (make_new_T_1X<type, HashFunction>)) -#define BOTAN_REGISTER_PBKDF_1MAC(type, name) \ - BOTAN_REGISTER_NAMED_T(PBKDF, name, type, (make_new_T_1X<type, MessageAuthenticationCode>)) - -} - -#endif |