diff options
author | Jack Lloyd <[email protected]> | 2019-06-29 16:16:21 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-06-29 17:11:19 -0400 |
commit | 8b8745236368c70a82db2b19feeed5e9f9b59c5b (patch) | |
tree | 1495a04a7e6f117e2cacd69ff0f7b2c4a31ddee9 /src/lib/pbkdf | |
parent | 5922b1c3abf00c0e22e86498e1ee3a51e5343b0f (diff) |
Fix various MSVC warnings
Diffstat (limited to 'src/lib/pbkdf')
-rw-r--r-- | src/lib/pbkdf/argon2/argon2.h | 2 | ||||
-rw-r--r-- | src/lib/pbkdf/argon2/argon2fmt.cpp | 4 | ||||
-rw-r--r-- | src/lib/pbkdf/argon2/argon2pwhash.cpp | 4 | ||||
-rw-r--r-- | src/lib/pbkdf/bcrypt_pbkdf/bcrypt_pbkdf.cpp | 4 | ||||
-rw-r--r-- | src/lib/pbkdf/pbkdf2/pbkdf2.cpp | 2 | ||||
-rw-r--r-- | src/lib/pbkdf/scrypt/scrypt.cpp | 2 |
6 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/pbkdf/argon2/argon2.h b/src/lib/pbkdf/argon2/argon2.h index 15bda45cc..a6fa03314 100644 --- a/src/lib/pbkdf/argon2/argon2.h +++ b/src/lib/pbkdf/argon2/argon2.h @@ -95,7 +95,7 @@ std::string BOTAN_PUBLIC_API(2,11) argon2_generate_pwhash(const char* password, size_t password_len, RandomNumberGenerator& rng, size_t p, size_t M, size_t t, - size_t y = 2, size_t salt_len = 16, size_t output_len = 32); + uint8_t y = 2, size_t salt_len = 16, size_t output_len = 32); /** * Check a previously created password hash diff --git a/src/lib/pbkdf/argon2/argon2fmt.cpp b/src/lib/pbkdf/argon2/argon2fmt.cpp index f64cd2bbd..480be5fa3 100644 --- a/src/lib/pbkdf/argon2/argon2fmt.cpp +++ b/src/lib/pbkdf/argon2/argon2fmt.cpp @@ -26,7 +26,7 @@ std::string strip_padding(std::string s) std::string argon2_generate_pwhash(const char* password, size_t password_len, RandomNumberGenerator& rng, size_t p, size_t M, size_t t, - size_t y, size_t salt_len, size_t output_len) + uint8_t y, size_t salt_len, size_t output_len) { std::vector<uint8_t> salt(salt_len); rng.randomize(salt.data(), salt.size()); @@ -62,7 +62,7 @@ bool argon2_check_pwhash(const char* password, size_t password_len, if(parts.size() != 5) return false; - size_t family = 0; + uint8_t family = 0; if(parts[0] == "argon2d") family = 0; diff --git a/src/lib/pbkdf/argon2/argon2pwhash.cpp b/src/lib/pbkdf/argon2/argon2pwhash.cpp index 25788c0bb..4eb2570f6 100644 --- a/src/lib/pbkdf/argon2/argon2pwhash.cpp +++ b/src/lib/pbkdf/argon2/argon2pwhash.cpp @@ -115,14 +115,14 @@ std::unique_ptr<PasswordHash> Argon2_Family::tune(size_t /*output_length*/, const uint64_t mem_headroom = max_kib / M; const uint64_t M_mult = std::min(desired_cost_increase, mem_headroom); - M *= M_mult; + M *= static_cast<size_t>(M_mult); est_nsec *= M_mult; } if(est_nsec < target_nsec) { const uint64_t desired_cost_increase = (target_nsec + est_nsec - 1) / est_nsec; - t *= desired_cost_increase; + t *= static_cast<size_t>(desired_cost_increase); } return this->from_params(M, t, p); diff --git a/src/lib/pbkdf/bcrypt_pbkdf/bcrypt_pbkdf.cpp b/src/lib/pbkdf/bcrypt_pbkdf/bcrypt_pbkdf.cpp index f4e7676bd..36501b4cb 100644 --- a/src/lib/pbkdf/bcrypt_pbkdf/bcrypt_pbkdf.cpp +++ b/src/lib/pbkdf/bcrypt_pbkdf/bcrypt_pbkdf.cpp @@ -57,12 +57,12 @@ std::unique_ptr<PasswordHash> Bcrypt_PBKDF_Family::tune(size_t output_length, const uint64_t target_nsec = msec.count() * static_cast<uint64_t>(1000000); - const size_t desired_increase = target_nsec / measured_time; + const uint64_t desired_increase = target_nsec / measured_time; if(desired_increase == 0) return this->from_iterations(starting_iter); - return this->from_iterations(desired_increase * starting_iter); + return this->from_iterations(static_cast<size_t>(desired_increase * starting_iter)); } std::unique_ptr<PasswordHash> Bcrypt_PBKDF_Family::default_params() const diff --git a/src/lib/pbkdf/pbkdf2/pbkdf2.cpp b/src/lib/pbkdf/pbkdf2/pbkdf2.cpp index 6b036f6e0..aa0081917 100644 --- a/src/lib/pbkdf/pbkdf2/pbkdf2.cpp +++ b/src/lib/pbkdf/pbkdf2/pbkdf2.cpp @@ -92,7 +92,7 @@ size_t tune_pbkdf2(MessageAuthenticationCode& prf, const size_t blocks_needed = (output_length + prf_sz - 1) / prf_sz; - const size_t multiplier = (desired_nsec / duration_nsec / blocks_needed); + const size_t multiplier = static_cast<size_t>(desired_nsec / duration_nsec / blocks_needed); if(multiplier == 0) return trial_iterations; diff --git a/src/lib/pbkdf/scrypt/scrypt.cpp b/src/lib/pbkdf/scrypt/scrypt.cpp index d493c17e1..8275ac956 100644 --- a/src/lib/pbkdf/scrypt/scrypt.cpp +++ b/src/lib/pbkdf/scrypt/scrypt.cpp @@ -97,7 +97,7 @@ std::unique_ptr<PasswordHash> Scrypt_Family::tune(size_t output_length, // If we have extra runtime budget, increment p if(target_nsec / est_nsec > 2) - p *= std::min<uint64_t>(1024, (target_nsec / est_nsec)); + p *= std::min<size_t>(1024, static_cast<size_t>(target_nsec / est_nsec)); return std::unique_ptr<PasswordHash>(new Scrypt(N, r, p)); } |