Skip to content

Commit 693b549

Browse files
committed
crypto: aead - Document behaviour of AD in destination buffer
This patch defines the behaviour of AD in the new interface more clearly. In particular, it specifies that if the user must copy the AD to the destination manually when src != dst if they wish to guarantee that the destination buffer contains a copy of the AD. The reason for this is that otherwise every AEAD implementation would have to perform such a copy when src != dst. In reality most users do in-place processing where src == dst so this is not an issue. This patch also kills some remaining references to cryptoff. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 6d7e3d8 commit 693b549

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎include/crypto/aead.h‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,15 @@ static inline void aead_request_set_callback(struct aead_request *req,
473473
* destination is the ciphertext. For a decryption operation, the use is
474474
* reversed - the source is the ciphertext and the destination is the plaintext.
475475
*
476-
* For both src/dst the layout is associated data, skipped data,
477-
* plain/cipher text, authentication tag.
476+
* For both src/dst the layout is associated data, plain/cipher text,
477+
* authentication tag.
478+
*
479+
* The content of the AD in the destination buffer after processing
480+
* will either be untouched, or it will contain a copy of the AD
481+
* from the source buffer. In order to ensure that it always has
482+
* a copy of the AD, the user must copy the AD over either before
483+
* or after processing. Of course this is not relevant if the user
484+
* is doing in-place processing where src == dst.
478485
*
479486
* IMPORTANT NOTE AEAD requires an authentication tag (MAC). For decryption,
480487
* the caller must concatenate the ciphertext followed by the
@@ -525,8 +532,7 @@ static inline void aead_request_set_assoc(struct aead_request *req,
525532
* @assoclen: number of bytes in associated data
526533
*
527534
* Setting the AD information. This function sets the length of
528-
* the associated data and the number of bytes to skip after it to
529-
* access the plain/cipher text.
535+
* the associated data.
530536
*/
531537
static inline void aead_request_set_ad(struct aead_request *req,
532538
unsigned int assoclen)

0 commit comments

Comments
 (0)