Merge pull request #1183 from simonduq/galois_mul2

galois_mul2 conditional-free implementation
This commit is contained in:
Nicolas Tsiftes 2015-08-31 14:41:17 +02:00
commit b8cccb6d3c

View file

@ -71,12 +71,8 @@ static uint8_t round_keys[11][AES_128_KEY_LENGTH];
static uint8_t
galois_mul2(uint8_t value)
{
if(value >> 7) {
value = value << 1;
return value ^ 0x1b;
} else {
return value << 1;
}
uint8_t xor_val = (value >> 7) * 0x1b;
return ((value << 1) ^ xor_val);
}
/*---------------------------------------------------------------------------*/
static void