linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination
@ 2021-06-24  9:47 Tianjia Zhang
  2021-07-02 14:39 ` Vitaly Chikunov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tianjia Zhang @ 2021-06-24  9:47 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
  Cc: Tianjia Zhang

Support parsing the message signature of the SM2 and SM3 algorithm
combination. This group of algorithms has been well supported. One
of the main users is module signature verification.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 crypto/asymmetric_keys/pkcs7_parser.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
index 967329e0a07b..6cf6c4552c11 100644
--- a/crypto/asymmetric_keys/pkcs7_parser.c
+++ b/crypto/asymmetric_keys/pkcs7_parser.c
@@ -248,6 +248,9 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
 	case OID_sha224:
 		ctx->sinfo->sig->hash_algo = "sha224";
 		break;
+	case OID_sm3:
+		ctx->sinfo->sig->hash_algo = "sm3";
+		break;
 	default:
 		printk("Unsupported digest algo: %u\n", ctx->last_oid);
 		return -ENOPKG;
@@ -269,6 +272,10 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen,
 		ctx->sinfo->sig->pkey_algo = "rsa";
 		ctx->sinfo->sig->encoding = "pkcs1";
 		break;
+	case OID_SM2_with_SM3:
+		ctx->sinfo->sig->pkey_algo = "sm2";
+		ctx->sinfo->sig->encoding = "raw";
+		break;
 	default:
 		printk("Unsupported pkey algo: %u\n", ctx->last_oid);
 		return -ENOPKG;
-- 
2.19.1.3.ge56e4f7


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

* Re: [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination
  2021-06-24  9:47 [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination Tianjia Zhang
@ 2021-07-02 14:39 ` Vitaly Chikunov
  2021-07-03  1:37   ` Tianjia Zhang
  2021-07-08 22:30 ` Stefan Berger
  2021-09-18  2:25 ` Tianjia Zhang
  2 siblings, 1 reply; 6+ messages in thread
From: Vitaly Chikunov @ 2021-07-02 14:39 UTC (permalink / raw)
  To: Tianjia Zhang
  Cc: David Howells, Herbert Xu, David S. Miller, Eric Biggers,
	linux-crypto, Jia Zhang, Elvira Khabirova

On Thu, Jun 24, 2021 at 05:47:05PM +0800, Tianjia Zhang wrote:
> Support parsing the message signature of the SM2 and SM3 algorithm
> combination. This group of algorithms has been well supported. One
> of the main users is module signature verification.
> 
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>

This will conflict with the patch of Elvira Khabirova adding the same
for streebog/ecrdsa. Otherwise,

Reviewed-by: Vitaly Chikunov <vt@altlinux.org>

Thanks,

> ---
>  crypto/asymmetric_keys/pkcs7_parser.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
> index 967329e0a07b..6cf6c4552c11 100644
> --- a/crypto/asymmetric_keys/pkcs7_parser.c
> +++ b/crypto/asymmetric_keys/pkcs7_parser.c
> @@ -248,6 +248,9 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
>  	case OID_sha224:
>  		ctx->sinfo->sig->hash_algo = "sha224";
>  		break;
> +	case OID_sm3:
> +		ctx->sinfo->sig->hash_algo = "sm3";
> +		break;
>  	default:
>  		printk("Unsupported digest algo: %u\n", ctx->last_oid);
>  		return -ENOPKG;
> @@ -269,6 +272,10 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen,
>  		ctx->sinfo->sig->pkey_algo = "rsa";
>  		ctx->sinfo->sig->encoding = "pkcs1";
>  		break;
> +	case OID_SM2_with_SM3:
> +		ctx->sinfo->sig->pkey_algo = "sm2";
> +		ctx->sinfo->sig->encoding = "raw";
> +		break;
>  	default:
>  		printk("Unsupported pkey algo: %u\n", ctx->last_oid);
>  		return -ENOPKG;
> -- 
> 2.19.1.3.ge56e4f7

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

* Re: [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination
  2021-07-02 14:39 ` Vitaly Chikunov
@ 2021-07-03  1:37   ` Tianjia Zhang
  0 siblings, 0 replies; 6+ messages in thread
From: Tianjia Zhang @ 2021-07-03  1:37 UTC (permalink / raw)
  To: Vitaly Chikunov
  Cc: David Howells, Herbert Xu, David S. Miller, Eric Biggers,
	linux-crypto, Jia Zhang, Elvira Khabirova



On 7/2/21 10:39 PM, Vitaly Chikunov wrote:
> On Thu, Jun 24, 2021 at 05:47:05PM +0800, Tianjia Zhang wrote:
>> Support parsing the message signature of the SM2 and SM3 algorithm
>> combination. This group of algorithms has been well supported. One
>> of the main users is module signature verification.
>>
>> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> 
> This will conflict with the patch of Elvira Khabirova adding the same
> for streebog/ecrdsa. Otherwise,
> 
> Reviewed-by: Vitaly Chikunov <vt@altlinux.org>
> 
> Thanks,
> 

Thanks, I just saw it, I will contact Elvira Khabirova to consider 
whether it can be combined into a series of patches, and then resend.

Cheers,
Tianjia

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

* Re: [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination
  2021-06-24  9:47 [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination Tianjia Zhang
  2021-07-02 14:39 ` Vitaly Chikunov
@ 2021-07-08 22:30 ` Stefan Berger
  2021-09-18  2:25 ` Tianjia Zhang
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Berger @ 2021-07-08 22:30 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


