Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp430694pxb; Sat, 18 Sep 2021 07:00:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvNt/Gvz5lvoCum/XqHbhNue5aBqtnD7llCwJgUh2bl48kiHS5vOApz4FYMPLY9GgI5UG3 X-Received: by 2002:a02:b91a:: with SMTP id v26mr922840jan.78.1631973631657; Sat, 18 Sep 2021 07:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631973631; cv=none; d=google.com; s=arc-20160816; b=oMVMdL0qtk6oW5/hcM/R8uFfIGqOTG5X+rhCzo1m3FxCZ4xOhIYM/jg2nQrCjr2lUC Gpr5013L4uQmvLl0sm9QatMCIrRDahD20iIoBrzM+paHXAEDfiVs6wPw7A65BxxV1eR+ Q7C/8uJvkM7cCKImz1GGDuKGkam8qUCZKGcTNWJwjguKv2PpN+m7iXnbzHxU3xlTRtKt Z5V63a++V3w3Qk3tHFoxV9g5yJODOoCup0ZTxKY0k2PPs0k3rTkl098iZ4fgrbKqsTBL 7XE5Ri2wb2y2yJgkT6+dDSYLn+F5EAbecsSuStiIXqYqxE0ojJiOtfobc3olzV5Y0nhx m1ww== 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=WuzJi+tWa4AvKf6fhd3BrFqva6J4wEzSXZLlr+TofKw=; b=a3a6FzEnhHyK21bEQMc4QiCcWz7isyEH5JajnKlsAUvYfnC4gVnLgYEc/QtjHQqss0 s3jmsxBkzZ/0SINwEMkaOpTvp4eDQvHhDqf83mi6914HIlKLZj/5IzyQaprTDrQqBFcA dC26sH4Z7k+9zwWlUt8kR4Skzczp96NhuB3xN9s9TDK6e5hQJdQU1LnFuKTvfinzzWQQ Rt3dTE3oltcoAw0Z0G4iHsEsrafRP4OKh1utOEKw8QBIn/6HSjBxy/V3iQwrBcFcN5SF 9ks6KS2f7BdtqrGrNhtiV+Aj5CClyAdEnMlxDdYZ5HebbWhCiqtVDEQ9wjU7tEQCPiVI G47w== 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 k39si10374935jav.88.2021.09.18.07.00.19; Sat, 18 Sep 2021 07:00:31 -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 S243875AbhIRIJQ (ORCPT + 99 others); Sat, 18 Sep 2021 04:09:16 -0400 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:38468 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243903AbhIRIJP (ORCPT ); Sat, 18 Sep 2021 04:09:15 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R731e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0Uom.fo5_1631952458; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0Uom.fo5_1631952458) 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 1/2] pkcs7: parser support SM2 and SM3 algorithms combination Date: Sat, 18 Sep 2021 16:07:36 +0800 Message-Id: <20210918080737.17252-2-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 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 Reviewed-by: Vitaly Chikunov Reviewed-by: Stefan Berger --- 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 6592279d839a..24e2e4a6d842 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; @@ -277,6 +280,10 @@ int pkcs7_sig_note_pkey_algo(void *context, size_t hdrlen, ctx->sinfo->sig->pkey_algo = "ecdsa"; ctx->sinfo->sig->encoding = "x962"; 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