From: Stephan Mueller Date: Mon, 5 Jan 2015 11:21:45 +0000 (+0100) Subject: crypto: aead - add check for presence of auth tag X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=15acabfd02e35e270360fbe0def898e48754b3d6;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git crypto: aead - add check for presence of auth tag 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 Signed-off-by: Herbert Xu --- diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 9c8776d0ada8..90998348e564 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -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); }