Make benchmark progress parameter the same as the internal unsigned type.

This commit is contained in:
Milan Broz
2017-08-11 21:38:53 +02:00
parent 5fc79f5627
commit 87dd427d79
5 changed files with 13 additions and 13 deletions

View File

@@ -68,7 +68,7 @@ int crypt_pbkdf_perf(const char *kdf, const char *hash,
size_t volume_key_size, uint32_t time_ms,
uint32_t max_memory_kb, uint32_t parallel_threads,
uint32_t *iterations_out, uint32_t *memory_out,
int (*progress)(long time_ms, void *usrptr), void *usrptr);
int (*progress)(uint32_t time_ms, void *usrptr), void *usrptr);
#if USE_INTERNAL_PBKDF2
/* internal PBKDF2 implementation */

View File

@@ -169,7 +169,7 @@ static int crypt_argon2_check(const char *kdf, const char *password,
uint32_t min_t_cost, uint32_t max_m_cost,
uint32_t parallel, uint32_t target_ms,
uint32_t *out_t_cost, uint32_t *out_m_cost,
int (*progress)(long time_ms, void *usrptr),
int (*progress)(uint32_t time_ms, void *usrptr),
void *usrptr)
{
int r = 0;
@@ -201,7 +201,7 @@ static int crypt_argon2_check(const char *kdf, const char *password,
/* Update parameters to actual measurement */
*out_t_cost = t_cost;
*out_m_cost = m_cost;
if (progress && progress(ms, usrptr))
if (progress && progress((uint32_t)ms, usrptr))
r = -EINTR;
}
@@ -255,7 +255,7 @@ static int crypt_argon2_check(const char *kdf, const char *password,
/* Update parameters to actual measurement */
*out_t_cost = t_cost;
*out_m_cost = m_cost;
if (progress && progress(ms, usrptr))
if (progress && progress((uint32_t)ms, usrptr))
r = -EINTR;
}
@@ -276,7 +276,7 @@ static int crypt_pbkdf_check(const char *kdf, const char *hash,
const char *password, size_t password_length,
const char *salt, size_t salt_length,
size_t key_length, uint32_t *iter_secs, uint32_t target_ms,
int (*progress)(long time_ms, void *usrptr), void *usrptr)
int (*progress)(uint32_t time_ms, void *usrptr), void *usrptr)
{
struct rusage rstart, rend;
@@ -320,7 +320,7 @@ static int crypt_pbkdf_check(const char *kdf, const char *hash,
*iter_secs = (uint32_t)PBKDF2_temp;
}
if (progress && progress(ms, usrptr)) {
if (progress && progress((uint32_t)ms, usrptr)) {
r = -EINTR;
goto out;
}
@@ -358,7 +358,7 @@ int crypt_pbkdf_perf(const char *kdf, const char *hash,
size_t volume_key_size, uint32_t time_ms,
uint32_t max_memory_kb, uint32_t parallel_threads,
uint32_t *iterations_out, uint32_t *memory_out,
int (*progress)(long time_ms, void *usrptr), void *usrptr)
int (*progress)(uint32_t time_ms, void *usrptr), void *usrptr)
{
int r = -EINVAL;

View File

@@ -1117,7 +1117,7 @@ int crypt_benchmark_pbkdf(struct crypt_device *cd,
const char *salt,
size_t salt_size,
size_t volume_key_size,
int (*progress)(long time_ms, void *usrptr),
int (*progress)(uint32_t time_ms, void *usrptr),
void *usrptr);
/** @} */

View File

@@ -238,7 +238,7 @@ int crypt_benchmark_pbkdf(struct crypt_device *cd,
const char *salt,
size_t salt_size,
size_t volume_key_size,
int (*progress)(long time_ms, void *usrptr),
int (*progress)(uint32_t time_ms, void *usrptr),
void *usrptr)
{
int r;
@@ -264,12 +264,12 @@ int crypt_benchmark_pbkdf(struct crypt_device *cd,
return r;
}
static int benchmark_callback(long time_ms, void *usrptr)
static int benchmark_callback(uint32_t time_ms, void *usrptr)
{
struct crypt_pbkdf_type *pbkdf = usrptr;
log_dbg("PBKDF benchmark: memory cost = %u, iterations = %u, "
"threads = %u (took %ld ms)", pbkdf->max_memory_kb,
"threads = %u (took %u ms)", pbkdf->max_memory_kb,
pbkdf->iterations, pbkdf->parallel_threads, time_ms);
return 0;

View File

@@ -532,7 +532,7 @@ out:
return r;
}
static int benchmark_callback(long time_ms, void *usrptr)
static int benchmark_callback(uint32_t time_ms, void *usrptr)
{
struct crypt_pbkdf_type *pbkdf = usrptr;
int r = 0;
@@ -542,7 +542,7 @@ static int benchmark_callback(long time_ms, void *usrptr)
log_err("Benchmark interrupted.\n");
else
log_dbg("PBKDF benchmark: memory cost = %u, iterations = %u, "
"threads = %u (took %ld ms)", pbkdf->max_memory_kb,
"threads = %u (took %u ms)", pbkdf->max_memory_kb,
pbkdf->iterations, pbkdf->parallel_threads, time_ms);
return r;
}