}
/* This code benchmarks PBKDF and returns iterations/second using specified hash */
-int crypt_pbkdf_check(const char *kdf, const char *hash, uint64_t *iter_secs)
+int crypt_pbkdf_check(const char *kdf, const char *hash,
+ const char *password, size_t password_size,
+ const char *salt, size_t salt_size,
+ uint64_t *iter_secs)
{
struct rusage rstart, rend;
int r = 0, step = 0;
if (getrusage(RUSAGE_SELF, &rstart) < 0)
return -EINVAL;
- r = crypt_pbkdf(kdf, hash, "foo", 3, "bar", 3, &buf, 1, iterations);
+ r = crypt_pbkdf(kdf, hash, password, password_size, salt,
+ salt_size, &buf, 1, iterations);
if (r < 0)
return r;
return -EINVAL;
}
- /* Safety check if anything went wrong */
- if (ms < 10)
- return -EINVAL;
-
if (iter_secs)
*iter_secs = (iterations * 1000) / ms;
return r;