crypto: shash - require neither or both ->export() and ->import()
PATCH 1/1 crypto: shash - require neither or both ->export() and ->import()
From: Eric Biggers <[email protected]>
Prevent registering shash algorithms that implement ->export() but not ->import(), or ->import() but not ->export(). Such cases don't make sense and could confuse the check that shash_prepare_alg() does for just ->export().
I don't believe this affects any existing algorithms; this is just preventing future mistakes.
--- crypto/shash.c | 3 +++ 1 file changed, 3 insertions(+)
crypto/shash.c +3 -0
@@ -472,6 +472,9 @@ static int shash_prepare_alg(struct shash_alg *alg) alg->statesize > HASH_MAX_STATESIZE)return -EINVAL ; +if ((alg->export && !alg->import) || (alg->import && !alg->export)) +return -EINVAL ; + base->cra_type = &crypto_shash_type; base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK ; base->cra_flags |=CRYPTO_ALG_TYPE_SHASH ;
Signature · 1 line
2.20.1
Herbert Xu
maintainerQuoted 7 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Prevent registering shash algorithms that implement ->export() but not ->import(), or ->import() but not ->export(). Such cases don't make sense and could confuse the check that
shash_prepare_alg()does for just ->export().
Quoted 7 lines
I don't believe this affects any existing algorithms; this is just preventing future mistakes.
Signed-off-by Eric Biggers <[email protected]>--- crypto/shash.c | 3 +++ 1 file changed, 3 insertions(+)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt