public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] X.509: Support parsing certificate using SM2 algorithm
@ 2022-06-27  9:19 Tianjia Zhang
  2022-06-27 23:10 ` Jarkko Sakkinen
  0 siblings, 1 reply; 2+ messages in thread
From: Tianjia Zhang @ 2022-06-27  9:19 UTC (permalink / raw)
  To: Jarkko Sakkinen, David Howells, Herbert Xu, keyrings,
	linux-crypto, linux-kernel
  Cc: Tianjia Zhang

The SM2-with-SM3 certificate generated by latest openssl no longer
reuses the OID_id_ecPublicKey, but directly uses OID_sm2. This patch
supports this type of x509 certificate parsing.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
---
 crypto/asymmetric_keys/x509_cert_parser.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
index 2899ed80bb18..7a9b084e2043 100644
--- a/crypto/asymmetric_keys/x509_cert_parser.c
+++ b/crypto/asymmetric_keys/x509_cert_parser.c
@@ -508,6 +508,9 @@ int x509_extract_key_data(void *context, size_t hdrlen,
 	case OID_gost2012PKey512:
 		ctx->cert->pub->pkey_algo = "ecrdsa";
 		break;
+	case OID_sm2:
+		ctx->cert->pub->pkey_algo = "sm2";
+		break;
 	case OID_id_ecPublicKey:
 		if (parse_OID(ctx->params, ctx->params_size, &oid) != 0)
 			return -EBADMSG;
-- 
2.24.3 (Apple Git-128)


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

* Re: [PATCH v2] X.509: Support parsing certificate using SM2 algorithm
  2022-06-27  9:19 [PATCH v2] X.509: Support parsing certificate using SM2 algorithm Tianjia Zhang
@ 2022-06-27 23:10 ` Jarkko Sakkinen
  0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2022-06-27 23:10 UTC (permalink / raw)
  To: Tianjia Zhang
  Cc: David Howells, Herbert Xu, keyrings, linux-crypto, linux-kernel

On Mon, Jun 27, 2022 at 05:19:58PM +0800, Tianjia Zhang wrote:
> The SM2-with-SM3 certificate generated by latest openssl no longer
> reuses the OID_id_ecPublicKey, but directly uses OID_sm2. This patch
> supports this type of x509 certificate parsing.
> 
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
> ---
>  crypto/asymmetric_keys/x509_cert_parser.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
> index 2899ed80bb18..7a9b084e2043 100644
> --- a/crypto/asymmetric_keys/x509_cert_parser.c
> +++ b/crypto/asymmetric_keys/x509_cert_parser.c
> @@ -508,6 +508,9 @@ int x509_extract_key_data(void *context, size_t hdrlen,
>  	case OID_gost2012PKey512:
>  		ctx->cert->pub->pkey_algo = "ecrdsa";
>  		break;
> +	case OID_sm2:
> +		ctx->cert->pub->pkey_algo = "sm2";
> +		break;
>  	case OID_id_ecPublicKey:
>  		if (parse_OID(ctx->params, ctx->params_size, &oid) != 0)
>  			return -EBADMSG;
> -- 
> 2.24.3 (Apple Git-128)
> 

Thanks, I can pick this.

BR, Jarkko

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

end of thread, other threads:[~2022-06-27 23:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-27  9:19 [PATCH v2] X.509: Support parsing certificate using SM2 algorithm Tianjia Zhang
2022-06-27 23:10 ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox