]> git.baikalelectronics.ru Git - kernel.git/commitdiff
pkcs7: support EC-RDSA/streebog in SignerInfo
authorElvira Khabirova <e.khabirova@omp.ru>
Mon, 27 Jun 2022 09:21:42 +0000 (17:21 +0800)
committerJarkko Sakkinen <jarkko@kernel.org>
Wed, 3 Aug 2022 20:56:20 +0000 (23:56 +0300)
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>
Reviewed-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
crypto/asymmetric_keys/pkcs7_parser.c

index 24e2e4a6d84284d36f64a6e442c7a4b84ab3964b..277482bb17777148935430aac9391406934b9a24 100644 (file)
@@ -251,6 +251,12 @@ int pkcs7_sig_note_digest_algo(void *context, size_t hdrlen,
        case OID_sm3:
                ctx->sinfo->sig->hash_algo = "sm3";
                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;
@@ -284,6 +290,11 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen,
                ctx->sinfo->sig->pkey_algo = "sm2";
                ctx->sinfo->sig->encoding = "raw";
                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;