aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pbkdf
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-09-11 22:44:45 -0400
committerJack Lloyd <[email protected]>2015-09-11 22:44:45 -0400
commit72719f52640d2ac3ff00fce46a72082e5938d212 (patch)
tree51018f639724326c0e967eb7372a762ce0b89e53 /src/lib/pbkdf
parent8211fdc11fa3bbe692b50d42126f74d259a4a96a (diff)
Fix pbkdf, pk padding and ECDH registration for static linking.
With this change the tests pass when linked against a static library built in the normal (non-amalgamation) fashion. Remove the restriction in configure.py, and have circleci build the clang static build as a non-amalg.
Diffstat (limited to 'src/lib/pbkdf')
-rw-r--r--src/lib/pbkdf/info.txt4
-rw-r--r--src/lib/pbkdf/pbkdf.cpp20
-rw-r--r--src/lib/pbkdf/pbkdf1/pbkdf1.cpp3
-rw-r--r--src/lib/pbkdf/pbkdf2/pbkdf2.cpp4
-rw-r--r--src/lib/pbkdf/pbkdf_utils.h23
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