[PATCH 22/30] crypto: sa2ul - move export to appropriate location.
From: Manorit Chawdhry
Date: Tue Sep 15 2026 - 06:15:51 EST
The current code just writes ipad/opad into the sa2ul context but SA2UL
requires the intermediate digest to be programmed into it.
Export the intermediate hash state before big endian processing to
program the correct state in SA2UL.
Assisted-by: Sisyphus:claude-sonnet-4-6
Signed-off-by: Manorit Chawdhry <m-chawdhry@xxxxxx>
---
drivers/crypto/sa2ul.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c
index f89e84c5529b..36c8403b5713 100644
--- a/drivers/crypto/sa2ul.c
+++ b/drivers/crypto/sa2ul.c
@@ -400,6 +400,14 @@ static int sa_export_shash(void *state, struct shash_desc *hash,
u32 *result;
int ret = 0;
+ /* Export the intermediate digest to program into SA2UL */
+ ret = crypto_shash_export(hash, state);
+ if (ret) {
+ dev_err(sa_k3_dev, "%s: crypto_shash_export failed\n",
+ __func__);
+ return ret;
+ }
+
switch (digest_size) {
case SHA1_DIGEST_SIZE:
sha1 = state;
@@ -415,13 +423,6 @@ static int sa_export_shash(void *state, struct shash_desc *hash,
return -EINVAL;
}
- ret = crypto_shash_export(hash, state);
- if (ret) {
- dev_err(sa_k3_dev, "%s: crypto_shash_export failed\n",
- __func__);
- return ret;
- }
-
cpu_to_be32_array(out, result, digest_size / 4);
return ret;
--
2.43.0