linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pkcs7: support EC-RDSA/streebog in SignerInfo
@ 2021-05-11 14:47 Elvira Khabirova
  2021-05-12 14:23 ` Vitaly Chikunov
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Elvira Khabirova @ 2021-05-11 14:47 UTC (permalink / raw)
  To: keyrings; +Cc: linux-kernel, linux-crypto, davem, herbert, dhowells, vt

Allow using EC-RDSA/streebog in pkcs7 certificates in a similar way
to how it's done in the x509 parser.

This is needed e.g. for loading kernel modules signed with EC-RDSA.

Signed-off-by: Elvira Khabirova <e.khabirova@omp.ru>
---
 crypto/asymmetric_keys/pkcs7_parser.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
index 967329e0a07b..39c260a04167 100644
--- a/crypto/asymmetric_keys/pkcs7_parser.c
+++ b/crypto/asymmetric_keys/pkcs7_parser.c
@@ -248,6 +248,12 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
 	case OID_sha224:
 		ctx->sinfo->sig->hash_algo = "sha224";
 		break;
+	case OID_gost2012Digest256:
+		ctx->sinfo->sig->hash_algo = "streebog256";
+		break;
+	case OID_gost2012Digest512:
+		ctx->sinfo->sig->hash_algo = "streebog512";
+		break;
 	default:
 		printk("Unsupported digest algo: %u\n", ctx->last_oid);
 		return -ENOPKG;
@@ -269,6 +275,11 @@ 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_gost2012PKey256:
+	case OID_gost2012PKey512:
+		ctx->sinfo->sig->pkey_algo = "ecrdsa";
+		ctx->sinfo->sig->encoding = "raw";
+		break;
 	default:
 		printk("Unsupported pkey algo: %u\n", ctx->last_oid);
 		return -ENOPKG;
-- 
2.25.1


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

* Re: [PATCH] pkcs7: support EC-RDSA/streebog in SignerInfo
  2021-05-11 14:47 [PATCH] pkcs7: support EC-RDSA/streebog in SignerInfo Elvira Khabirova
@ 2021-05-12 14:23 ` Vitaly Chikunov
  2021-07-03  2:07 ` Tianjia Zhang
  2021-09-18  2:39 ` Tianjia Zhang
  2 siblings, 0 replies; 5+ messages in thread
From: Vitaly Chikunov @ 2021-05-12 14:23 UTC (permalink / raw)
  To: Elvira Khabirova
  Cc: keyrings, linux-kernel, linux-crypto, davem, herbert, dhowells

On Tue, May 11, 2021 at 05:47:44PM +0300, Elvira Khabirova wrote:
> Allow using EC-RDSA/streebog in pkcs7 certificates in a similar way
> to how it's done in the x509 parser.
> 
> This is needed e.g. for loading kernel modules signed with EC-RDSA.
> 
> Signed-off-by: Elvira Khabirova <e.khabirova@omp.ru>

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

Thanks,

> ---
>  crypto/asymmetric_keys/pkcs7_parser.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
> index 967329e0a07b..39c260a04167 100644
> --- a/crypto/asymmetric_keys/pkcs7_parser.c
> +++ b/crypto/asymmetric_keys/pkcs7_parser.c
> @@ -248,6 +248,12 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
>  	case OID_sha224:
>  		ctx->sinfo->sig->hash_algo = "sha224";
>  		break;
> +	case OID_gost2012Digest256:
> +		ctx->sinfo->sig->hash_algo = "streebog256";
> +		break;
> +	case OID_gost2012Digest512:
> +		ctx->sinfo->sig->hash_algo = "streebog512";
> +		break;
>  	default:
>  		printk("Unsupported digest algo: %u\n", ctx->last_oid);
>  		return -ENOPKG;
> @@ -269,6 +275,11 @@ 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_gost2012PKey256:
> +	case OID_gost2012PKey512:
> +		ctx->sinfo->sig->pkey_algo = "ecrdsa";
> +		ctx->sinfo->sig->encoding = "raw";
> +		break;
>  	default:
>  		printk("Unsupported pkey algo: %u\n", ctx->last_oid);
>  		return -ENOPKG;
> -- 
> 2.25.1

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

