Fix some gcc warnings on 32bit systems.

This commit is contained in:
Milan Broz
2019-08-30 09:41:04 +02:00
parent 593f5ee569
commit 4d6269a42d
4 changed files with 7 additions and 7 deletions

View File

@@ -151,7 +151,7 @@ static int next_argon2_params(uint32_t *t_cost, uint32_t *m_cost,
old_t_cost = *t_cost; old_t_cost = *t_cost;
old_m_cost = *m_cost; old_m_cost = *m_cost;
if (ms > target_ms) { if ((uint32_t)ms > target_ms) {
/* decreasing, first try to lower t_cost, then m_cost */ /* decreasing, first try to lower t_cost, then m_cost */
num = (uint64_t)*t_cost * (uint64_t)target_ms; num = (uint64_t)*t_cost * (uint64_t)target_ms;
denom = (uint64_t)ms; denom = (uint64_t)ms;

View File

@@ -166,7 +166,7 @@ static int FEC_process_inputs(struct crypt_device *cd,
/* decoding from parity device */ /* decoding from parity device */
if (decode) { if (decode) {
if (read_buffer(fd, &rs_block[ctx.rsn], ctx.roots) != ctx.roots) { if (read_buffer(fd, &rs_block[ctx.rsn], ctx.roots) < 0) {
log_err(cd, _("Failed to read parity for RS block %" PRIu64 "."), n); log_err(cd, _("Failed to read parity for RS block %" PRIu64 "."), n);
r = -EIO; r = -EIO;
goto out; goto out;
@@ -185,7 +185,7 @@ static int FEC_process_inputs(struct crypt_device *cd,
} else { } else {
/* encoding and writing parity data to fec device */ /* encoding and writing parity data to fec device */
encode_rs_char(rs, rs_block, &rs_block[ctx.rsn]); encode_rs_char(rs, rs_block, &rs_block[ctx.rsn]);
if (write_buffer(fd, &rs_block[ctx.rsn], ctx.roots) != ctx.roots) { if (write_buffer(fd, &rs_block[ctx.rsn], ctx.roots) < 0) {
log_err(cd, _("Failed to write parity for RS block %" PRIu64 "."), n); log_err(cd, _("Failed to write parity for RS block %" PRIu64 "."), n);
r = -EIO; r = -EIO;
goto out; goto out;

View File

@@ -979,8 +979,8 @@ static int set_pbkdf_params(struct crypt_device *cd, const char *dev_type)
pbkdf.hash = opt_hash ?: pbkdf_default->hash; pbkdf.hash = opt_hash ?: pbkdf_default->hash;
pbkdf.time_ms = (uint32_t)opt_iteration_time ?: pbkdf_default->time_ms; pbkdf.time_ms = (uint32_t)opt_iteration_time ?: pbkdf_default->time_ms;
if (strcmp(pbkdf.type, CRYPT_KDF_PBKDF2)) { if (strcmp(pbkdf.type, CRYPT_KDF_PBKDF2)) {
pbkdf.max_memory_kb = opt_pbkdf_memory ?: pbkdf_default->max_memory_kb; pbkdf.max_memory_kb = (uint32_t)opt_pbkdf_memory ?: pbkdf_default->max_memory_kb;
pbkdf.parallel_threads = opt_pbkdf_parallel ?: pbkdf_default->parallel_threads; pbkdf.parallel_threads = (uint32_t)opt_pbkdf_parallel ?: pbkdf_default->parallel_threads;
} }
if (opt_pbkdf_iterations) { if (opt_pbkdf_iterations) {

View File

@@ -481,8 +481,8 @@ static int set_pbkdf_params(struct crypt_device *cd, const char *dev_type)
pbkdf.hash = opt_hash ?: pbkdf_default->hash; pbkdf.hash = opt_hash ?: pbkdf_default->hash;
pbkdf.time_ms = (uint32_t)opt_iteration_time ?: pbkdf_default->time_ms; pbkdf.time_ms = (uint32_t)opt_iteration_time ?: pbkdf_default->time_ms;
if (strcmp(pbkdf.type, CRYPT_KDF_PBKDF2)) { if (strcmp(pbkdf.type, CRYPT_KDF_PBKDF2)) {
pbkdf.max_memory_kb = opt_pbkdf_memory ?: pbkdf_default->max_memory_kb; pbkdf.max_memory_kb = (uint32_t)opt_pbkdf_memory ?: pbkdf_default->max_memory_kb;
pbkdf.parallel_threads = opt_pbkdf_parallel ?: pbkdf_default->parallel_threads; pbkdf.parallel_threads = (uint32_t)opt_pbkdf_parallel ?: pbkdf_default->parallel_threads;
} }
if (opt_pbkdf_iterations) { if (opt_pbkdf_iterations) {