Store polynomial in a constant variable
This commit is contained in:
parent
b3c10424a4
commit
ffe2b8ef9a
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue