keyrings.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] X.509: Support parsing certificate using SM2 algorithm
@ 2021-07-12  8:13 Tianjia Zhang
  2021-09-18  2:25 ` Tianjia Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Tianjia Zhang @ 2021-07-12  8:13 UTC (permalink / raw)
  To: David Howells, Herbert Xu, David S. Miller, Eric Biggers,
	Eric Biggers, Mimi Zohar, Vitaly Chikunov, Gilad Ben-Yossef,
	Pascal van Leeuwen, keyrings, linux-crypto, linux-kernel,
	Jia Zhang, YiLin . Li
  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>
---
 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 6d003096b5bc..6a945a6ce787 100644
--- a/crypto/asymmetric_keys/x509_cert_parser.c
+++ b/crypto/asymmetric_keys/x509_cert_parser.c
@@ -496,6 +496,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.19.1.3.ge56e4f7


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

* Re: [PATCH] X.509: Support parsing certificate using SM2 algorithm
  2021-07-12  8:13 [PATCH] X.509: Support parsing certificate using SM2 algorithm Tianjia Zhang
@ 2021-09-18  2:25 ` Tianjia Zhang
  2021-09-21 21:05   ` Jarkko Sakkinen
  0 siblings, 1 reply; 4+ messages in thread
From: Tianjia Zhang @ 2021-09-18  2:25 UTC (permalink / raw)
  To: David Howells, Herbert Xu, David S. Miller, Eric Biggers,
	Eric Biggers, Mimi Zohar, Vitaly Chikunov, Gilad Ben-Yossef,
	Pascal van Leeuwen, keyrings, linux-crypto, linux-kernel,
	Jia Zhang, YiLin . Li

ping.

On 7/12/21 4:13 PM, 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>
> ---
>   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 6d003096b5bc..6a945a6ce787 100644
> --- a/crypto/asymmetric_keys/x509_cert_parser.c
> +++ b/crypto/asymmetric_keys/x509_cert_parser.c
> @@ -496,6 +496,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;
> 

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

* Re: [PATCH] X.509: Support parsing certificate using SM2 algorithm
  2021-09-18  2:25 ` Tianjia Zhang
@ 2021-09-21 21:05   ` Jarkko Sakkinen
  2022-06-17  9:36     ` 回复:[PATCH] " Tianjia Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2021-09-21 21:05 UTC (permalink / raw)
  To: Tianjia Zhang, David Howells, Herbert Xu, David S. Miller,
	Eric Biggers, Eric Biggers, Mimi Zohar, Vitaly Chikunov,
	Gilad Ben-Yossef, Pascal van Leeuwen, keyrings, linux-crypto,
	linux-kernel, Jia Zhang, YiLin . Li

On Sat, 2021-09-18 at 10:25 +0800, Tianjia Zhang wrote:
> ping.
> 
> On 7/12/21 4:13 PM, 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>
> > ---
> >   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 6d003096b5bc..6a945a6ce787 100644
> > --- a/crypto/asymmetric_keys/x509_cert_parser.c
> > +++ b/crypto/asymmetric_keys/x509_cert_parser.c
> > @@ -496,6 +496,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;
> > 

Acked-by: Jarkko Sakkinen <jarkko@kernel.org>

/Jarkko


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

* 回复:[PATCH] X.509: Support parsing certificate using SM2 algorithm
  2021-09-21 21:05   ` Jarkko Sakkinen
@ 2022-06-17  9:36     ` Tianjia Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Tianjia Zhang @ 2022-06-17  9:36 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: David Howells, Herbert Xu, David S. Miller, Eric Biggers,
	Eric Biggers, Mimi Zohar, Vitaly Chikunov, Gilad Ben-Yossef,
	keyrings, linux-crypto, linux-kernel

Hi Jarkko,

> On 7/12/21 4:13 PM, 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>
> > ---
> >   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 6d003096b5bc..6a945a6ce787 100644
> > --- a/crypto/asymmetric_keys/x509_cert_parser.c
> > +++ b/crypto/asymmetric_keys/x509_cert_parser.c
> > @@ -496,6 +496,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;
> > 
>
> Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
>
> /Jarkko

Likewise, No response from David, can you pick this? thanks.

Best regards,
Tianjia

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

end of thread, other threads:[~2022-06-17  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12  8:13 [PATCH] X.509: Support parsing certificate using SM2 algorithm Tianjia Zhang
2021-09-18  2:25 ` Tianjia Zhang
2021-09-21 21:05   ` Jarkko Sakkinen
2022-06-17  9:36     ` 回复:[PATCH] " Tianjia Zhang

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