* Re: [PATCH] pkcs7: support EC-RDSA/streebog in SignerInfo
  2021-05-11 14:47 [PATCH] pkcs7: support EC-RDSA/streebog in SignerInfo Elvira Khabirova
  2021-05-12 14:23 ` Vitaly Chikunov
@ 2021-07-03  2:07 ` Tianjia Zhang
  2021-09-18  2:39 ` Tianjia Zhang
  2 siblings, 0 replies; 5+ messages in thread
From: Tianjia Zhang @ 2021-07-03  2:07 UTC (permalink / raw)
  To: Elvira Khabirova, keyrings, Vitaly Chikunov
  Cc: linux-kernel, linux-crypto, davem, herbert, dhowells, vt

Hi Elvira,

On 5/11/21 10:47 PM, Elvira Khabirova wrote:
> Allow using EC-RDSA/streebog in pkcs7 certificates in a similar way
> to how it's done in the x509 parser.
> 
> This is needed e.g. for loading kernel modules signed with EC-RDSA.
> 
> Signed-off-by: Elvira Khabirova <e.khabirova@omp.ru>

Reviewed-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>

I sent a similar patch to support the SM2/3 algorithm combination, which 
happened to conflict with your patch.

https://lkml.org/lkml/2021/6/24/248

If possible and you agree, I will put these two patches in a series and 
then resend.

Cheers,
Tianjia

> ---
>   crypto/asymmetric_keys/pkcs7_parser.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
> index 967329e0a07b..39c260a04167 100644
> --- a/crypto/asymmetric_keys/pkcs7_parser.c
> +++ b/crypto/asymmetric_keys/pkcs7_parser.c
> @@ -248,6 +248,12 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
>   	case OID_sha224:
>   		ctx->sinfo->sig->hash_algo = "sha224";
>   		break;
> +	case OID_gost2012Digest256:
> +		ctx->sinfo->sig->hash_algo = "streebog256";
> +		break;
> +	case OID_gost2012Digest512:
> +		ctx->sinfo->sig->hash_algo = "streebog512";
> +		break;
>   	default:
>   		printk("Unsupported digest algo: %u\n", ctx->last_oid);
>   		return -ENOPKG;
> @@ -269,6 +275,11 @@ 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_gost2012PKey256:
> +	case OID_gost2012PKey512:
> +		ctx->sinfo->sig->pkey_algo = "ecrdsa";
> +		ctx->sinfo->sig->encoding = "raw";
> +		break;
>   	default:
>   		printk("Unsupported pkey algo: %u\n", ctx->last_oid);
>   		return -ENOPKG;
> 

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

* Re: [PATCH] pkcs7: support EC-RDSA/streebog in SignerInfo
  2021-05-11 14:47 [PATCH] pkcs7: support EC-RDSA/streebog in SignerInfo Elvira Khabirova
  2021-05-12 14:23 ` Vitaly Chikunov
  2021-07-03  2:07 ` Tianjia Zhang
@ 2021-09-18  2:39 ` Tianjia Zhang
  2021-09-21 21:07   ` Jarkko Sakkinen
  2 siblings, 1 reply; 5+ messages in thread
From: Tianjia Zhang @ 2021-09-18  2:39 UTC (permalink / raw)
  To: Elvira Khabirova, keyrings
  Cc: linux-kernel, linux-crypto, davem, herbert, dhowells, vt

ping.

On 5/11/21 10:47 PM, Elvira Khabirova wrote:
> Allow using EC-RDSA/streebog in pkcs7 certificates in a similar way
> to how it's done in the x509 parser.
> 
> This is needed e.g. for loading kernel modules signed with EC-RDSA.
> 
> Signed-off-by: Elvira Khabirova <e.khabirova@omp.ru>
> ---
>   crypto/asymmetric_keys/pkcs7_parser.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
> index 967329e0a07b..39c260a04167 100644
> --- a/crypto/asymmetric_keys/pkcs7_parser.c
> +++ b/crypto/asymmetric_keys/pkcs7_parser.c
> @@ -248,6 +248,12 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
>   	case OID_sha224:
>   		ctx->sinfo->sig->hash_algo = "sha224";
>   		break;
> +	case OID_gost2012Digest256:
> +		ctx->sinfo->sig->hash_algo = "streebog256";
> +		break;
> +	case OID_gost2012Digest512:
> +		ctx->sinfo->sig->hash_algo = "streebog512";
> +		break;
>   	default:
>   		printk("Unsupported digest algo: %u\n", ctx->last_oid);
>   		return -ENOPKG;
> @@ -269,6 +275,11 @@ 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_gost2012PKey256:
> +	case OID_gost2012PKey512:
> +		ctx->sinfo->sig->pkey_algo = "ecrdsa";
> +		ctx->sinfo->sig->encoding = "raw";
> +		break;
>   	default:
>   		printk("Unsupported pkey algo: %u\n", ctx->last_oid);
>   		return -ENOPKG;
> 

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

* Re: [PATCH] pkcs7: support EC-RDSA/streebog in SignerInfo
  2021-09-18  2:39 ` Tianjia Zhang
