From d15c89ba332ee4aaf5399e9dcc34222cbb22533e Mon Sep 17 00:00:00 2001 From: Per Nilsson Date: Mon, 25 Sep 2023 16:05:17 +0200 Subject: [PATCH] use pkcs5_pbkdf2_hmac --- yhwrap/CMakeLists.txt | 1 + yhwrap/main.c | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/yhwrap/CMakeLists.txt b/yhwrap/CMakeLists.txt index 915a6e8c..4ab69354 100644 --- a/yhwrap/CMakeLists.txt +++ b/yhwrap/CMakeLists.txt @@ -21,6 +21,7 @@ set ( SOURCE ../common/hash.c ../common/parsing.c + ../common/pkcs5.c ../common/util.c ../common/openssl-compat.c main.c diff --git a/yhwrap/main.c b/yhwrap/main.c index 2579dc28..850a209f 100644 --- a/yhwrap/main.c +++ b/yhwrap/main.c @@ -35,6 +35,7 @@ #include "cmdline.h" #include "parsing.h" +#include "pkcs5.h" #include "util.h" #include @@ -315,11 +316,11 @@ int main(int argc, char *argv[]) { } uint8_t key[YH_KEY_LEN * 2]; - int ret = - PKCS5_PBKDF2_HMAC((const char *) password, password_len, - (uint8_t *) YH_DEFAULT_SALT, strlen(YH_DEFAULT_SALT), - YH_DEFAULT_ITERS, EVP_sha256(), sizeof(key), key); - if (ret != 1) { + bool ret = + pkcs5_pbkdf2_hmac((const uint8_t *) password, password_len, + (const uint8_t *) YH_DEFAULT_SALT, strlen(YH_DEFAULT_SALT), + YH_DEFAULT_ITERS, _SHA256, key, sizeof(key)); + if (ret == false) { fprintf(stderr, "Unable to derive keys\n"); goto main_exit; }