提交 15acabfd 编写于 作者: S Stephan Mueller 提交者: Herbert Xu

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: NStephan Mueller <smueller@chronox.de>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 42d2e780
...@@ -1412,6 +1412,9 @@ static inline int crypto_aead_encrypt(struct aead_request *req) ...@@ -1412,6 +1412,9 @@ static inline int crypto_aead_encrypt(struct aead_request *req)
*/ */
static inline int crypto_aead_decrypt(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); return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册