[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251020005038.661542-8-ebiggers@kernel.org>
Date: Sun, 19 Oct 2025 17:50:28 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: linux-crypto@...r.kernel.org
Cc: David Howells <dhowells@...hat.com>,
Ard Biesheuvel <ardb@...nel.org>,
"Jason A . Donenfeld" <Jason@...c4.com>,
linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-s390@...r.kernel.org,
Eric Biggers <ebiggers@...nel.org>
Subject: [PATCH 07/17] lib/crypto: sha3: Use appropriate conversions in sha3_keccakf_generic()
For converting from little endian to CPU endian, use le64_to_cpus().
For converting from CPU endian to little endian, use cpu_to_le64s().
No functional change, but this makes the code clearer.
Signed-off-by: Eric Biggers <ebiggers@...nel.org>
---
lib/crypto/sha3.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/crypto/sha3.c b/lib/crypto/sha3.c
index 2c292b0b3db34..8f08e7b8f4521 100644
--- a/lib/crypto/sha3.c
+++ b/lib/crypto/sha3.c
@@ -168,16 +168,16 @@ static void sha3_keccakf_rounds_generic(struct sha3_state *state)
* loops are no-ops on LE machines and will be optimised away.
*/
static void sha3_keccakf_generic(struct sha3_state *state)
{
for (int i = 0; i < ARRAY_SIZE(state->st); i++)
- cpu_to_le64s(&state->st[i]);
+ le64_to_cpus(&state->st[i]);
sha3_keccakf_rounds_generic(state);
for (int i = 0; i < ARRAY_SIZE(state->st); i++)
- le64_to_cpus(&state->st[i]);
+ cpu_to_le64s(&state->st[i]);
}
static void sha3_absorb_block_generic(struct sha3_ctx *ctx, const u8 *data)
{
struct sha3_state *state = &ctx->state;
--
2.51.1.dirty
Powered by blists - more mailing lists