aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/modes/xts
diff options
context:
space:
mode:
authorlloyd <[email protected]>2014-01-24 15:19:02 +0000
committerlloyd <[email protected]>2014-01-24 15:19:02 +0000
commit910625b2468df6db8a26cbe7abfd8fc1a131f51d (patch)
treedc29b3cda3d38a4eb95767630d04d1d7a59112f1 /src/lib/modes/xts
parente7365efee55242622bc62df3ec05361571160acb (diff)
Avoid strict overflow warnings in GCC 4.8
Diffstat (limited to 'src/lib/modes/xts')
-rw-r--r--src/lib/modes/xts/xts.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/modes/xts/xts.cpp b/src/lib/modes/xts/xts.cpp
index 02da5fa5d..1b41a5a5d 100644
--- a/src/lib/modes/xts/xts.cpp
+++ b/src/lib/modes/xts/xts.cpp
@@ -197,7 +197,11 @@ void XTS_Encryption::finish(secure_vector<byte>& buffer, size_t offset)
xor_buf(last, tweak(), 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];
+ }
xor_buf(last, tweak() + BS, BS);
cipher().encrypt(last);
@@ -272,7 +276,11 @@ void XTS_Decryption::finish(secure_vector<byte>& buffer, size_t offset)
xor_buf(last, tweak() + BS, 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];
+ }
xor_buf(last, tweak(), BS);
cipher().decrypt(last);