Store polynomial in a constant variable

This commit is contained in:
Manuel Thalmann 2023-11-12 20:17:51 +01:00
parent b3c10424a4
commit ffe2b8ef9a

View file

@ -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;