[v2,2/2] cryptodev: add sm3 hash algorithm

Message ID 20220928131801.64467-3-arkadiuszx.kusztal@intel.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series cryptodev: add SM3 and SM4 algorithms |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS

Commit Message

Arkadiusz Kusztal Sept. 28, 2022, 1:18 p.m. UTC
  ShangMi 3 (SM3) is a cryptographic hash function used in
the Chinese National Standard.

- Added SM3 algorithm

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

Comments

Ji, Kai Sept. 28, 2022, 3:27 p.m. UTC | #1
Acked-by: Kai Ji <kai.ji@intel.com>

> -----Original Message-----
> From: Kusztal, ArkadiuszX <arkadiuszx.kusztal@intel.com>
> Sent: Wednesday, September 28, 2022 2:18 PM
> To: dev@dpdk.org
> Cc: gakhil@marvell.com; Ji, Kai <kai.ji@intel.com>; Kusztal, ArkadiuszX
> <arkadiuszx.kusztal@intel.com>
> Subject: [PATCH v2 2/2] cryptodev: add sm3 hash algorithm
> 
> ShangMi 3 (SM3) is a cryptographic hash function used in the Chinese
> National Standard.
> 
> - Added SM3 algorithm
> 
> Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
> ---
  

Patch

diff --git a/doc/guides/cryptodevs/features/default.ini b/doc/guides/cryptodevs/features/default.ini
index 1608426b12..d51d80ff80 100644
--- a/doc/guides/cryptodevs/features/default.ini
+++ b/doc/guides/cryptodevs/features/default.ini
@@ -98,6 +98,7 @@  SHA3_384        =
 SHA3_384 HMAC   =
 SHA3_512        =
 SHA3_512 HMAC   =
+SM3             =
 
 ;
 ; Supported AEAD 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 e8113ee056..c0ae4e5608 100644
--- a/doc/guides/rel_notes/release_22_11.rst
+++ b/doc/guides/rel_notes/release_22_11.rst
@@ -85,6 +85,11 @@  New Features
    Added ``RTE_CRYPTO_CIPHER_SM4_ECB``, ``RTE_CRYPTO_CIPHER_SM4_CBC``,
    ``RTE_CRYPTO_CIPHER_SM4_CTR`` to the cipher algorithm list in the cryptodev.
 
+* **Added ShangMi 3 (SM3) hash algorithm to the cryptodev.**
+
+   Added ``RTE_CRYPTO_AUTH_SM3`` to the auth algorithm list in the cryptodev.
+
+
 Removed Items
 -------------
 
diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index 613950993a..5b3c210837 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -370,8 +370,10 @@  enum rte_crypto_auth_algorithm {
 	/**< HMAC using 384 bit SHA3 algorithm. */
 	RTE_CRYPTO_AUTH_SHA3_512,
 	/**< 512 bit SHA3 algorithm. */
-	RTE_CRYPTO_AUTH_SHA3_512_HMAC
+	RTE_CRYPTO_AUTH_SHA3_512_HMAC,
 	/**< HMAC using 512 bit SHA3 algorithm. */
+	RTE_CRYPTO_AUTH_SM3
+	/**< ShangMi 3 (SM3) algorithm */
 };
 
 /** Authentication algorithm name strings */
diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c
index 5622c5a735..0c57e73a29 100644
--- a/lib/cryptodev/rte_cryptodev.c
+++ b/lib/cryptodev/rte_cryptodev.c
@@ -144,7 +144,8 @@  rte_crypto_auth_algorithm_strings[] = {
 
 	[RTE_CRYPTO_AUTH_KASUMI_F9]	= "kasumi-f9",
 	[RTE_CRYPTO_AUTH_SNOW3G_UIA2]	= "snow3g-uia2",
-	[RTE_CRYPTO_AUTH_ZUC_EIA3]	= "zuc-eia3"
+	[RTE_CRYPTO_AUTH_ZUC_EIA3]	= "zuc-eia3",
+	[RTE_CRYPTO_AUTH_SM3]		= "sm3"
 };
 
 /**