aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-09-13 18:24:41 -0400
committerJack Lloyd <[email protected]>2018-09-13 18:24:41 -0400
commit2ab738c5b0e18fa1d552bb81c79c93e2e72cf102 (patch)
treec1eb9623ade3d919ed76dc2841ee7e7f1c475d8a /src/lib
parentc15720d3296edbcb9bdc14527ba71e60e3ec7a73 (diff)
Define botan_scrypt in terms of botan_pwdhash
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/ffi/ffi_kdf.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/lib/ffi/ffi_kdf.cpp b/src/lib/ffi/ffi_kdf.cpp
index 639d25b1f..c55515a42 100644
--- a/src/lib/ffi/ffi_kdf.cpp
+++ b/src/lib/ffi/ffi_kdf.cpp
@@ -8,16 +8,13 @@
#include <botan/internal/ffi_util.h>
#include <botan/internal/ffi_rng.h>
#include <botan/pbkdf.h>
+#include <botan/pwdhash.h>
#include <botan/kdf.h>
#if defined(BOTAN_HAS_BCRYPT)
#include <botan/bcrypt.h>
#endif
-#if defined(BOTAN_HAS_SCRYPT)
- #include <botan/scrypt.h>
-#endif
-
extern "C" {
using namespace Botan_FFI;
@@ -147,14 +144,10 @@ int botan_scrypt(uint8_t out[], size_t out_len,
const uint8_t salt[], size_t salt_len,
size_t N, size_t r, size_t p)
{
-#if defined(BOTAN_HAS_SCRYPT)
- return ffi_guard_thunk(BOTAN_CURRENT_FUNCTION, [=]() -> int {
- Botan::scrypt(out, out_len, password, strlen(password), salt, salt_len, N, r, p);
- return BOTAN_FFI_SUCCESS;
- });
-#else
- return BOTAN_FFI_ERROR_NOT_IMPLEMENTED;
-#endif
+ return botan_pwdhash("Scrypt", N, r, p,
+ out, out_len,
+ password, 0,
+ salt, salt_len);
}
int botan_bcrypt_generate(uint8_t* out, size_t* out_len,