diff options
author | lloyd <[email protected]> | 2014-01-24 15:19:02 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-24 15:19:02 +0000 |
commit | 910625b2468df6db8a26cbe7abfd8fc1a131f51d (patch) | |
tree | dc29b3cda3d38a4eb95767630d04d1d7a59112f1 /src/lib/modes/cbc/cbc.cpp | |
parent | e7365efee55242622bc62df3ec05361571160acb (diff) |
Avoid strict overflow warnings in GCC 4.8
Diffstat (limited to 'src/lib/modes/cbc/cbc.cpp')
-rw-r--r-- | src/lib/modes/cbc/cbc.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/modes/cbc/cbc.cpp b/src/lib/modes/cbc/cbc.cpp index 31834bade..3095875f5 100644 --- a/src/lib/modes/cbc/cbc.cpp +++ b/src/lib/modes/cbc/cbc.cpp @@ -179,8 +179,8 @@ void CTS_Encryption::finish(secure_vector<byte>& buffer, size_t offset) for(size_t i = 0; i != final_bytes - BS; ++i) { - std::swap(last[i], last[i + BS]); last[i] ^= last[i + BS]; + last[i + BS] ^= last[i]; } cipher().encrypt(&last[0]); @@ -286,7 +286,11 @@ void CTS_Decryption::finish(secure_vector<byte>& buffer, size_t offset) xor_buf(&last[0], &last[BS], final_bytes - BS); for(size_t i = 0; i != final_bytes - BS; ++i) - std::swap(last[i], last[i + BS]); + { + last[i] ^= last[i + BS]; + last[i + BS] ^= last[i]; + last[i] ^= last[i + BS]; + } cipher().decrypt(&last[0]); xor_buf(&last[0], state_ptr(), BS); |