diff options
author | Simon Warta <[email protected]> | 2015-07-15 00:13:13 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-07-15 13:51:20 +0200 |
commit | 7f3c4b1ab3837e75e890232bd2c3ecb9f6390732 (patch) | |
tree | 485ca6e7e6739693a3dd1cb32b812096cb633b75 /src/lib/modes | |
parent | bac65bbdd0f28804f0418d41bd63fa39c290c68d (diff) |
Fix round_up
1. src/lib/codec/base64/base64.cpp: :
(round_up<size_t>(input_length, 3) / 3) * 4;
2. src/lib/codec/base64/base64.cpp: :
(round_up<size_t>(input_length, 4) * 3) / 4;
3. src/lib/filters/transform_filter.cpp: return round_up(target_size,
update_granularity);
4. src/lib/math/bigint/bigint.cpp:
m_reg.resize(round_up<size_t>(size, 8));
5. src/lib/math/bigint/bigint.cpp:
m_reg.resize(round_up<size_t>((length / WORD_BYTES) + 1, 8));
6. src/lib/math/numbertheory/mp_numth.cpp: BigInt z(BigInt::Positive,
round_up<size_t>(2*x_sw, 16));
7. src/lib/modes/cbc/cbc.cpp: return round_up(input_length,
cipher().block_size());
8. src/lib/modes/ecb/ecb.cpp: return round_up(input_length,
cipher().block_size());
9. src/lib/modes/xts/xts.cpp: return round_up(input_length,
cipher().block_size());
10. src/lib/pbkdf/pbkdf2/pbkdf2.cpp: const size_t blocks_needed =
round_up(out_len, prf_sz) / prf_sz;
11. src/lib/tls/tls_record.cpp: const size_t buf_size = round_up(
12. src/lib/utils/rounding.h:inline T round_up(T n, T align_to)
1. Reason for change
2. Reason for change
3. first argument cannot be 0 (`target_size = 1024`)
4. Is a bug in the current implementation iff `size = 0`
5. first argument cannot be 0
6. round_up should return 0 if `x_sw = 0`
7. ?
8. ?
9. ?
10. first argument cannot be 0 (`if(out_len == 0) return 0;`)
11. first argument is unlikely to be 0 (`iv_size + msg_length + mac_size
+ (block_size ? 1 : 0)`)
12. Implementation
Diffstat (limited to 'src/lib/modes')
-rw-r--r-- | src/lib/modes/cbc/cbc.cpp | 1 | ||||
-rw-r--r-- | src/lib/modes/ecb/ecb.cpp | 1 | ||||
-rw-r--r-- | src/lib/modes/xts/xts.cpp | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/modes/cbc/cbc.cpp b/src/lib/modes/cbc/cbc.cpp index 27f2bce4a..dd6550fce 100644 --- a/src/lib/modes/cbc/cbc.cpp +++ b/src/lib/modes/cbc/cbc.cpp @@ -105,6 +105,7 @@ size_t CBC_Encryption::minimum_final_size() const size_t CBC_Encryption::output_length(size_t input_length) const { + BOTAN_ASSERT(input_length != 0, "CBC_Encryption::output_length() call"); return round_up(input_length, cipher().block_size()); } diff --git a/src/lib/modes/ecb/ecb.cpp b/src/lib/modes/ecb/ecb.cpp index 73a241394..6de00f18a 100644 --- a/src/lib/modes/ecb/ecb.cpp +++ b/src/lib/modes/ecb/ecb.cpp @@ -83,6 +83,7 @@ size_t ECB_Encryption::minimum_final_size() const size_t ECB_Encryption::output_length(size_t input_length) const { + BOTAN_ASSERT(input_length != 0, "ECB_Encryption::output_length() call"); return round_up(input_length, cipher().block_size()); } diff --git a/src/lib/modes/xts/xts.cpp b/src/lib/modes/xts/xts.cpp index cc0e6d54c..4eaf03fe5 100644 --- a/src/lib/modes/xts/xts.cpp +++ b/src/lib/modes/xts/xts.cpp @@ -135,6 +135,7 @@ void XTS_Mode::update_tweak(size_t which) size_t XTS_Encryption::output_length(size_t input_length) const { + BOTAN_ASSERT(input_length != 0, "XTS_Encryption::output_length() call"); return round_up(input_length, cipher().block_size()); } |