netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/tls: add SM4 GCM/CCM to tls selftests
@ 2021-10-08  9:17 Tianjia Zhang
  2021-10-09  0:10 ` patchwork-bot+netdevbpf
  2021-10-15  8:37 ` Hangbin Liu
  0 siblings, 2 replies; 5+ messages in thread
From: Tianjia Zhang @ 2021-10-08  9:17 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski, Shuah Khan, Boris Pismenny,
	John Fastabend, Daniel Borkmann, netdev, linux-kselftest,
	linux-kernel
  Cc: Tianjia Zhang

Add new cipher as a variant of standard tls selftests.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 tools/testing/selftests/net/tls.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
index 97fceb9be9ed..d3047e251fe9 100644
--- a/tools/testing/selftests/net/tls.c
+++ b/tools/testing/selftests/net/tls.c
@@ -29,6 +29,8 @@ struct tls_crypto_info_keys {
 	union {
 		struct tls12_crypto_info_aes_gcm_128 aes128;
 		struct tls12_crypto_info_chacha20_poly1305 chacha20;
+		struct tls12_crypto_info_sm4_gcm sm4gcm;
+		struct tls12_crypto_info_sm4_ccm sm4ccm;
 	};
 	size_t len;
 };
@@ -49,6 +51,16 @@ static void tls_crypto_info_init(uint16_t tls_version, uint16_t cipher_type,
 		tls12->aes128.info.version = tls_version;
 		tls12->aes128.info.cipher_type = cipher_type;
 		break;
+	case TLS_CIPHER_SM4_GCM:
+		tls12->len = sizeof(struct tls12_crypto_info_sm4_gcm);
+		tls12->sm4gcm.info.version = tls_version;
+		tls12->sm4gcm.info.cipher_type = cipher_type;
+		break;
+	case TLS_CIPHER_SM4_CCM:
+		tls12->len = sizeof(struct tls12_crypto_info_sm4_ccm);
+		tls12->sm4ccm.info.version = tls_version;
+		tls12->sm4ccm.info.cipher_type = cipher_type;
+		break;
 	default:
 		break;
 	}
@@ -148,13 +160,13 @@ FIXTURE_VARIANT(tls)
 	uint16_t cipher_type;
 };
 
-FIXTURE_VARIANT_ADD(tls, 12_gcm)
+FIXTURE_VARIANT_ADD(tls, 12_aes_gcm)
 {
 	.tls_version = TLS_1_2_VERSION,
 	.cipher_type = TLS_CIPHER_AES_GCM_128,
 };
 
-FIXTURE_VARIANT_ADD(tls, 13_gcm)
+FIXTURE_VARIANT_ADD(tls, 13_aes_gcm)
 {
 	.tls_version = TLS_1_3_VERSION,
 	.cipher_type = TLS_CIPHER_AES_GCM_128,
@@ -172,6 +184,18 @@ FIXTURE_VARIANT_ADD(tls, 13_chacha)
 	.cipher_type = TLS_CIPHER_CHACHA20_POLY1305,
 };
 
