@@ -483,30 +483,18 @@ static inline void aead_request_set_callback(struct aead_request *req,
483
483
* destination is the ciphertext. For a decryption operation, the use is
484
484
* reversed - the source is the ciphertext and the destination is the plaintext.
485
485
*
486
- * For both src/dst the layout is associated data, plain/cipher text,
487
- * authentication tag.
488
- *
489
- * The content of the AD in the destination buffer after processing
490
- * will either be untouched, or it will contain a copy of the AD
491
- * from the source buffer. In order to ensure that it always has
492
- * a copy of the AD, the user must copy the AD over either before
493
- * or after processing. Of course this is not relevant if the user
494
- * is doing in-place processing where src == dst.
495
- *
496
- * IMPORTANT NOTE AEAD requires an authentication tag (MAC). For decryption,
497
- * the caller must concatenate the ciphertext followed by the
498
- * authentication tag and provide the entire data stream to the
499
- * decryption operation (i.e. the data length used for the
500
- * initialization of the scatterlist and the data length for the
501
- * decryption operation is identical). For encryption, however,
502
- * the authentication tag is created while encrypting the data.
503
- * The destination buffer must hold sufficient space for the
504
- * ciphertext and the authentication tag while the encryption
505
- * invocation must only point to the plaintext data size. The
506
- * following code snippet illustrates the memory usage
507
- * buffer = kmalloc(ptbuflen + (enc ? authsize : 0));
508
- * sg_init_one(&sg, buffer, ptbuflen + (enc ? authsize : 0));
509
- * aead_request_set_crypt(req, &sg, &sg, ptbuflen, iv);
486
+ * The memory structure for cipher operation has the following structure:
487
+ *
488
+ * - AEAD encryption input: assoc data || plaintext
489
+ * - AEAD encryption output: assoc data || cipherntext || auth tag
490
+ * - AEAD decryption input: assoc data || ciphertext || auth tag
491
+ * - AEAD decryption output: assoc data || plaintext
492
+ *
493
+ * Albeit the kernel requires the presence of the AAD buffer, however,
494
+ * the kernel does not fill the AAD buffer in the output case. If the
495
+ * caller wants to have that data buffer filled, the caller must either
496
+ * use an in-place cipher operation (i.e. same memory location for
497
+ * input/output memory location).
510
498
*/
511
499
static inline void aead_request_set_crypt (struct aead_request * req ,
512
500
struct scatterlist * src ,
0 commit comments