Skip to content

Commit 55b1681

Browse files
harshj-xlnxmichalsimek
authored andcommitted
crypto: Update HASH_MAX_DESCSIZE to include space for fallback tfm.
Adds additional 8 byte required for fallback tfm pointer in versal-sha3-384. It fixes self-test warn_on when HMAC template tries to use versal-sha3-384 as inner tfm. -----------[ cut here ]----------- WARNING: CPU: 1 PID: 578 at crypto/shash.c:495 crypto_shash_init_tfm+0xac/0xd0 Modules linked in: CPU: 1 PID: 578 Comm: cryptomgr_test Tainted: G W 6.6.0-xilinx-v2024.1-g01dca40485e6-dirty #7 Hardware name: Xilinx Versal vck190 Eval board revA (DT) pstate: 20000005 (nzCv daif PAN -UAO -TCO -DIT -SSBS BTYPE=-) pc : crypto_shash_init_tfm+0xac/0xd0 We can remove this fix once Herbert is done with updating shash framework to support multibuffer requests (link below). Signed-off-by: Harsh Jain <[email protected]> Message-ID: <[email protected]> Link: https://lore.kernel.org/linux-crypto/CAFXBA=kHUHNH_BEnK=sWvWPJPoxsDh56OEhisbRGzdD19Di2gQ@mail.gmail.com/T/#md4c42d52caab7c7dd8ee41ba194d2019d7e71d61 State: not-upstreamable
1 parent 3fe162a commit 55b1681

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/crypto/hash.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ struct shash_desc {
180180
#define HASH_MAX_DIGESTSIZE 64
181181

182182
/*
183-
* Worst case is hmac(sha3-224-generic). Its context is a nested 'shash_desc'
184-
* containing a 'struct sha3_state'.
183+
* Worst case is hmac(versal-sha3-384). Its context is a nested 'shash_desc'
184+
* containing a 'struct sha3_state' plus fallback shash_desc.
185185
*/
186-
#define HASH_MAX_DESCSIZE (sizeof(struct shash_desc) + 360)
186+
#define HASH_MAX_DESCSIZE ((sizeof(struct shash_desc) * 2) + 360)
187187

188188
#define SHASH_DESC_ON_STACK(shash, ctx) \
189189
char __##shash##_desc[sizeof(struct shash_desc) + HASH_MAX_DESCSIZE] \

0 commit comments

Comments
 (0)