From ffe2b8ef9a77d0d2f740dafea5fc71275a46e7d0 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 12 Nov 2023 20:17:51 +0100 Subject: [PATCH] Store polynomial in a constant variable --- aes/aes.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aes/aes.cpp b/aes/aes.cpp index 669b72e..942f55b 100644 --- a/aes/aes.cpp +++ b/aes/aes.cpp @@ -11,6 +11,8 @@ http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf */ /* AES Constants */ +// AES polynomial +const uint16_t POLYNOMIAL = 0b100011011; // forward sbox const uint8_t SBOX[256] = { @@ -103,7 +105,7 @@ uint8_t xtime(uint8_t a) { uint8_t mask; if (a & 0b10000000) { - mask = 0x1B; + mask = POLYNOMIAL & 0xFF; } else { mask = 0x00;