mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-09-11 21:55:41 +00:00
galois_mul2 conditional-free implementation
This commit is contained in:
parent
195ada6668
commit
bfba83ed16
@ -71,12 +71,8 @@ static uint8_t round_keys[11][AES_128_KEY_LENGTH];
|
|||||||
static uint8_t
|
static uint8_t
|
||||||
galois_mul2(uint8_t value)
|
galois_mul2(uint8_t value)
|
||||||
{
|
{
|
||||||
if(value >> 7) {
|
uint8_t xor_val = (value >> 7) * 0x1b;
|
||||||
value = value << 1;
|
return ((value << 1) ^ xor_val);
|
||||||
return value ^ 0x1b;
|
|
||||||
} else {
|
|
||||||
return value << 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user