Skip to content

Commit

Permalink
crypto: aead - add check for presence of auth tag
Browse files Browse the repository at this point in the history
The AEAD decryption operation requires the authentication tag to be
present as part of the cipher text buffer. The added check verifies that
the caller provides a cipher text with at least the authentication tag.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Stephan Mueller authored and Herbert Xu committed Jan 8, 2015
1 parent 42d2e78 commit 15acabf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions include/linux/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,9 @@ static inline int crypto_aead_encrypt(struct aead_request *req)
*/
static inline int crypto_aead_decrypt(struct aead_request *req)
{
if (req->cryptlen < crypto_aead_authsize(crypto_aead_reqtfm(req)))
return -EINVAL;

return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req);
}

Expand Down

0 comments on commit 15acabf

Please sign in to comment.