83 static const uint16_t LAST4[16] = {0x0000, 0x1c20, 0x3840, 0x2460, 0x7080, 0x6ca0, 0x48c0, 0x54e0,
84 0xe100, 0xfd20, 0xd940, 0xc560, 0x9180, 0x8da0, 0xa9c0, 0xb5e0};
85 uint8_t idx = acc[15] & 0x0f;
86 uint32_t z0 = t->
M[idx][0];
87 uint32_t z1 = t->
M[idx][1];
88 uint32_t z2 = t->
M[idx][2];
89 uint32_t z3 = t->
M[idx][3];
90 for (
int i = 15; i >= 0; i--)
92 uint8_t lo = acc[i] & 0x0f;
93 uint8_t hi = (acc[i] >> 4) & 0x0f;
96 uint32_t rem = z3 & 0x0f;
97 z3 = (z3 >> 4) | (z2 << 28);
98 z2 = (z2 >> 4) | (z1 << 28);
99 z1 = (z1 >> 4) | (z0 << 28);
100 z0 = (z0 >> 4) ^ ((uint32_t)LAST4[rem] << 16);
106 uint32_t rem = z3 & 0x0f;
107 z3 = (z3 >> 4) | (z2 << 28);
108 z2 = (z2 >> 4) | (z1 << 28);
109 z1 = (z1 >> 4) | (z0 << 28);
110 z0 = (z0 >> 4) ^ ((uint32_t)LAST4[rem] << 16);
void ghash_update(const GhashKey *t, uint8_t acc[16], const uint8_t *data, size_t len)
Fold len bytes of data into acc: acc = (acc XOR block) * H per 16 bytes, a final short block MSB-zero...
void ghash_mul(const GhashKey *t, uint8_t acc[16])
acc = acc * H in GF(2^128) with the GCM reduction, using the precomputed table t.