From 608e103e45593497db784acad57da114f4065832 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 16 Jul 2017 18:34:01 +0200 Subject: [PATCH] Finish the Argon2id tests --- test/default/pwhash_argon2id.c | 31 +++++++++++++++---------------- test/default/pwhash_argon2id.exp | 2 +- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/test/default/pwhash_argon2id.c b/test/default/pwhash_argon2id.c index 3b37a9eb..9fa57f86 100644 --- a/test/default/pwhash_argon2id.c +++ b/test/default/pwhash_argon2id.c @@ -240,7 +240,6 @@ main(void) printf("pwhash_argon2id_str failure: %s\n", strerror(errno)); return 1; } - exit(0); if (crypto_pwhash_argon2id_str(str_out2, passwd, strlen(passwd), OPSLIMIT, MEMLIMIT) != 0) { printf("pwhash_argon2id_str(2) failure\n"); @@ -275,62 +274,62 @@ main(void) printf("pwhash_argon2id_str() with a small opslimit should have failed\n"); return 1; } - if (crypto_pwhash_argon2id_str_verify("$argon2i$m=65536,t=2,p=1c29tZXNhbHQ" + if (crypto_pwhash_argon2id_str_verify("$argon2id$m=65536,t=2,p=1c29tZXNhbHQ" "$9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ", "password", 0x100000000ULL) != -1) { printf("pwhash_argon2id_str_verify(invalid(0)) failure\n"); } - if (crypto_pwhash_argon2id_str_verify("$argon2i$m=65536,t=2,p=1c29tZXNhbHQ" + if (crypto_pwhash_argon2id_str_verify("$argon2id$m=65536,t=2,p=1c29tZXNhbHQ" "$9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ", "password", strlen("password")) != -1) { printf("pwhash_argon2id_str_verify(invalid(1)) failure %d\n", errno); } - if (crypto_pwhash_argon2id_str_verify("$argon2i$m=65536,t=2,p=1$c29tZXNhbHQ" + if (crypto_pwhash_argon2id_str_verify("$argon2id$m=65536,t=2,p=1$c29tZXNhbHQ" "9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ", "password", strlen("password")) != -1) { printf("pwhash_argon2id_str_verify(invalid(2)) failure\n"); } - if (crypto_pwhash_argon2id_str_verify("$argon2i$m=65536,t=2,p=1$c29tZXNhbHQ" + if (crypto_pwhash_argon2id_str_verify("$argon2id$m=65536,t=2,p=1$c29tZXNhbHQ" "$b2G3seW+uPzerwQQC+/E1K50CLLO7YXy0JRcaTuswRo", "password", strlen("password")) != -1) { printf("pwhash_argon2id_str_verify(invalid(3)) failure\n"); } - if (crypto_pwhash_argon2id_str_verify("$argon2i$v=19$m=65536,t=2,p=1c29tZXNhbHQ" + if (crypto_pwhash_argon2id_str_verify("$argon2id$v=19$m=65536,t=2,p=1c29tZXNhbHQ" "$wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA", "password", strlen("password")) != -1) { printf("pwhash_argon2id_str_verify(invalid(4)) failure\n"); } - if (crypto_pwhash_argon2id_str_verify("$argon2i$v=19$m=65536,t=2,p=1$c29tZXNhbHQ" + if (crypto_pwhash_argon2id_str_verify("$argon2id$v=19$m=65536,t=2,p=1$c29tZXNhbHQ" "wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA", "password", strlen("password")) != -1) { printf("pwhash_argon2id_str_verify(invalid(5)) failure\n"); } - if (crypto_pwhash_argon2id_str_verify("$argon2i$v=19$m=65536,t=2,p=1$c29tZXNhbHQ" + if (crypto_pwhash_argon2id_str_verify("$argon2id$v=19$m=65536,t=2,p=1$c29tZXNhbHQ" "$8iIuixkI73Js3G1uMbezQXD0b8LG4SXGsOwoQkdAQIM", "password", strlen("password")) != -1) { printf("pwhash_argon2id_str_verify(invalid(6)) failure\n"); } if (crypto_pwhash_argon2id_str_verify( - "$argon2i$v=19$m=4096,t=3,p=2$b2RpZHVlamRpc29kaXNrdw" - "$TNnWIwlu1061JHrnCqIAmjs3huSxYIU+0jWipu7Kc9M", + "$argon2id$v=19$m=256,t=3,p=1$MDEyMzQ1Njc" + "$G5ajKFCoUzaXRLdz7UJb5wGkb2Xt+X5/GQjUYtS2+TE", "password", strlen("password")) != 0) { printf("pwhash_argon2id_str_verify(valid(7)) failure\n"); } if (crypto_pwhash_argon2id_str_verify( - "$argon2i$v=19$m=4096,t=3,p=2$b2RpZHVlamRpc29kaXNrdw" - "$TNnWIwlu1061JHrnCqIAmjs3huSxYIU+0jWipu7Kc9M", + "$argon2id$v=19$m=256,t=3,p=1$MDEyMzQ1Njc" + "$G5ajKFCoUzaXRLdz7UJb5wGkb2Xt+X5/GQjUYtS2+TE", "passwore", strlen("passwore")) != -1 || errno != EINVAL) { printf("pwhash_argon2id_str_verify(invalid(7)) failure\n"); } if (crypto_pwhash_argon2id_str_verify( - "$Argon2i$v=19$m=4096,t=3,p=2$b2RpZHVlamRpc29kaXNrdw" - "$TNnWIwlu1061JHrnCqIAmjs3huSxYIU+0jWipu7Kc9M", + "$Argon2id$v=19$m=256,t=3,p=1$MDEyMzQ1Njc" + "$G5ajKFCoUzaXRLdz7UJb5wGkb2Xt+X5/GQjUYtS2+TE", "password", strlen("password")) != -1 || errno != EINVAL) { printf("pwhash_argon2id_str_verify(invalid(8)) failure\n"); } if (crypto_pwhash_argon2id_str_verify( - "$argon2i$v=1$m=4096,t=3,p=2$b2RpZHVlamRpc29kaXNrdw" - "$TNnWIwlu1061JHrnCqIAmjs3huSxYIU+0jWipu7Kc9M", + "$argon2id$v=19$m=256,t=3,p=2$MDEyMzQ1Njc" + "$G5ajKFCoUzaXRLdz7UJb5wGkb2Xt+X5/GQjUYtS2+TE", "password", strlen("password")) != -1 || errno != EINVAL) { printf("pwhash_argon2id_str_verify(invalid(9)) failure\n"); } diff --git a/test/default/pwhash_argon2id.exp b/test/default/pwhash_argon2id.exp index 83ee78e3..abea0611 100644 --- a/test/default/pwhash_argon2id.exp +++ b/test/default/pwhash_argon2id.exp @@ -12,4 +12,4 @@ d6e9d6cabd42fb9ba7162fe9b8e41d59d3c7034756cb460c9affe393308bd0225ce0371f2e6c3ca3 [tv3] pwhash_argon2id_str failure (maybe intentional): [1] [tv3] pwhash_argon2id_str failure (maybe intentional): [2] [tv3] pwhash_argon2id_str failure (maybe intentional): [3] -pwhash_argon2id_str failure +OK