f (cipher, EAX_BLOCK_SIZE, state->b, state->b);
}
-/* Allows r == a */
-static void
-gf2_double (uint8_t *r, const uint8_t *a)
-{
- unsigned high = - (a[0] >> 7);
- unsigned i;
- /* Shift left */
- for (i = 0; i < EAX_BLOCK_SIZE - 1; i++)
- r[i] = (a[i] << 1) + (a[i+1] >> 7);
-
- /* Wrap around for x^{128} = x^7 + x^2 + x + 1 */
- r[EAX_BLOCK_SIZE - 1] = (a[EAX_BLOCK_SIZE - 1] << 1) ^ (high & 0x87);
-}
-
void
eax_set_key (struct eax_key *key, const void *cipher, nettle_cipher_func *f)
{
static const union nettle_block16 zero_block;
f (cipher, EAX_BLOCK_SIZE, key->pad_block.b, zero_block.b);
- gf2_double (key->pad_block.b, key->pad_block.b);
- gf2_double (key->pad_partial.b, key->pad_block.b);
+ block16_mulx_be (&key->pad_block, &key->pad_block);
+ block16_mulx_be (&key->pad_partial, &key->pad_block);
block16_xor (&key->pad_partial, &key->pad_block);
}