diff options
Diffstat (limited to 'src/lib/block/aes/aes.cpp')
-rw-r--r-- | src/lib/block/aes/aes.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp index c025530a4..0c18e93ee 100644 --- a/src/lib/block/aes/aes.cpp +++ b/src/lib/block/aes/aes.cpp @@ -99,15 +99,15 @@ const uint8_t SD[256] = { 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D }; -inline uint8_t xtime(uint8_t s) { return static_cast<uint8_t>(s << 1) ^ ((s >> 7) * 0x1B); } -inline uint8_t xtime4(uint8_t s) { return xtime(xtime(s)); } -inline uint8_t xtime8(uint8_t s) { return xtime(xtime(xtime(s))); } - -inline uint8_t xtime3(uint8_t s) { return xtime(s) ^ s; } -inline uint8_t xtime9(uint8_t s) { return xtime8(s) ^ s; } -inline uint8_t xtime11(uint8_t s) { return xtime8(s) ^ xtime(s) ^ s; } -inline uint8_t xtime13(uint8_t s) { return xtime8(s) ^ xtime4(s) ^ s; } -inline uint8_t xtime14(uint8_t s) { return xtime8(s) ^ xtime4(s) ^ xtime(s); } +inline constexpr uint8_t xtime(uint8_t s) { return static_cast<uint8_t>(s << 1) ^ ((s >> 7) * 0x1B); } +inline constexpr uint8_t xtime4(uint8_t s) { return xtime(xtime(s)); } +inline constexpr uint8_t xtime8(uint8_t s) { return xtime(xtime(xtime(s))); } + +inline constexpr uint8_t xtime3(uint8_t s) { return xtime(s) ^ s; } +inline constexpr uint8_t xtime9(uint8_t s) { return xtime8(s) ^ s; } +inline constexpr uint8_t xtime11(uint8_t s) { return xtime8(s) ^ xtime(s) ^ s; } +inline constexpr uint8_t xtime13(uint8_t s) { return xtime8(s) ^ xtime4(s) ^ s; } +inline constexpr uint8_t xtime14(uint8_t s) { return xtime8(s) ^ xtime4(s) ^ xtime(s); } inline uint32_t SE_word(uint32_t x) { |