Test crypto_pwhash_scryptsalsa208sha256_str_verify() with invalid input.

This commit is contained in:
Frank Denis 2014-09-23 13:58:59 -07:00
parent 0c73253249
commit d6d539a0ce
2 changed files with 26 additions and 1 deletions

View File

@ -204,13 +204,31 @@ static void tv3(void)
{ "Y0!?iQa9M%5ekffW(`",
"$7$A6....1....TrXs5Zk6s8sWHpQgWDIXTR8kUU3s6Jc3s.DtdS8M2i4$"
"a4ik5hGDN7foMuHOW.cp.CtX01UyCeO0.JAG.AHPpx5" },
{ "Y0!?iQa9M%5ekffW(`",
"$7fA6....1....TrXs5Zk6s8sWHpQgWDIXTR8kUU3s6Jc3s.DtdS8M2i4"
"a4ik5hGDN7foMuHOW.cp.CtX01UyCeO0.JAG.AHPpx5" },
{ "Y0!?iQa9M%5ekffW(`",
"$7$AX....1....TrXs5Zk6s8sWHpQgWDIXTR8kUU3s6Jc3s.DtdS8M2i4$"
"a4ik5hGDN7foMuHOW.cp.CtX01UyCeO0.JAG.AHPpx5" },
{ "Y0!?iQa9M%5ekffW(`",
"$7$A6....1X...TrXs5Zk6s8sWHpQgWDIXTR8kUU3s6Jc3s.DtdS8M2i4$"
"a4ik5hGDN7foMuHOW.cp.CtX01UyCeO0.JAG.AHPpx5" },
{ "Y0!?iQa9M%5ekffW(`",
"$7$A6....1" },
{ "Y0!?iQa9M%5ekffW(`",
"$7$" },
{ "Y0!?iQa9M%5ekffW(`",
"" },
{ "Y0!?iQa9M%5ekffW(`",
"$7$A6....1....TrXs5Zk6s8sWHpQgWDIXTR8kUU3s6Jc3s.DtdS8M2i4$"
"" },
};
size_t i = 0U;
do {
if (crypto_pwhash_scryptsalsa208sha256_str_verify(
tests[i].out, tests[i].passwd, strlen(tests[i].passwd)) != 0) {
printf("pwhash_str failure\n");
printf("pwhash_str failure: [%u]\n", (unsigned int)i);
}
} while (++i < (sizeof tests) / (sizeof tests[0]));
}

View File

@ -10,4 +10,11 @@ d7b1ef464be03ce9050b5108e25f0b8e821299986fe0ff89e17fbae65ba9fad167fbd265866ac03e
1839be14287053bfcd4ea60db82777fad1a6e9535c388b770743e61235449e668717199defd516c438b3ebd79b3529eb32482ef414525292ea1bbec09da10790a2330a4399f2fe6dd63d80954e3c547a5f1c619db5a30bde495b23f2214b4fa7572851d75246f2817775f0b521acc6efbc7832c9a76de7465e3c65cade88e86c973f85a882bb54f92b983977c6e937c88f083ba68c70fb49497065b158e2e789809b1d4cc9ec2d
d54916748076b9d9f72198c8fbef563462dc8c706e1ad38abd1fac570016721acd0a7659ab49a47299a996b43597690c0c947143069f35d83e606273dbf2d622321393949b8ed5a68315362c4f84804384d05e0e0e86bc00e3641233f9f975ab46b60ba185c5e5fe47f78efd207e69fd8f6390730828b93b9b3763ea1283caa03bc36726763715de811915681dd214524f5ad4dd386608cac6c7f2
d54916748076b9d9f72198c8fbef563462dc8c706e1ad38abd1fac570016721acd0a7659ab49a47299a996b43597690c0c947143069f35d83e606273dbf2d622321393949b8ed5a68315362c4f84804384d05e0e0e86bc00e3641233f9f975ab46b60ba185c5e5fe47f78efd207e69fd8f6390730828b93b9b3763ea1283caa03bc36726763715de811915681dd214524f5ad4dd386608cac6c7f2
pwhash_str failure: [10]
pwhash_str failure: [11]
pwhash_str failure: [12]
pwhash_str failure: [13]
pwhash_str failure: [14]
pwhash_str failure: [15]
pwhash_str failure: [16]
OK