aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pbkdf/pbkdf.cpp
diff options
context:
space:
mode:
authorMouse <[email protected]>2015-10-20 11:25:13 -0400
committerMouse <[email protected]>2015-10-20 11:25:13 -0400
commitb81c246c9c741ef669a79749bc31795175a2a555 (patch)
treeb1291dc5ad4fff2193551e597aa01203327ffb5a /src/lib/pbkdf/pbkdf.cpp
parent44e90e8cf98c7f132c88510b51492c8630fb092c (diff)
parent194d7d3682bddbd534e211357dd5f817d01ab7ed (diff)
Merge pull request #2 from randombit/master
Update to match current Botan-1.11.22
Diffstat (limited to 'src/lib/pbkdf/pbkdf.cpp')
-rw-r--r--src/lib/pbkdf/pbkdf.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lib/pbkdf/pbkdf.cpp b/src/lib/pbkdf/pbkdf.cpp
index 7f0a68a01..6d7a6542f 100644
--- a/src/lib/pbkdf/pbkdf.cpp
+++ b/src/lib/pbkdf/pbkdf.cpp
@@ -6,10 +6,43 @@
*/
#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
+
+PBKDF::~PBKDF() {}
+
+std::unique_ptr<PBKDF> PBKDF::create(const std::string& algo_spec,
+ const std::string& provider)
+ {
+ return std::unique_ptr<PBKDF>(make_a<PBKDF>(algo_spec, provider));
+ }
+
+std::vector<std::string> PBKDF::providers(const std::string& algo_spec)
+ {
+ return providers_of<PBKDF>(PBKDF::Spec(algo_spec));
+ }
+
void PBKDF::pbkdf_timed(byte out[], size_t out_len,
const std::string& passphrase,
const byte salt[], size_t salt_len,