Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp429749pxb; Sat, 18 Sep 2021 06:58:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynbWQJ/z4mcEoptcfCvkmu93UrCvjcCREQ1VSsMxaZi6xEQGYwZ/JirlqMx6fE79V3RxM/ X-Received: by 2002:a17:906:b18e:: with SMTP id w14mr19151782ejy.63.1631973526706; Sat, 18 Sep 2021 06:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631973526; cv=none; d=google.com; s=arc-20160816; b=IgUhNoJ5cjs+gjnbGeQ0K95mpb+maUFE+oIiDq9D4HPFXY0Yv38vzm4LClcoFmtvgt hFohdjAt4YE98jQ73wGJDoDfRd/5WeMa2Ay6yyCEBqQpaP/Evc0ORSWedFFs5CjvorM0 uTQ3dBoXGxuS3m2+d3kAKXSVUXlq9WYNxU1UVf6g2etvLYWTHkbzkROLLPd7+o7atSCa TMSd8j7ORKEgiSf/iW4Qbx50/VqW+9UQpqo/M/l9I4A8POHMaBkXiNIdLTjgIGRrLUQ6 H2lOOfn5KtasDLdMdMEO8MsTi883MHbNp0Ogy1N9PEgHX6oYt1b1OdVu7I346PKJBFUP WiJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=r3mNp+9YA48oT6Dv6F3lamQ3Yf5hXYBYkl2sjEYJGnQ=; b=KMtfa0gO2LnWy76DvDERiF5U5byUVDyqE7Nt+TviDY31YEixua4I2q4lpe2TfuKx4J 8A6ayRxIuZyfKeWOJ9v6b8CyS4DzD9OyWJu8fbw286eL0Pf2Z2OA2HoPxj4HNWM9F40z 01kK48IdGCGwahrivacEJ8nzVzTeKu1UVYxrtzJMeK/3aJ/0YTwFbx/J0TGQjrOm0D1/ hFvjMb/YwM6gwDyWfd88sMCaXap9toM7lG8YY2TaY4/kMhfXhh57aYOrcEuZbdwE0UCM qyqKBqsSkqZXDIoq6i62gqKQ8embXWh0/LmMAHxNFK0vmMEqJJLE0w6pkFBYXvqj+1gD s/4A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kq18si12181031ejb.533.2021.09.18.06.58.22; Sat, 18 Sep 2021 06:58:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243767AbhIRIJM (ORCPT + 99 others); Sat, 18 Sep 2021 04:09:12 -0400 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:43484 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243735AbhIRIJH (ORCPT ); Sat, 18 Sep 2021 04:09:07 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R411e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0Uom.HPE_1631952459; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0Uom.HPE_1631952459) by smtp.aliyun-inc.com(127.0.0.1); Sat, 18 Sep 2021 16:07:39 +0800 From: Tianjia Zhang To: David Howells , Herbert Xu , "David S. Miller" , Elvira Khabirova , Vitaly Chikunov , Stefan Berger , Eric Biggers , Eric Biggers , Mimi Zohar , "Gilad Ben-Yossef" , Pascal van Leeuwen , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Jia Zhang , "YiLin . Li" Cc: Tianjia Zhang Subject: [PATCH v4 2/2] pkcs7: support EC-RDSA/streebog in SignerInfo Date: Sat, 18 Sep 2021 16:07:37 +0800 Message-Id: <20210918080737.17252-3-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.3.ge56e4f7 In-Reply-To: <20210918080737.17252-1-tianjia.zhang@linux.alibaba.com> References: <20210918080737.17252-1-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Elvira Khabirova 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 Reviewed-by: Vitaly Chikunov Reviewed-by: Tianjia Zhang --- 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 24e2e4a6d842..277482bb1777 100644 --- a/crypto/asymmetric_keys/pkcs7_parser.c +++ b/crypto/asymmetric_keys/pkcs7_parser.c @@ -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; -- 2.19.1.3.ge56e4f7