mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
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>
This commit is contained in:
parent
ecd71c95a6
commit
2b1a29ce33
|
|
@ -479,6 +479,8 @@ static int shash_prepare_alg(struct shash_alg *alg)
|
|||
|
||||
if (alg->descsize > HASH_MAX_DESCSIZE)
|
||||
return -EINVAL;
|
||||
if (alg->statesize > HASH_MAX_STATESIZE)
|
||||
return -EINVAL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user