diff options
author | Jack Lloyd <[email protected]> | 2018-12-10 10:43:19 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-12-10 10:43:19 -0500 |
commit | efd1d99a291738786e353e28598e86e5dd08803d (patch) | |
tree | cb8c5e59708ddd273098af8dc40193cbf8953959 /src/lib/modes | |
parent | 965a8bfa31553e439898100913150ea4df1f734e (diff) |
Fix some MSVC warnings
Diffstat (limited to 'src/lib/modes')
-rw-r--r-- | src/lib/modes/mode_pad/mode_pad.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/modes/mode_pad/mode_pad.cpp b/src/lib/modes/mode_pad/mode_pad.cpp index 19a2f15f8..1df6abfeb 100644 --- a/src/lib/modes/mode_pad/mode_pad.cpp +++ b/src/lib/modes/mode_pad/mode_pad.cpp @@ -199,13 +199,14 @@ size_t ESP_Padding::unpad(const uint8_t input[], size_t input_length) const CT::poison(input, input_length); - const size_t last_byte = input[input_length-1]; + const uint8_t input_length_8 = static_cast<uint8_t>(input_length); + const uint8_t last_byte = input[input_length-1]; auto bad_input = CT::Mask<uint8_t>::is_zero(last_byte) | - CT::Mask<uint8_t>::is_gt(last_byte, static_cast<uint8_t>(input_length)); + CT::Mask<uint8_t>::is_gt(last_byte, input_length_8); - const size_t pad_pos = input_length - last_byte; - size_t i = input_length - 1; + const uint8_t pad_pos = input_length_8 - last_byte; + size_t i = input_length_8 - 1; while(i) { const auto in_range = CT::Mask<size_t>::is_gt(i, pad_pos); @@ -216,7 +217,7 @@ size_t ESP_Padding::unpad(const uint8_t input[], size_t input_length) const } CT::unpoison(input, input_length); - return bad_input.select_and_unpoison(input_length, pad_pos); + return bad_input.select_and_unpoison(input_length_8, pad_pos); } |