@ 2021-09-21 21:07   ` Jarkko Sakkinen
  0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2021-09-21 21:07 UTC (permalink / raw)
  To: Tianjia Zhang, Elvira Khabirova, keyrings
  Cc: linux-kernel, linux-crypto, davem, herbert, dhowells, vt

On Sat, 2021-09-18 at 10:39 +0800, Tianjia Zhang wrote:
> ping.
> 
> On 5/11/21 10:47 PM, Elvira Khabirova wrote:
> > Allow using EC-RDSA/streebog in pkcs7 certificates in a similar way
> > to how it's done in the x509 parser.
> > 
> > This is needed e.g. for loading kernel modules signed with EC-RDSA.
> > 
> > Signed-off-by: Elvira Khabirova <e.khabirova@omp.ru>
> > ---
> >   crypto/asymmetric_keys/pkcs7_parser.c | 11 +++++++++++
> >   1 file changed, 11 insertions(+)
> > 
> > diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
> > index 967329e0a07b..39c260a04167 100644
> > --- a/crypto/asymmetric_keys/pkcs7_parser.c
> > +++ b/crypto/asymmetric_keys/pkcs7_parser.c
> > @@ -248,6 +248,12 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
> >   	case OID_sha224:
> >   		ctx->sinfo->sig->hash_algo = "sha224";
> >   		break;
> > +	case OID_gost2012Digest256:
> > +		ctx->sinfo->sig->hash_algo = "streebog256";
> > +		break;
> > +	case OID_gost2012Digest512:
> > +		ctx->sinfo->sig->hash_algo = "streebog512";
> > +		break;
> >   	default:
> >   		printk("Unsupported digest algo: %u\n", ctx->last_oid);
> >   		return -ENOPKG;
> > @@ -269,6 +275,11 @@ 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_gost2012PKey256:
> > +	case OID_gost2012PKey512:
> > +		ctx->sinfo->sig->pkey_algo = "ecrdsa";
> > +		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] 5+ messages in thread

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 14:47 [PATCH] pkcs7: support EC-RDSA/streebog in SignerInfo Elvira Khabirova
2021-05-12 14:23 ` Vitaly Chikunov
2021-07-03  2:07 ` Tianjia Zhang
2021-09-18  2:39 ` Tianjia Zhang
2021-09-21 21:07   ` 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).