On 6/24/21 5:47 AM, Tianjia Zhang wrote:
> Support parsing the message signature of the SM2 and SM3 algorithm
> combination. This group of algorithms has been well supported. One
> of the main users is module signature verification.
>
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>   crypto/asymmetric_keys/pkcs7_parser.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
> index 967329e0a07b..6cf6c4552c11 100644
> --- a/crypto/asymmetric_keys/pkcs7_parser.c
> +++ b/crypto/asymmetric_keys/pkcs7_parser.c
> @@ -248,6 +248,9 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
>   	case OID_sha224:
>   		ctx->sinfo->sig->hash_algo = "sha224";
>   		break;
> +	case OID_sm3:
> +		ctx->sinfo->sig->hash_algo = "sm3";
> +		break;
>   	default:
>   		printk("Unsupported digest algo: %u\n", ctx->last_oid);
>   		return -ENOPKG;
> @@ -269,6 +272,10 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen,
>   		ctx->sinfo->sig->pkey_algo = "rsa";
>   		ctx->sinfo->sig->encoding = "pkcs1";
>   		break;
> +	case OID_SM2_with_SM3:
> +		ctx->sinfo->sig->pkey_algo = "sm2";
> +		ctx->sinfo->sig->encoding = "raw";
> +		break;
>   	default:
>   		printk("Unsupported pkey algo: %u\n", ctx->last_oid);
>   		return -ENOPKG;


Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>



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

* Re: [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination
  2021-06-24  9:47 [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination Tianjia Zhang
  2021-07-02 14:39 ` Vitaly Chikunov
  2021-07-08 22:30 ` Stefan Berger
@ 2021-09-18  2:25 ` Tianjia Zhang
  2021-09-21 21:06   ` Jarkko Sakkinen
  2 siblings, 1 reply; 6+ 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

ping.

On 6/24/21 5:47 PM, Tianjia Zhang wrote:
> Support parsing the message signature of the SM2 and SM3 algorithm
> combination. This group of algorithms has been well supported. One
> of the main users is module signature verification.
> 
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>   crypto/asymmetric_keys/pkcs7_parser.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
> index 967329e0a07b..6cf6c4552c11 100644
> --- a/crypto/asymmetric_keys/pkcs7_parser.c
> +++ b/crypto/asymmetric_keys/pkcs7_parser.c
> @@ -248,6 +248,9 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
>   	case OID_sha224:
>   		ctx->sinfo->sig->hash_algo = "sha224";
>   		break;
> +	case OID_sm3:
> +		ctx->sinfo->sig->hash_algo = "sm3";
> +		break;
>   	default:
>   		printk("Unsupported digest algo: %u\n", ctx->last_oid);
>   		return -ENOPKG;
> @@ -269,6 +272,10 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen,
>   		ctx->sinfo->sig->pkey_algo = "rsa";
>   		ctx->sinfo->sig->encoding = "pkcs1";
>   		break;
> +	case OID_SM2_with_SM3:
> +		ctx->sinfo->sig->pkey_algo = "sm2";
> +		ctx->sinfo->sig->encoding = "raw";
> +		break;
>   	default:
>   		printk("Unsupported pkey algo: %u\n", ctx->last_oid);
>   		return -ENOPKG;
> 

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

* Re: [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination
  2021-09-18  2:25 ` Tianjia Zhang
@ 2021-09-21 21:06   ` Jarkko Sakkinen
  0 siblings, 0 replies; 6+ messages in thread
From: Jarkko Sakkinen @ 2021-09-21 21:06 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

On Sat, 2021-09-18 at 10:25 +0800, Tianjia Zhang wrote:
> ping.
> 
> On 6/24/21 5:47 PM, Tianjia Zhang wrote:
> > Support parsing the message signature of the SM2 and SM3 algorithm
> > combination. This group of algorithms has been well supported. One
> > of the main users is module signature verification.
> > 
> > Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> > ---
> >   crypto/asymmetric_keys/pkcs7_parser.c | 7 +++++++
> >   1 file changed, 7 insertions(+)
> > 
> > diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
> > index 967329e0a07b..6cf6c4552c11 100644
> > --- a/crypto/asymmetric_keys/pkcs7_parser.c
> > +++ b/crypto/asymmetric_keys/pkcs7_parser.c
> > @@ -248,6 +248,9 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
> >   	case OID_sha224:
> >   		ctx->sinfo->sig->hash_algo = "sha224";
> >   		break;
> > +	case OID_sm3:
> > +		ctx->sinfo->sig->hash_algo = "sm3";
> > +		break;
> >   	default:
> >   		printk("Unsupported digest algo: %u\n", ctx->last_oid);
> >   		return -ENOPKG;
> > @@ -269,6 +272,10 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen,
> >   		ctx->sinfo->sig->pkey_algo = "rsa";
> >   		ctx->sinfo->sig->encoding = "pkcs1";
> >   		break;
> > +	case OID_SM2_with_SM3:
> > +		ctx->sinfo->sig->pkey_algo = "sm2";
> > +		ctx->sinfo->sig->encoding = "raw";
> > +		break;
> >   	default:
> >   		printk("Unsupported pkey algo: %u\n", ctx->last_oid);
> >   		return -ENOPKG;
> > 

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

/Jarkko


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

end of thread, other threads:[~2021-09-21 21:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  9:47 [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination Tianjia Zhang
2021-07-02 14:39 ` Vitaly Chikunov
2021-07-03  1:37   ` Tianjia Zhang
2021-07-08 22:30 ` Stefan Berger
2021-09-18  2:25 ` Tianjia Zhang
2021-09-21 21:06   ` Jarkko Sakkinen

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