+FIXTURE_VARIANT_ADD(tls, 13_sm4_gcm)
+{
+	.tls_version = TLS_1_3_VERSION,
+	.cipher_type = TLS_CIPHER_SM4_GCM,
+};
+
+FIXTURE_VARIANT_ADD(tls, 13_sm4_ccm)
+{
+	.tls_version = TLS_1_3_VERSION,
+	.cipher_type = TLS_CIPHER_SM4_CCM,
+};
+
 FIXTURE_SETUP(tls)
 {
 	struct tls_crypto_info_keys tls12;
-- 
2.19.1.3.ge56e4f7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests/tls: add SM4 GCM/CCM to tls selftests
  2021-10-08  9:17 [PATCH] selftests/tls: add SM4 GCM/CCM to tls selftests Tianjia Zhang
@ 2021-10-09  0:10 ` patchwork-bot+netdevbpf
  2021-10-15  8:37 ` Hangbin Liu
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-10-09  0:10 UTC (permalink / raw)
  To: Tianjia Zhang
  Cc: davem, kuba, shuah, borisp, john.fastabend, daniel, netdev,
	linux-kselftest, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Fri,  8 Oct 2021 17:17:45 +0800 you wrote:
> Add new cipher as a variant of standard tls selftests.
> 
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>  tools/testing/selftests/net/tls.c | 28 ++++++++++++++++++++++++++--
>  1 file changed, 26 insertions(+), 2 deletions(-)

Here is the summary with links:
  - selftests/tls: add SM4 GCM/CCM to tls selftests
    https://git.kernel.org/netdev/net-next/c/e506342a03c7

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests/tls: add SM4 GCM/CCM to tls selftests
  2021-10-08  9:17 [PATCH] selftests/tls: add SM4 GCM/CCM to tls selftests Tianjia Zhang
  2021-10-09  0:10 ` patchwork-bot+netdevbpf
@ 2021-10-15  8:37 ` Hangbin Liu
  2021-10-15  9:59   ` Tianjia Zhang
  1 sibling, 1 reply; 5+ messages in thread
From: Hangbin Liu @ 2021-10-15  8:37 UTC (permalink / raw)
  To: Tianjia Zhang
  Cc: David S. Miller, Jakub Kicinski, Shuah Khan, Boris Pismenny,
	John Fastabend, Daniel Borkmann, netdev, linux-kselftest,
	linux-kernel

Hi Tianjia,

The new added tls selftest failed with latest net-next in RedHat CKI
test env. Would you like to help check if we missed anything?

Here is the pipeline page
https://datawarehouse.cki-project.org/kcidb/builds/67720
Config URL:
http://s3.amazonaws.com/arr-cki-prod-datawarehouse-public/datawarehouse-public/2021/10/14/388570846/redhat:388570846/redhat:388570846_x86_64_debug/.config
Build Log URL:
http://s3.amazonaws.com/arr-cki-prod-datawarehouse-public/datawarehouse-public/2021/10/14/388570846/redhat:388570846/redhat:388570846_x86_64_debug/build.log
TLS test log:
https://s3.us-east-1.amazonaws.com/arr-cki-prod-datawarehouse-public/datawarehouse-public/2021/10/14/redhat:388570846/build_x86_64_redhat:388570846_x86_64_debug/tests/1/results_0001/job.01/recipes/10799149/tasks/19/results/1634231959/logs/resultoutputfile.log
Command: make -j24 INSTALL_MOD_STRIP=1 targz-pkg
Architecture: x86_64

Please tell me if you need any other info.

Thanks
Hangbin

On Fri, Oct 08, 2021 at 05:17:45PM +0800, Tianjia Zhang wrote:
> Add new cipher as a variant of standard tls selftests.
> 
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>  tools/testing/selftests/net/tls.c | 28 ++++++++++++++++++++++++++--
>  1 file changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c
> index 97fceb9be9ed..d3047e251fe9 100644
> --- a/tools/testing/selftests/net/tls.c
> +++ b/tools/testing/selftests/net/tls.c
> @@ -29,6 +29,8 @@ struct tls_crypto_info_keys {
>  	union {
>  		struct tls12_crypto_info_aes_gcm_128 aes128;
>  		struct tls12_crypto_info_chacha20_poly1305 chacha20;
> +		struct tls12_crypto_info_sm4_gcm sm4gcm;
> +		struct tls12_crypto_info_sm4_ccm sm4ccm;
>  	};
>  	size_t len;
>  };
> @@ -49,6 +51,16 @@ static void tls_crypto_info_init(uint16_t tls_version, uint16_t cipher_type,
>  		tls12->aes128.info.version = tls_version;
>  		tls12->aes128.info.cipher_type = cipher_type;
>  		break;
> +	case TLS_CIPHER_SM4_GCM:
> +		tls12->len = sizeof(struct tls12_crypto_info_sm4_gcm);
> +		tls12->sm4gcm.info.version = tls_version;
> +		tls12->sm4gcm.info.cipher_type = cipher_type;
> +		break;
> +	case TLS_CIPHER_SM4_CCM:
> +		tls12->len = sizeof(struct tls12_crypto_info_sm4_ccm);
> +		tls12->sm4ccm.info.version = tls_version;
> +		tls12->sm4ccm.info.cipher_type = cipher_type;
> +		break;
>  	default:
>  		break;
>  	}
> @@ -148,13 +160,13 @@ FIXTURE_VARIANT(tls)
>  	uint16_t cipher_type;
>  };
>  
> -FIXTURE_VARIANT_ADD(tls, 12_gcm)
> +FIXTURE_VARIANT_ADD(tls, 12_aes_gcm)
>  {
>  	.tls_version = TLS_1_2_VERSION,
>  	.cipher_type = TLS_CIPHER_AES_GCM_128,
>  };
>  
> -FIXTURE_VARIANT_ADD(tls, 13_gcm)
> +FIXTURE_VARIANT_ADD(tls, 13_aes_gcm)
>  {
>  	.tls_version = TLS_1_3_VERSION,
>  	.cipher_type = TLS_CIPHER_AES_GCM_128,
> @@ -172,6 +184,18 @@ FIXTURE_VARIANT_ADD(tls, 13_chacha)
>  	.cipher_type = TLS_CIPHER_CHACHA20_POLY1305,
>  };
>  
> +FIXTURE_VARIANT_ADD(tls, 13_sm4_gcm)
> +{
> +	.tls_version = TLS_1_3_VERSION,
> +	.cipher_type = TLS_CIPHER_SM4_GCM,
> +};
> +
> +FIXTURE_VARIANT_ADD(tls, 13_sm4_ccm)
> +{
> +	.tls_version = TLS_1_3_VERSION,
> +	.cipher_type = TLS_CIPHER_SM4_CCM,
> +};
> +
>  FIXTURE_SETUP(tls)
>  {
>  	struct tls_crypto_info_keys tls12;
> -- 
> 2.19.1.3.ge56e4f7
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests/tls: add SM4 GCM/CCM to tls selftests
  2021-10-15  8:37 ` Hangbin Liu
@ 2021-10-15  9:59   ` Tianjia Zhang
  2021-10-18  3:29     ` Hangbin Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Tianjia Zhang @ 2021-10-15  9:59 UTC (permalink / raw)
  To: Hangbin Liu
  Cc: David S. Miller, Jakub Kicinski, Shuah Khan, Boris Pismenny,
	John Fastabend, Daniel Borkmann, netdev, linux-kselftest,
	linux-kernel

Hi Hangbin,

On 10/15/21 4:37 PM, Hangbin Liu wrote:
> Hi Tianjia,
> 
> The new added tls selftest failed with latest net-next in RedHat CKI
> test env. Would you like to help check if we missed anything?
> 
> Here is the pipeline page
> https://datawarehouse.cki-project.org/kcidb/builds/67720
> Config URL:
> http://s3.amazonaws.com/arr-cki-prod-datawarehouse-public/datawarehouse-public/2021/10/14/388570846/redhat:388570846/redhat:388570846_x86_64_debug/.config
> Build Log URL:
> http://s3.amazonaws.com/arr-cki-prod-datawarehouse-public/datawarehouse-public/2021/10/14/388570846/redhat:388570846/redhat:388570846_x86_64_debug/build.log
> TLS test log:
> https://s3.us-east-1.amazonaws.com/arr-cki-prod-datawarehouse-public/datawarehouse-public/2021/10/14/redhat:388570846/build_x86_64_redhat:388570846_x86_64_debug/tests/1/results_0001/job.01/recipes/10799149/tasks/19/results/1634231959/logs/resultoutputfile.log
> Command: make -j24 INSTALL_MOD_STRIP=1 targz-pkg
> Architecture: x86_64
> 
> Please tell me if you need any other info.
> 
> Thanks
> Hangbin
> 

This patch needs to enable the SM4 algorithm, and the config file you 
provided does not enable this algorithm.

Best regards,
Tianjia

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests/tls: add SM4 GCM/CCM to tls selftests
  2021-10-15  9:59   ` Tianjia Zhang
@ 2021-10-18  3:29     ` Hangbin Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Hangbin Liu @ 2021-10-18  3:29 UTC (permalink / raw)
  To: Tianjia Zhang
  Cc: David S. Miller, Jakub Kicinski, Shuah Khan, Boris Pismenny,
	John Fastabend, Daniel Borkmann, netdev, linux-kselftest,
	linux-kernel

On Fri, Oct 15, 2021 at 05:59:29PM +0800, Tianjia Zhang wrote:
> This patch needs to enable the SM4 algorithm, and the config file you
> provided does not enable this algorithm.
> 
Thanks Tianjia, I will ask CKI team if it's easy to enable the new config.

Cheers
Hangbin

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-10-18  3:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-08  9:17 [PATCH] selftests/tls: add SM4 GCM/CCM to tls selftests Tianjia Zhang
2021-10-09  0:10 ` patchwork-bot+netdevbpf
2021-10-15  8:37 ` Hangbin Liu
2021-10-15  9:59   ` Tianjia Zhang
2021-10-18  3:29     ` Hangbin Liu

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).