Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ard Biesheuvel and committed by
Herbert Xu
2b0c9540 425359ae

+10 -10
+10 -10
include/crypto/aead.h
··· 27 27 * 28 28 * For example: authenc(hmac(sha256), cbc(aes)) 29 29 * 30 - * The example code provided for the symmetric key cipher operation 31 - * applies here as well. Naturally all *skcipher* symbols must be exchanged 32 - * the *aead* pendants discussed in the following. In addition, for the AEAD 33 - * operation, the aead_request_set_ad function must be used to set the 34 - * pointer to the associated data memory location before performing the 35 - * encryption or decryption operation. In case of an encryption, the associated 36 - * data memory is filled during the encryption operation. For decryption, the 37 - * associated data memory must contain data that is used to verify the integrity 38 - * of the decrypted data. Another deviation from the asynchronous block cipher 30 + * The example code provided for the symmetric key cipher operation applies 31 + * here as well. Naturally all *skcipher* symbols must be exchanged the *aead* 32 + * pendants discussed in the following. In addition, for the AEAD operation, 33 + * the aead_request_set_ad function must be used to set the pointer to the 34 + * associated data memory location before performing the encryption or 35 + * decryption operation. Another deviation from the asynchronous block cipher 39 36 * operation is that the caller should explicitly check for -EBADMSG of the 40 37 * crypto_aead_decrypt. That error indicates an authentication error, i.e. 41 38 * a breach in the integrity of the message. In essence, that -EBADMSG error ··· 46 49 * 47 50 * The destination scatterlist has the same layout, except that the plaintext 48 51 * (resp. ciphertext) will grow (resp. shrink) by the authentication tag size 49 - * during encryption (resp. decryption). 52 + * during encryption (resp. decryption). The authentication tag is generated 53 + * during the encryption operation and appended to the ciphertext. During 54 + * decryption, the authentication tag is consumed along with the ciphertext and 55 + * used to verify the integrity of the plaintext and the associated data. 50 56 * 51 57 * In-place encryption/decryption is enabled by using the same scatterlist 52 58 * pointer for both the source and destination.