DPDK patches and discussions
 help / color / mirror / Atom feed
From: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, kai.ji@intel.com, ciara.power@intel.com,
	Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
Subject: [RFC] cryptodev: clarify usage of the block ciphers
Date: Fri, 11 Aug 2023 17:41:55 +0000	[thread overview]
Message-ID: <20230811174155.2550338-1-arkadiuszx.kusztal@intel.com> (raw)

Some of the API comments incorrectly limited the usage of symmetric
crypto fields to block ciphers.

Signed-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>
---
 lib/cryptodev/rte_crypto_sym.h | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index 76c868c503..d1ae982b93 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -139,6 +139,7 @@ enum rte_crypto_cipher_algorithm {
 	RTE_CRYPTO_CIPHER_AES_XTS,
 	/**< AES algorithm in XTS mode */
 
+	/* Should we not deprecate this algorithm by now?*/
 	RTE_CRYPTO_CIPHER_ARC4,
 	/**< (A)RC4 cipher algorithm */
 
@@ -284,7 +285,7 @@ struct rte_crypto_cipher_xform {
 		 *
 		 * - For block ciphers in CTR mode, this is the length
 		 * of the counter (which must be the same as the block
-		 * length of the cipher).
+		 * length of the cipher) or a 12-byte nonce (AES only)
 		 *
 		 * - For CCM mode, this is the length of the nonce,
 		 * which can be in the range 7 to 13 inclusive.
@@ -661,7 +662,7 @@ struct rte_crypto_sym_op {
 				uint32_t length;
 				 /**< The message length, in bytes, of the source buffer
 				  * on which the cryptographic operation will be
-				  * computed. This must be a multiple of the block size
+				  * computed.
 				  */
 			} data; /**< Data offsets and length for AEAD */
 			struct {
@@ -703,22 +704,12 @@ struct rte_crypto_sym_op {
 				 * and the length encoding in the first two bytes of the
 				 * second block.
 				 *
-				 * - the array should be big enough to hold the above
-				 * fields, plus any padding to round this up to the
-				 * nearest multiple of the block size (16 bytes).
-				 * Padding will be added by the implementation.
-				 *
 				 * - Note that PMDs may modify the memory reserved
 				 * (first 18 bytes and the final padding).
 				 *
 				 * Finally, for GCM (@ref RTE_CRYPTO_AEAD_AES_GCM), the
 				 * caller should setup this field as follows:
 				 *
-				 * - the AAD is written in starting at byte 0
-				 * - the array must be big enough to hold the AAD, plus
-				 * any space to round this up to the nearest multiple
-				 * of the block size (16 bytes).
-				 *
 				 */
 				rte_iova_t phys_addr;	/**< physical address */
 			} aad;
@@ -749,8 +740,9 @@ struct rte_crypto_sym_op {
 					  * source buffer on which the cryptographic
 					  * operation will be computed.
 					  * This is also the same as the result length.
-					  * This must be a multiple of the block size
-					  * or a multiple of data-unit length
+					  * For block ciphers, this must be a
+					  * multiple of the block size,
+					  * or for the AES-XTS a multiple of the data-unit length
 					  * as described in xform.
 					  *
 					  * @note
-- 
2.34.1


                 reply	other threads:[~2023-08-11 17:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230811174155.2550338-1-arkadiuszx.kusztal@intel.com \
    --to=arkadiuszx.kusztal@intel.com \
    --cc=ciara.power@intel.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=kai.ji@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).