Skip to content

Commit

Permalink
Use pkcs5_pbkdf2_hmac everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
qpernil committed Jun 12, 2023
1 parent 8407bdb commit 73996a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions yhwrap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ set (
SOURCE
../common/hash.c
../common/parsing.c
../common/pkcs5.c
../common/util.c
../common/openssl-compat.c
main.c
Expand Down
11 changes: 6 additions & 5 deletions yhwrap/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "cmdline.h"

#include "parsing.h"
#include "pkcs5.h"
#include "util.h"

#include <yubihsm.h>
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 73996a0

Please sign in to comment.