diff options
author | lloyd <[email protected]> | 2011-06-23 17:11:03 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-06-23 17:11:03 +0000 |
commit | edc9ad3a1f0ecf32a49ad44866172398079aa184 (patch) | |
tree | 9d9906214f245a26d8620d73f5bed9e8534a4a7d /src/mac/cmac/cmac.cpp | |
parent | fe8b93c289b203e2d7ba2285221cc251bcb8cbd6 (diff) |
Make CMAC::poly_double at least theoretically constant time, though
most compilers will probably compile this into a conditional anyway.
Diffstat (limited to 'src/mac/cmac/cmac.cpp')
-rw-r--r-- | src/mac/cmac/cmac.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mac/cmac/cmac.cpp b/src/mac/cmac/cmac.cpp index 7db597fff..baf22f4e8 100644 --- a/src/mac/cmac/cmac.cpp +++ b/src/mac/cmac/cmac.cpp @@ -16,7 +16,7 @@ namespace Botan { SecureVector<byte> CMAC::poly_double(const MemoryRegion<byte>& in, byte polynomial) { - const bool do_xor = (in[0] & 0x80) ? true : false; + const byte poly_xor = (in[0] & 0x80) ? polynomial : 0; SecureVector<byte> out = in; @@ -28,8 +28,7 @@ SecureVector<byte> CMAC::poly_double(const MemoryRegion<byte>& in, carry = (temp >> 7); } - if(do_xor) - out[out.size()-1] ^= polynomial; + out[out.size()-1] ^= poly_xor; return out; } |