Skip to content

Commit addfda2

Browse files
smuellerDDherbertx
authored andcommitted
crypto: doc - cover new AEAD interface
The patch updates the DocBook to cover the new AEAD interface implementation. Signed-off-by: Stephan Mueller <smueller@chronox.de> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent b64a2d9 commit addfda2

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

‎Documentation/DocBook/crypto-API.tmpl‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -536,8 +536,8 @@
536536

537537
<para>
538538
For other use cases of AEAD ciphers, the ASCII art applies as
539-
well, but the caller may not use the GIVCIPHER interface. In
540-
this case, the caller must generate the IV.
539+
well, but the caller may not use the AEAD cipher with a separate
540+
IV generator. In this case, the caller must generate the IV.
541541
</para>
542542

543543
<para>
@@ -584,8 +584,8 @@ kernel crypto API | IPSEC Layer
584584
|
585585
+-----------+ |
586586
| | (1)
587-
| givcipher | <----------------------------------- esp_output
588-
| (seqiv) | ---+
587+
| aead | <----------------------------------- esp_output
588+
| (seqniv) | ---+
589589
+-----------+ |
590590
| (2)
591591
+-----------+ |
@@ -620,8 +620,8 @@ kernel crypto API | IPSEC Layer
620620
<orderedlist>
621621
<listitem>
622622
<para>
623-
esp_output() invokes crypto_aead_givencrypt() to trigger an encryption
624-
operation of the GIVCIPHER implementation.
623+
esp_output() invokes crypto_aead_encrypt() to trigger an encryption
624+
operation of the AEAD cipher with IV generator.
625625
</para>
626626

627627
<para>
@@ -1669,6 +1669,16 @@ read(opfd, out, outlen);
16691669
</chapter>
16701670

16711671
<chapter id="API"><title>Programming Interface</title>
1672+
<para>
1673+
Please note that the kernel crypto API contains the AEAD givcrypt
1674+
API (crypto_aead_giv* and aead_givcrypt_* function calls in
1675+
include/crypto/aead.h). This API is obsolete and will be removed
1676+
in the future. To obtain the functionality of an AEAD cipher with
1677+
internal IV generation, use the IV generator as a regular cipher.
1678+
For example, rfc4106(gcm(aes)) is the AEAD cipher with external
1679+
IV generation and seqniv(rfc4106(gcm(aes))) implies that the kernel
1680+
crypto API generates the IV. Different IV generators are available.
1681+
</para>
16721682
<sect1><title>Block Cipher Context Data Structures</title>
16731683
!Pinclude/linux/crypto.h Block Cipher Context Data Structures
16741684
!Finclude/crypto/aead.h aead_request
@@ -1724,6 +1734,7 @@ read(opfd, out, outlen);
17241734
!Finclude/crypto/aead.h aead_request_set_callback
17251735
!Finclude/crypto/aead.h aead_request_set_crypt
17261736
!Finclude/crypto/aead.h aead_request_set_assoc
1737+
!Finclude/crypto/aead.h aead_request_set_ad
17271738
</sect1>
17281739
<sect1><title>Synchronous Block Cipher API</title>
17291740
!Pinclude/linux/crypto.h Synchronous Block Cipher API

‎include/crypto/aead.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
/**
5151
* struct aead_request - AEAD request
5252
* @base: Common attributes for async crypto requests
53+
* @old: Boolean whether the old or new AEAD API is used
5354
* @assoclen: Length in bytes of associated data for authentication
5455
* @cryptlen: Length of data to be encrypted or decrypted
5556
* @iv: Initialisation vector
@@ -467,7 +468,9 @@ static inline void aead_request_set_callback(struct aead_request *req,
467468
* @iv: IV for the cipher operation which must comply with the IV size defined
468469
* by crypto_aead_ivsize()
469470
*
470-
* Setting the source data and destination data scatter / gather lists.
471+
* Setting the source data and destination data scatter / gather lists which
472+
* hold the associated data concatenated with the plaintext or ciphertext. See
473+
* below for the authentication tag.
471474
*
472475
* For encryption, the source is treated as the plaintext and the
473476
* destination is the ciphertext. For a decryption operation, the use is

0 commit comments

Comments
 (0)