[1/2] lib/cryptodev/: Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK

Message ID 20230316031026.32600-1-sunyang.wu@jaguarmicro.com (mailing list archive)
State Changes Requested, archived
Delegated to: akhil goyal
Headers
Series [1/2] lib/cryptodev/: Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Sunyang Wu March 16, 2023, 3:10 a.m. UTC
  Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK.

Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
---
 lib/cryptodev/rte_crypto_sym.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Comments

Akhil Goyal March 16, 2023, 10:42 a.m. UTC | #1
> Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK.
> 

Can you give reference to some documentation for each of these modes.
Cannot find RFCs for SM3_HMAC etc.

> Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> ---
>  lib/cryptodev/rte_crypto_sym.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
  
Sunyang Wu March 18, 2023, 1 p.m. UTC | #2
Hi all:
SM3 and SM4 are widely used in China, and they are Chinese national standards. I'm very to tell you that I didn't find the relevant RFC documents for SM3 and SM4, 
but I found the national standards for SM3 and SM4 in the full text disclosure system of Chinese national standards, but they are all in Chinese. The links are shown below:
SM3: http://c.gb688.cn/bzgk/gb/showGb?type=online&hcno=45B1A67F20F3BF339211C391E9278F5E
SM4: http://c.gb688.cn/bzgk/gb/showGb?type=online&hcno=7803DE42D3BC5E80B0C3E5D8E873D56A
If these modes(SM3_HMAC / SM4_OFB / SM4_CFB) are not necessary, I can resubmit a patch, delete the corresponding test cases for these modes,
and retain only the test cases for the mods currently supported by DPdK.

-----邮件原件-----
发件人: Akhil Goyal <gakhil@marvell.com> 
发送时间: 2023年3月16日 18:43
收件人: Sunyang Wu <sunyang.wu@jaguarmicro.com>; dev@dpdk.org
抄送: kai.ji@intel.com
主题: RE: [EXT] [PATCH 1/2] lib/cryptodev/: Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK

> Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK.
> 

Can you give reference to some documentation for each of these modes.
Cannot find RFCs for SM3_HMAC etc.

> Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> ---
>  lib/cryptodev/rte_crypto_sym.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
  
Arkadiusz Kusztal April 19, 2023, 7:41 p.m. UTC | #3
> -----Original Message-----
> From: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> Sent: Saturday, March 18, 2023 2:00 PM
> To: Akhil Goyal <gakhil@marvell.com>; dev@dpdk.org
> Cc: Ji, Kai <kai.ji@intel.com>
> Subject: 回复: [EXT] [PATCH 1/2] lib/cryptodev/: Add
> SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK
> 
> Hi all:
> SM3 and SM4 are widely used in China, and they are Chinese national standards.
> I'm very to tell you that I didn't find the relevant RFC documents for SM3 and
> SM4, but I found the national standards for SM3 and SM4 in the full text
> disclosure system of Chinese national standards, but they are all in Chinese. The
> links are shown below:
> SM3:
> http://c.gb688.cn/bzgk/gb/showGb?type=online&hcno=45B1A67F20F3BF33921
> 1C391E9278F5E
> SM4:
> http://c.gb688.cn/bzgk/gb/showGb?type=online&hcno=7803DE42D3BC5E80B0
> C3E5D8E873D56A
> If these modes(SM3_HMAC / SM4_OFB / SM4_CFB) are not necessary, I can
> resubmit a patch, delete the corresponding test cases for these modes, and
> retain only the test cases for the mods currently supported by DPdK.
> 
> -----邮件原件-----
> 发件人: Akhil Goyal <gakhil@marvell.com>
> 发送时间: 2023年3月16日 18:43
> 收件人: Sunyang Wu <sunyang.wu@jaguarmicro.com>; dev@dpdk.org
> 抄送: kai.ji@intel.com
> 主题: RE: [EXT] [PATCH 1/2] lib/cryptodev/: Add
> SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK
> 
> > Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK.
> >
> 
> Can you give reference to some documentation for each of these modes.
> Cannot find RFCs for SM3_HMAC etc.

HMAC is supposed to work with any iterated hash function. Since we already have SM3 in the API, I would not worry about lack of RFC for specific SM3 + HMAC combination.

> 
> > Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> > ---
> >  lib/cryptodev/rte_crypto_sym.h | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
  
