From 01072a2f6a7f4375472d070a3b8f9ed2b2b4dfa4 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 3 Dec 2017 21:16:46 +0100 Subject: [PATCH] More tests --- test/default/pwhash_argon2i.c | 6 +++++- test/default/pwhash_argon2id.c | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/default/pwhash_argon2i.c b/test/default/pwhash_argon2i.c index 8da8853e..c670e0fc 100644 --- a/test/default/pwhash_argon2i.c +++ b/test/default/pwhash_argon2i.c @@ -256,7 +256,11 @@ str_tests(void) crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT * 2, MEMLIMIT) != 1) { printf("needs_rehash() false negative\n"); } - if (crypto_pwhash_argon2i_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1) { + if (crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT / 2) != 1) { + printf("pwhash_str_needs_rehash() didn't handle argon2i\n"); + } + if (crypto_pwhash_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1 || + crypto_pwhash_argon2i_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1) { printf("needs_rehash() didn't fail with an invalid hash string\n"); } if (sodium_is_zero((const unsigned char *) str_out + strlen(str_out), diff --git a/test/default/pwhash_argon2id.c b/test/default/pwhash_argon2id.c index 5a474740..76e40601 100644 --- a/test/default/pwhash_argon2id.c +++ b/test/default/pwhash_argon2id.c @@ -266,6 +266,9 @@ str_tests(void) crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT + 1, MEMLIMIT) != -1) { printf("needs_rehash() false negative (2)\n"); } + if (crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT / 2) != 1) { + printf("pwhash_str_needs_rehash() didn't handle argon2id\n"); + } if (crypto_pwhash_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1 || crypto_pwhash_argon2id_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1) { printf("needs_rehash() didn't fail with an invalid hash string\n");