Multiplication in GF(2⁸) #
Two versions:
mulSpec: the textbook definition from FIPS 197 §4.2. It is easy to check by eye, but it branches on the bits of its inputs, so it must never run on secret data.mul: the version used at runtime. It does the same computation with no branches and no table lookups: eachifis replaced by a mask that is0x00or0xFF.
mul_eq_mulSpec proves the two agree on all 65 536 input pairs.