1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-23 20:15:19 -07:00

Finish the Argon2id tests

This commit is contained in:
Frank Denis 2017-07-16 18:34:01 +02:00
parent 8b99f44ff9
commit 608e103e45
2 changed files with 16 additions and 17 deletions

View File

@ -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");
}

View File

@ -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