crypto: aead - fix inaccurate documentation

The AEAD documentation conflates associated data and authentication
tags: the former (along with the ciphertext) is authenticated by the
latter. Fix the doc accordingly.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Ard Biesheuvel 2022-12-14 18:19:57 +01:00 committed by Herbert Xu
parent 425359aef4
commit 2b0c954010

View file

@ -27,15 +27,12 @@
*
* For example: authenc(hmac(sha256), cbc(aes))
*
* The example code provided for the symmetric key cipher operation
* applies here as well. Naturally all *skcipher* symbols must be exchanged
* the *aead* pendants discussed in the following. In addition, for the AEAD
* operation, the aead_request_set_ad function must be used to set the
* pointer to the associated data memory location before performing the
* encryption or decryption operation. In case of an encryption, the associated
* data memory is filled during the encryption operation. For decryption, the
* associated data memory must contain data that is used to verify the integrity
* of the decrypted data. Another deviation from the asynchronous block cipher
* The example code provided for the symmetric key cipher operation applies
* here as well. Naturally all *skcipher* symbols must be exchanged the *aead*
* pendants discussed in the following. In addition, for the AEAD operation,
* the aead_request_set_ad function must be used to set the pointer to the
* associated data memory location before performing the encryption or
* decryption operation. Another deviation from the asynchronous block cipher
* operation is that the caller should explicitly check for -EBADMSG of the
* crypto_aead_decrypt. That error indicates an authentication error, i.e.
* a breach in the integrity of the message. In essence, that -EBADMSG error
@ -49,7 +46,10 @@
*
* The destination scatterlist has the same layout, except that the plaintext
* (resp. ciphertext) will grow (resp. shrink) by the authentication tag size
* during encryption (resp. decryption).
* during encryption (resp. decryption). The authentication tag is generated
* during the encryption operation and appended to the ciphertext. During
* decryption, the authentication tag is consumed along with the ciphertext and
* used to verify the integrity of the plaintext and the associated data.
*
* In-place encryption/decryption is enabled by using the same scatterlist
* pointer for both the source and destination.