1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

clsq128(): simplify squaring

This commit is contained in:
Frank Denis 2022-11-16 22:51:44 +01:00
parent cda2788e00
commit 104de0dcd1
2 changed files with 2 additions and 8 deletions

View File

@ -191,16 +191,13 @@ static inline void __vectorcall encrypt_xor_wide(const State *st,
static inline I256 __vectorcall clsq128(const BlockVec x)
{
const BlockVec x_hi = BYTESHR128(x, 8);
const BlockVec mid = XOR128(x, x_hi);
const BlockVec r_lo = CLMULLO128(x, x);
const BlockVec r_hi = CLMULHI128(x, x);
const BlockVec r_mid = XOR128(CLMULLO128(mid, mid), XOR128(r_lo, r_hi));
return (I256) {
SODIUM_C99(.hi =) r_hi,
SODIUM_C99(.lo =) r_lo,
SODIUM_C99(.mid =) r_mid,
SODIUM_C99(.mid =) ZERO128,
};
}

View File

@ -205,16 +205,13 @@ static inline void __vectorcall encrypt_xor_wide(const State *st,
static inline I256 __vectorcall clsq128(const BlockVec x)
{
const BlockVec x_hi = BYTESHR128(x, 8);
const BlockVec mid = XOR128(x, x_hi);
const BlockVec r_lo = CLMULLO128(x, x);
const BlockVec r_hi = CLMULHI128(x, x);
const BlockVec r_mid = XOR128(CLMULLO128(mid, mid), XOR128(r_lo, r_hi));
return (I256) {
SODIUM_C99(.hi =) r_hi,
SODIUM_C99(.lo =) r_lo,
SODIUM_C99(.mid =) r_mid,
SODIUM_C99(.mid =) ZERO128,
};
}