mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] crypto: AEAD: add check for presence of auth tag
@ 2015-01-05 11:21 Stephan Mueller
  2015-01-08 10:48 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Stephan Mueller @ 2015-01-05 11:21 UTC (permalink / raw)
  To: 'Herbert Xu'; +Cc: linux-kernel, linux-crypto

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>
---
 include/linux/crypto.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 9c8776d..9099834 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);
 }
 
-- 
2.1.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] crypto: AEAD: add check for presence of auth tag
  2015-01-05 11:21 [PATCH v2] crypto: AEAD: add check for presence of auth tag Stephan Mueller
@ 2015-01-08 10:48 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2015-01-08 10:48 UTC (permalink / raw)
  To: Stephan Mueller; +Cc: linux-kernel, linux-crypto

On Mon, Jan 05, 2015 at 12:21:45PM +0100, Stephan Mueller wrote:
> 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>

Applied.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-08 10:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-05 11:21 [PATCH v2] crypto: AEAD: add check for presence of auth tag Stephan Mueller
2015-01-08 10:48 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®