summaryrefslogtreecommitdiff
path: root/cipher
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@iki.fi>2022-10-26 21:58:48 +0300
committerJussi Kivilinna <jussi.kivilinna@iki.fi>2022-10-26 22:03:24 +0300
commiteab1caae7bd529c09d809d4d7c64c97ab7abeab8 (patch)
tree6afc19bcddf5107a0ee3c3a026e003ebc0531dd8 /cipher
parent8a1fe5f78f9fed32cd641b3d9d02197f7ba394d8 (diff)
downloadlibgcrypt-eab1caae7bd529c09d809d4d7c64c97ab7abeab8.tar.gz
sha3-avx512: fix for "x32" target
* cipher/keccak.c (_gcry_keccak_absorb_blocks_avx512): Change size_t to u64; change 'const byte **new_lanes' to 'u64 *new_lanes'. (keccak_absorb_lanes64_avx512): Get new lines pointer from assembly through 'u64' type. -- Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher')
-rw-r--r--cipher/keccak.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cipher/keccak.c b/cipher/keccak.c
index 6c385f71..22c40302 100644
--- a/cipher/keccak.c
+++ b/cipher/keccak.c
@@ -456,8 +456,8 @@ _gcry_keccak_f1600_state_permute64_avx512(u64 *state, const u64 *rconst);
extern ASM_FUNC_ABI unsigned int
_gcry_keccak_absorb_blocks_avx512(u64 *state, const u64 *rconst,
- const byte *lanes, size_t nlanes,
- size_t blocklanes, const byte **new_lanes);
+ const byte *lanes, u64 nlanes,
+ u64 blocklanes, u64 *new_lanes);
static unsigned int
keccak_f1600_state_permute64_avx512(KECCAK_STATE *hd)
@@ -474,9 +474,12 @@ keccak_absorb_lanes64_avx512(KECCAK_STATE *hd, int pos, const byte *lanes,
{
if (pos == 0 && blocklanes > 0 && nlanes >= (size_t)blocklanes)
{
+ /* Get new pointer through u64 variable for "x32" compatibility. */
+ u64 new_lanes;
nlanes = _gcry_keccak_absorb_blocks_avx512 (
hd->u.state64, _gcry_keccak_round_consts_64bit,
- lanes, nlanes, blocklanes, &lanes);
+ lanes, nlanes, blocklanes, &new_lanes);
+ lanes = (const byte *)(uintptr_t)new_lanes;
}
while (nlanes)