DPDK patches and discussions
 help / color / mirror / Atom feed
From: Arek Kusztal <arkadiuszx.kusztal@intel.com>
To: dev@dpdk.org
Cc: gakhil@marvell.com, kai.ji@intel.com,
	Arek Kusztal <arkadiuszx.kusztal@intel.com>
Subject: [PATCH 1/4] cryptodev: add SM4 encryption algorithm
Date: Wed, 17 Aug 2022 07:08:53 +0100	[thread overview]
Message-ID: <20220817060856.78582-2-arkadiuszx.kusztal@intel.com> (raw)
In-Reply-To: <20220817060856.78582-1-arkadiuszx.kusztal@intel.com>

SM4 is a block cipher used in the Chinese National Standard for
Wireless LAN WAPI and also used with Transport Layer Security.

- Added SM4 encryption algorithm.
Supported modes are ECB, CBC and CTR.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
---
 doc/guides/cryptodevs/features/default.ini | 3 +++
 doc/guides/rel_notes/release_22_11.rst     | 4 ++++
 lib/cryptodev/rte_crypto_sym.h             | 9 ++++++++-
 lib/cryptodev/rte_cryptodev.c              | 5 ++++-
 4 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini
index 7371ca6644..1608426b12 100644
--- a/doc/guides/cryptodevs/features/default.ini
+++ b/doc/guides/cryptodevs/features/default.ini
@@ -61,6 +61,9 @@ DES DOCSIS BPI =
 SNOW3G UEA2    =
 KASUMI F8      =
 ZUC EEA3       =
+SM4 ECB        =
+SM4 CBC        =
+SM4 CTR        =
 
 ;
 ; Supported authentication algorithms of a default crypto driver.
diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst
index 8c021cf050..15fc6ec40a 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -55,6 +55,10 @@ New Features
      Also, make sure to start the actual text at the margin.
      =======================================================
 
+* **Added SM4 encryption algorithm in ECB, CBC and CTR mode.**
+
+   Added SM4 encryption algorithm to the Cryptodev API.
+   Supported modes are ECB, CBC and CTR.
 
 Removed Items
 -------------
diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index daa090b978..33420e0b36 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -160,12 +160,19 @@ enum rte_crypto_cipher_algorithm {
 	 * for m_src and m_dst in the rte_crypto_sym_op must be NULL.
 	 */
 
-	RTE_CRYPTO_CIPHER_DES_DOCSISBPI
+	RTE_CRYPTO_CIPHER_DES_DOCSISBPI,
 	/**< DES algorithm using modes required by
 	 * DOCSIS Baseline Privacy Plus Spec.
 	 * Chained mbufs are not supported in this mode, i.e. rte_mbuf.next
 	 * for m_src and m_dst in the rte_crypto_sym_op must be NULL.
 	 */
+
+	RTE_CRYPTO_CIPHER_SM4_ECB,
+	/**< SM4 algorithm in ECB mode */
+	RTE_CRYPTO_CIPHER_SM4_CBC,
+	/**< SM4 algorithm in CBC mode */
+	RTE_CRYPTO_CIPHER_SM4_CTR
+	/**< SM4 algorithm in CTR mode */
 };
 
 /** Cipher algorithm name strings */
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 42f3221052..266804f0fe 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -89,7 +89,10 @@ rte_crypto_cipher_algorithm_strings[] = {
 
 	[RTE_CRYPTO_CIPHER_KASUMI_F8]	= "kasumi-f8",
 	[RTE_CRYPTO_CIPHER_SNOW3G_UEA2]	= "snow3g-uea2",
-	[RTE_CRYPTO_CIPHER_ZUC_EEA3]	= "zuc-eea3"
+	[RTE_CRYPTO_CIPHER_ZUC_EEA3]	= "zuc-eea3",
+	[RTE_CRYPTO_CIPHER_SM4_ECB]	= "sm4-ecb",
+	[RTE_CRYPTO_CIPHER_SM4_CBC]	= "sm4-cbc",
+	[RTE_CRYPTO_CIPHER_SM4_CTR]	= "sm4-ctr"
 };
 
 /**
-- 
2.13.6


  reply	other threads:[~2022-08-17  7:17 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17  6:08 [PATCH 0/4] cryptodev: add SM3 and SM4 algorithms Arek Kusztal
2022-08-17  6:08 ` Arek Kusztal [this message]
2022-08-17  6:08 ` [PATCH 2/4] cryptodev: add SM3 hash algorithm Arek Kusztal
2022-08-17 10:35   ` [EXT] " Anoob Joseph
2022-08-17  6:08 ` [PATCH 3/4] crypto/qat: add SM4 encryption algorithm Arek Kusztal
2022-08-17  6:08 ` [PATCH 4/4] crypto/qat : add SM3 hash algorithm Arek Kusztal
2022-09-21 19:34   ` [EXT] " Akhil Goyal
2022-09-21 19:37 ` [EXT] [PATCH 0/4] cryptodev: add SM3 and SM4 algorithms Akhil Goyal
2022-09-28 10:56   ` Kusztal, ArkadiuszX
2022-09-28 11:05     ` Akhil Goyal
2022-09-28 11:49       ` Kusztal, ArkadiuszX

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=20220817060856.78582-2-arkadiuszx.kusztal@intel.com \
    --to=arkadiuszx.kusztal@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).