mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
crypto: aead - Do not allow authsize=0 if auth. alg has digestsize>0
Return -EINVAL on an attempt to set the authsize to 0 with an auth. algorithm with a non-zero digestsize (i.e. anything but digest_null) as authenticating the data and then throwing away the result does not make any sense at all. The digestsize zero exception is for use with digest_null for testing purposes only. Signed-off-by: Pascal van Leeuwen <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
This commit is contained in:
parent
440dc9aab5
commit
a62084d299
1 changed files with 2 additions and 1 deletions
|
|
@ -70,7 +70,8 @@ int crypto_aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize)
|
|||
{
|
||||
int err;
|
||||
|
||||
if (authsize > crypto_aead_maxauthsize(tfm))
|
||||
if ((!authsize && crypto_aead_maxauthsize(tfm)) ||
|
||||
authsize > crypto_aead_maxauthsize(tfm))
|
||||
return -EINVAL;
|
||||
|
||||
if (crypto_aead_alg(tfm)->setauthsize) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue