aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2015-01-05 06:21:45 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2015-01-08 05:46:18 -0500
commit15acabfd02e35e270360fbe0def898e48754b3d6 (patch)
tree7d510d2073d5504d17bed2b9038057f16bf2f97b
parent42d2e780c6239040ec29d404f87e752de3627e08 (diff)
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 <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--include/linux/crypto.h3
1 files changed, 3 insertions, 0 deletions
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)
1412 */ 1412 */
1413static inline int crypto_aead_decrypt(struct aead_request *req) 1413static inline int crypto_aead_decrypt(struct aead_request *req)
1414{ 1414{
1415 if (req->cryptlen < crypto_aead_authsize(crypto_aead_reqtfm(req)))
1416 return -EINVAL;
1417
1415 return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req); 1418 return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req);
1416} 1419}
1417 1420