From b828df51dd5b6249e96f742670b7f17caa878846 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 31 Aug 2023 23:18:09 +0200 Subject: [PATCH] scrypt_integerify_sse: be consistent with the no_sse version --- .../sse/pwhash_scryptsalsa208sha256_sse.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c index 73ee4025..c3ea0a3b 100644 --- a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c @@ -210,11 +210,13 @@ blockmix_salsa8_xor(const __m128i *Bin1, const __m128i *Bin2, __m128i *Bout, * Note that B's layout is permuted compared to the generic implementation. */ static inline uint64_t -integerify(const void *B, size_t r) +integerify(const __m128i *B, size_t r) { - const uint64_t *X = ((const uint64_t *) B) + (2 * r - 1) * 8; + const __m128i * X = B + (2*r - 1) * 4; + const uint32_t X0 = (uint32_t) _mm_cvtsi128_si32(X[0]); + const uint32_t X13 = (uint32_t) _mm_cvtsi128_si32(_mm_srli_si128(X[3], 4)); - return *X; + return (((uint64_t)(X13) << 32) + X0); } /*