The test for pwhash is too slow for some systems.

Stop checking alterations for every single character.
This commit is contained in:
Frank Denis 2014-09-23 15:18:06 -07:00
parent ced2c40a1a
commit b07dfc5da3

View File

@ -272,15 +272,12 @@ int main(void)
strlen(passwd)) != 0) { strlen(passwd)) != 0) {
printf("pwhash_str_verify failure\n"); printf("pwhash_str_verify failure\n");
} }
for (i = 14U; i < sizeof str_out; i++) { str_out[14]++;
str_out[i]++;
if (crypto_pwhash_scryptsalsa208sha256_str_verify( if (crypto_pwhash_scryptsalsa208sha256_str_verify(
str_out, passwd, strlen(passwd)) == 0) { str_out, passwd, strlen(passwd)) == 0) {
printf("pwhash_str_verify(2) failure\n"); printf("pwhash_str_verify(2) failure\n");
} }
str_out[i]--; str_out[14]--;
}
printf("OK\n");
assert(crypto_pwhash_scryptsalsa208sha256_saltbytes() > 0U); assert(crypto_pwhash_scryptsalsa208sha256_saltbytes() > 0U);
assert(crypto_pwhash_scryptsalsa208sha256_strbytes() > 1U); assert(crypto_pwhash_scryptsalsa208sha256_strbytes() > 1U);
@ -291,5 +288,7 @@ int main(void)
assert(crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive() > 0U); assert(crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive() > 0U);
assert(crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive() > 0U); assert(crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive() > 0U);
printf("OK\n");
return 0; return 0;
} }