Skip to contentSkip to conversation

crypto: AEAD: add check for presence of auth tag

PATCH Applied Stephan Mueller 2 participants 2 messages Jan 5, 2015 – Jan 8, 2015 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
 include/linux/crypto.h | 3 +++
 1 file changed, 3 insertions(+)
include/linux/crypto.h +3 -0
index 9c8776d..9099834 100644
@@ -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);
 }
 
Signature · 1 line
2.1.0
maintainer Applied
#1 lore raw
Quoted 5 lines · Stephan Mueller

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.

Applied.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt