summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2025-05-04 16:33:14 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2025-05-05 13:20:46 +0300
commit2b1a29ce3360570aeff053d1315cd504d94eab31 (patch)
treeaac1ec70b8bf61d92f84a0f38250b0237d70e89f /include
parentecd71c95a60e7298acfabe81189439f350bd0e18 (diff)
downloadlinux-2b1a29ce3360570aeff053d1315cd504d94eab31.tar.xz
crypto: shash - Cap state size to HASH_MAX_STATESIZE
Now that all shash algorithms have converted over to the generic export format, limit the shash state size to HASH_MAX_STATESIZE. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include')
-rw-r--r--include/crypto/hash.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index c2497c300a28..e0321b5ec363 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -167,8 +167,11 @@ struct shash_desc {
#define HASH_MAX_DIGESTSIZE 64
+/* Worst case is sha3-224. */
+#define HASH_MAX_STATESIZE 200 + 144 + 1
+
/*
- * Worst case is hmac(sha-224-s390). Its context is a nested 'shash_desc'
+ * Worst case is hmac(sha3-224-s390). Its context is a nested 'shash_desc'
* containing a 'struct s390_sha_ctx'.
*/
#define HASH_MAX_DESCSIZE (sizeof(struct shash_desc) + 360)