Akhil Goyal May 17, 2023, 7:04 a.m. UTC | #4
> Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK.
> 
> Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> ---
>  lib/cryptodev/rte_crypto_sym.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 

Please add release notes and update doc/guides/cryptodevs/features/default.ini.

The update to crypto_auth/cipher_algorithm_strings is also missing.

> diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
> index 2cfe66530c..c4572106dc 100644
> --- a/lib/cryptodev/rte_crypto_sym.h
> +++ b/lib/cryptodev/rte_crypto_sym.h
> @@ -172,8 +172,12 @@ enum rte_crypto_cipher_algorithm {
>  	/**< ShangMi 4 (SM4) algorithm in ECB mode */
>  	RTE_CRYPTO_CIPHER_SM4_CBC,
>  	/**< ShangMi 4 (SM4) algorithm in CBC mode */
> -	RTE_CRYPTO_CIPHER_SM4_CTR
> +	RTE_CRYPTO_CIPHER_SM4_CTR,
>  	/**< ShangMi 4 (SM4) algorithm in CTR mode */
> +	RTE_CRYPTO_CIPHER_SM4_OFB,
> +	/**< ShangMi 4 (SM4) algorithm in OFB mode */
> +	RTE_CRYPTO_CIPHER_SM4_CFB
> +	/**< ShangMi 4 (SM4) algorithm in CFB mode */
>  };
> 
>  /** Cipher algorithm name strings */
> @@ -376,6 +380,8 @@ enum rte_crypto_auth_algorithm {
>  	/**< HMAC using 512 bit SHA3 algorithm. */
>  	RTE_CRYPTO_AUTH_SM3,
>  	/**< ShangMi 3 (SM3) algorithm */
> +	RTE_CRYPTO_AUTH_SM3_HMAC,
> +	/** < HMAC using Chinese SM3 algorithm */
> 
>  	RTE_CRYPTO_AUTH_SHAKE_128,
>  	/**< 128 bit SHAKE algorithm. */
> --
> 2.19.0.rc0.windows.1
  
Akhil Goyal May 25, 2023, 8:27 a.m. UTC | #5
Hi Sunyang,

Can you send the next version for this patch?
We need to merge in RC1 (31st May).


> Subject: RE: [EXT] [PATCH 1/2] lib/cryptodev/: Add
> SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK
> 
> > Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK.
> >
> > Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> > ---
> >  lib/cryptodev/rte_crypto_sym.h | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> 
> Please add release notes and update
> doc/guides/cryptodevs/features/default.ini.
> 
> The update to crypto_auth/cipher_algorithm_strings is also missing.
> 
> > diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
> > index 2cfe66530c..c4572106dc 100644
> > --- a/lib/cryptodev/rte_crypto_sym.h
> > +++ b/lib/cryptodev/rte_crypto_sym.h
> > @@ -172,8 +172,12 @@ enum rte_crypto_cipher_algorithm {
> >  	/**< ShangMi 4 (SM4) algorithm in ECB mode */
> >  	RTE_CRYPTO_CIPHER_SM4_CBC,
> >  	/**< ShangMi 4 (SM4) algorithm in CBC mode */
> > -	RTE_CRYPTO_CIPHER_SM4_CTR
> > +	RTE_CRYPTO_CIPHER_SM4_CTR,
> >  	/**< ShangMi 4 (SM4) algorithm in CTR mode */
> > +	RTE_CRYPTO_CIPHER_SM4_OFB,
> > +	/**< ShangMi 4 (SM4) algorithm in OFB mode */
> > +	RTE_CRYPTO_CIPHER_SM4_CFB
> > +	/**< ShangMi 4 (SM4) algorithm in CFB mode */
> >  };
> >
> >  /** Cipher algorithm name strings */
> > @@ -376,6 +380,8 @@ enum rte_crypto_auth_algorithm {
> >  	/**< HMAC using 512 bit SHA3 algorithm. */
> >  	RTE_CRYPTO_AUTH_SM3,
> >  	/**< ShangMi 3 (SM3) algorithm */
> > +	RTE_CRYPTO_AUTH_SM3_HMAC,
> > +	/** < HMAC using Chinese SM3 algorithm */
> >
> >  	RTE_CRYPTO_AUTH_SHAKE_128,
> >  	/**< 128 bit SHAKE algorithm. */
> > --
> > 2.19.0.rc0.windows.1
  
Sunyang Wu May 25, 2023, 9 a.m. UTC | #6
Hi Akhil,
The patches have been resubmitted.

Best wishes
sunyang

-----Original Message-----
From: Akhil Goyal <gakhil@marvell.com>
Send: 2023.5.25 16:27 PM
To: Akhil Goyal <gakhil@marvell.com>; Sunyang Wu <sunyang.wu@jaguarmicro.com>; dev@dpdk.org
Cc: kai.ji@intel.com
Subject: RE: [EXT] [PATCH 1/2] lib/cryptodev/: Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK

Hi Sunyang,

Can you send the next version for this patch?
We need to merge in RC1 (31st May).


> Subject: RE: [EXT] [PATCH 1/2] lib/cryptodev/: Add 
> SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK
> 
> > Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK.
> >
> > Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> > ---
> >  lib/cryptodev/rte_crypto_sym.h | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> 
> Please add release notes and update
> doc/guides/cryptodevs/features/default.ini.
> 
> The update to crypto_auth/cipher_algorithm_strings is also missing.
> 
> > diff --git a/lib/cryptodev/rte_crypto_sym.h 
> > b/lib/cryptodev/rte_crypto_sym.h index 2cfe66530c..c4572106dc 100644
> > --- a/lib/cryptodev/rte_crypto_sym.h
> > +++ b/lib/cryptodev/rte_crypto_sym.h
> > @@ -172,8 +172,12 @@ enum rte_crypto_cipher_algorithm {
> >  	/**< ShangMi 4 (SM4) algorithm in ECB mode */
> >  	RTE_CRYPTO_CIPHER_SM4_CBC,
> >  	/**< ShangMi 4 (SM4) algorithm in CBC mode */
> > -	RTE_CRYPTO_CIPHER_SM4_CTR
> > +	RTE_CRYPTO_CIPHER_SM4_CTR,
> >  	/**< ShangMi 4 (SM4) algorithm in CTR mode */
> > +	RTE_CRYPTO_CIPHER_SM4_OFB,
> > +	/**< ShangMi 4 (SM4) algorithm in OFB mode */
> > +	RTE_CRYPTO_CIPHER_SM4_CFB
> > +	/**< ShangMi 4 (SM4) algorithm in CFB mode */
> >  };
> >
> >  /** Cipher algorithm name strings */ @@ -376,6 +380,8 @@ enum 
> > rte_crypto_auth_algorithm {
> >  	/**< HMAC using 512 bit SHA3 algorithm. */
> >  	RTE_CRYPTO_AUTH_SM3,
> >  	/**< ShangMi 3 (SM3) algorithm */
> > +	RTE_CRYPTO_AUTH_SM3_HMAC,
> > +	/** < HMAC using Chinese SM3 algorithm */
> >
> >  	RTE_CRYPTO_AUTH_SHAKE_128,
> >  	/**< 128 bit SHAKE algorithm. */
> > --
> > 2.19.0.rc0.windows.1
  
Akhil Goyal May 25, 2023, 9:04 a.m. UTC | #7
Hi Sunyang,
> Hi Akhil,
> The patches have been resubmitted.

Yeah they are resubmitted, but you should mark them as v2
And mention the changelog as well.

I can see that all the comments were not addressed.
Please add release notes.
The update to crypto_auth/cipher_algorithm_strings is also missing.

> 
> Best wishes
> sunyang
> 
> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Send: 2023.5.25 16:27 PM
> To: Akhil Goyal <gakhil@marvell.com>; Sunyang Wu
> <sunyang.wu@jaguarmicro.com>; dev@dpdk.org
> Cc: kai.ji@intel.com
> Subject: RE: [EXT] [PATCH 1/2] lib/cryptodev/: Add
> SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK
> 
> Hi Sunyang,
> 
> Can you send the next version for this patch?
> We need to merge in RC1 (31st May).
> 
> 
> > Subject: RE: [EXT] [PATCH 1/2] lib/cryptodev/: Add
> > SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK
> >
> > > Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK.
> > >
> > > Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> > > ---
> > >  lib/cryptodev/rte_crypto_sym.h | 8 +++++++-
> > >  1 file changed, 7 insertions(+), 1 deletion(-)
> > >
> >
> > Please add release notes and update
> > doc/guides/cryptodevs/features/default.ini.
> >
> > The update to crypto_auth/cipher_algorithm_strings is also missing.
> >
> > > diff --git a/lib/cryptodev/rte_crypto_sym.h
> > > b/lib/cryptodev/rte_crypto_sym.h index 2cfe66530c..c4572106dc 100644
> > > --- a/lib/cryptodev/rte_crypto_sym.h
> > > +++ b/lib/cryptodev/rte_crypto_sym.h
> > > @@ -172,8 +172,12 @@ enum rte_crypto_cipher_algorithm {
> > >  	/**< ShangMi 4 (SM4) algorithm in ECB mode */
> > >  	RTE_CRYPTO_CIPHER_SM4_CBC,
> > >  	/**< ShangMi 4 (SM4) algorithm in CBC mode */
> > > -	RTE_CRYPTO_CIPHER_SM4_CTR
> > > +	RTE_CRYPTO_CIPHER_SM4_CTR,
> > >  	/**< ShangMi 4 (SM4) algorithm in CTR mode */
> > > +	RTE_CRYPTO_CIPHER_SM4_OFB,
> > > +	/**< ShangMi 4 (SM4) algorithm in OFB mode */
> > > +	RTE_CRYPTO_CIPHER_SM4_CFB
> > > +	/**< ShangMi 4 (SM4) algorithm in CFB mode */
> > >  };
> > >
> > >  /** Cipher algorithm name strings */ @@ -376,6 +380,8 @@ enum
> > > rte_crypto_auth_algorithm {
> > >  	/**< HMAC using 512 bit SHA3 algorithm. */
> > >  	RTE_CRYPTO_AUTH_SM3,
> > >  	/**< ShangMi 3 (SM3) algorithm */
> > > +	RTE_CRYPTO_AUTH_SM3_HMAC,
> > > +	/** < HMAC using Chinese SM3 algorithm */
> > >
> > >  	RTE_CRYPTO_AUTH_SHAKE_128,
> > >  	/**< 128 bit SHAKE algorithm. */
> > > --
> > > 2.19.0.rc0.windows.1
  
Sunyang Wu May 25, 2023, 9:25 a.m. UTC | #8
Hi Akhil,

I'm so sorry, I don't quite understand your request.
Please tell me how to update the crypto_auth/cipher_algorithm_strings.

-----邮件原件-----
发件人: Akhil Goyal <gakhil@marvell.com> 
发送时间: 2023年5月25日 17:04
收件人: Sunyang Wu <sunyang.wu@jaguarmicro.com>; dev@dpdk.org
抄送: kai.ji@intel.com
主题: RE: [EXT] [PATCH 1/2] lib/cryptodev/: Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK

Hi Sunyang,
> Hi Akhil,
> The patches have been resubmitted.

Yeah they are resubmitted, but you should mark them as v2 And mention the changelog as well.

I can see that all the comments were not addressed.
Please add release notes.
The update to crypto_auth/cipher_algorithm_strings is also missing.

> 
> Best wishes
> sunyang
> 
> -----Original Message-----
> From: Akhil Goyal <gakhil@marvell.com>
> Send: 2023.5.25 16:27 PM
> To: Akhil Goyal <gakhil@marvell.com>; Sunyang Wu 
> <sunyang.wu@jaguarmicro.com>; dev@dpdk.org
> Cc: kai.ji@intel.com
> Subject: RE: [EXT] [PATCH 1/2] lib/cryptodev/: Add 
> SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK
> 
> Hi Sunyang,
> 
> Can you send the next version for this patch?
> We need to merge in RC1 (31st May).
> 
> 
> > Subject: RE: [EXT] [PATCH 1/2] lib/cryptodev/: Add 
> > SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK
> >
> > > Add SM3_HMAC/SM4_CFB/SM4_OFB support in DPDK.
> > >
> > > Signed-off-by: Sunyang Wu <sunyang.wu@jaguarmicro.com>
> > > ---
> > >  lib/cryptodev/rte_crypto_sym.h | 8 +++++++-
> > >  1 file changed, 7 insertions(+), 1 deletion(-)
> > >
> >
> > Please add release notes and update
> > doc/guides/cryptodevs/features/default.ini.
> >
> > The update to crypto_auth/cipher_algorithm_strings is also missing.
> >
> > > diff --git a/lib/cryptodev/rte_crypto_sym.h 
> > > b/lib/cryptodev/rte_crypto_sym.h index 2cfe66530c..c4572106dc 
> > > 100644
> > > --- a/lib/cryptodev/rte_crypto_sym.h
> > > +++ b/lib/cryptodev/rte_crypto_sym.h
> > > @@ -172,8 +172,12 @@ enum rte_crypto_cipher_algorithm {
> > >  	/**< ShangMi 4 (SM4) algorithm in ECB mode */
> > >  	RTE_CRYPTO_CIPHER_SM4_CBC,
> > >  	/**< ShangMi 4 (SM4) algorithm in CBC mode */
> > > -	RTE_CRYPTO_CIPHER_SM4_CTR
> > > +	RTE_CRYPTO_CIPHER_SM4_CTR,
> > >  	/**< ShangMi 4 (SM4) algorithm in CTR mode */
> > > +	RTE_CRYPTO_CIPHER_SM4_OFB,
> > > +	/**< ShangMi 4 (SM4) algorithm in OFB mode */
> > > +	RTE_CRYPTO_CIPHER_SM4_CFB
> > > +	/**< ShangMi 4 (SM4) algorithm in CFB mode */
> > >  };
> > >
> > >  /** Cipher algorithm name strings */ @@ -376,6 +380,8 @@ enum 
> > > rte_crypto_auth_algorithm {
> > >  	/**< HMAC using 512 bit SHA3 algorithm. */
> > >  	RTE_CRYPTO_AUTH_SM3,
> > >  	/**< ShangMi 3 (SM3) algorithm */
> > > +	RTE_CRYPTO_AUTH_SM3_HMAC,
> > > +	/** < HMAC using Chinese SM3 algorithm */
> > >
> > >  	RTE_CRYPTO_AUTH_SHAKE_128,
> > >  	/**< 128 bit SHAKE algorithm. */
> > > --
> > > 2.19.0.rc0.windows.1
  
Akhil Goyal May 25, 2023, 9:45 a.m. UTC | #9
> Hi Akhil,
> 
> I'm so sorry, I don't quite understand your request.
> Please tell me how to update the crypto_auth/cipher_algorithm_strings.
> 
You need to update the arrays
crypto_auth_algorithm_strings and crypto_cipher_algorithm_strings
 in "lib/cryptodev/rte_cryptodev.c"

Also update the release notes similar to
https://patches.dpdk.org/project/dpdk/patch/40827e1b2765526202e3aaf7716a695842891fc7.1682652719.git.gmuthukrishn@marvell.com/

Also update the title as 
cryptodev: support SM3_HMAC,SM4_CFB and SM4_OFB
  

Patch

diff --git a/lib/cryptodev/rte_crypto_sym.h b/lib/cryptodev/rte_crypto_sym.h
index 2cfe66530c..c4572106dc 100644
--- a/lib/cryptodev/rte_crypto_sym.h
+++ b/lib/cryptodev/rte_crypto_sym.h
@@ -172,8 +172,12 @@  enum rte_crypto_cipher_algorithm {
 	/**< ShangMi 4 (SM4) algorithm in ECB mode */
 	RTE_CRYPTO_CIPHER_SM4_CBC,
 	/**< ShangMi 4 (SM4) algorithm in CBC mode */
-	RTE_CRYPTO_CIPHER_SM4_CTR
+	RTE_CRYPTO_CIPHER_SM4_CTR,
 	/**< ShangMi 4 (SM4) algorithm in CTR mode */
+	RTE_CRYPTO_CIPHER_SM4_OFB,
+	/**< ShangMi 4 (SM4) algorithm in OFB mode */
+	RTE_CRYPTO_CIPHER_SM4_CFB
+	/**< ShangMi 4 (SM4) algorithm in CFB mode */
 };
 
 /** Cipher algorithm name strings */
@@ -376,6 +380,8 @@  enum rte_crypto_auth_algorithm {
 	/**< HMAC using 512 bit SHA3 algorithm. */
 	RTE_CRYPTO_AUTH_SM3,
 	/**< ShangMi 3 (SM3) algorithm */
+	RTE_CRYPTO_AUTH_SM3_HMAC,
+	/** < HMAC using Chinese SM3 algorithm */
 
 	RTE_CRYPTO_AUTH_SHAKE_128,
 	/**< 128 bit SHAKE algorithm. */