Commit 2b0c9540 authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Herbert Xu
Browse files

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: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 425359ae
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -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.