Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp59679pxv; Thu, 24 Jun 2021 02:47:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZsg03wYUiaNKVVNP213qiDLSLojVR1lkqAMIPbscUtznagY1Kp0W55WfBBZ3pOlH+Abbo X-Received: by 2002:a50:c907:: with SMTP id o7mr5889887edh.120.1624528065248; Thu, 24 Jun 2021 02:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624528065; cv=none; d=google.com; s=arc-20160816; b=jRu041U5sw11Rdj96RzdkzJBWG2eReEX3jHu2dj3+Lp05Y/VXO7LLoB9J0czicurmN aGinZ7/Mfmf1jzPypWbUMhUtj/N7ZKqMff7Vcci6Za2bEvdPtKGWr5nV5+TLrV9n3dTk V1uO5pcm6O7Fg5VIpvUNyw3BrGn1Sa/r7C+k0sRnbmYNfaR+PcNvBwyGFkQXAIOum4Iz nck2NWaEixdXww+Kmeou9/oN0TRdzBwRp4UvOw8+XfuNqQ+TayrpFt0wbT1RMHIRPkh0 2i3Ur4h41rt2g4/HD30YKbC1viVmMIfz8in+Jh6E0487rapVC2phvrpQrZRjPcRFqBvF 7PfQ== 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 :message-id:date:subject:cc:to:from; bh=WbGiWAvQ4hrFDl0IuiYtIraeNDAFa/I5lNtyrpQyodg=; b=so51CsLuD9BpdpZrNGp+Rj8k7ffeRuSj1+2J1n27UQ7Xq6CMBYTA/5HJhh2qbZ7VC+ s1tMLOz8vkkzJ+fpDqNinsrudJqTFlnALDHgE7HYWhifTuqM9p1/FGAQXOtvBNB1YzU3 /NuGioiI6ROndfZG6TB/1LUrTjT4sRhtri6+s7Oiv8jE2NzQiX8gMThd2ZPS3ED5Ar8W j1Dtm9KD5EC8wXd75bUsQgCCwTIAPBtrutH/5mNtVwYrZElyn9V1jB6dl1QT68W3ZpNq W8EpStOQxwCxzlBYpWHseT6wvW9JyY66HkNv+kZPR57g0Ay6c0qj3/5fK45gjddEwFJj Wb5A== 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 c11si2724581edy.282.2021.06.24.02.47.11; Thu, 24 Jun 2021 02:47:45 -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 S231970AbhFXJt2 (ORCPT + 99 others); Thu, 24 Jun 2021 05:49:28 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:34706 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230116AbhFXJt2 (ORCPT ); Thu, 24 Jun 2021 05:49:28 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R741e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=14;SR=0;TI=SMTPD_---0UdW6VbM_1624528025; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0UdW6VbM_1624528025) by smtp.aliyun-inc.com(127.0.0.1); Thu, 24 Jun 2021 17:47:05 +0800 From: Tianjia Zhang To: David Howells , Herbert Xu , "David S. Miller" , Eric Biggers , Eric Biggers , Mimi Zohar , Vitaly Chikunov , "Gilad Ben-Yossef" , Pascal van Leeuwen , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Jia Zhang Cc: Tianjia Zhang Subject: [PATCH v3] pkcs7: make parser enable SM2 and SM3 algorithms combination Date: Thu, 24 Jun 2021 17:47:05 +0800 Message-Id: <20210624094705.48673-1-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.3.ge56e4f7 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 --- 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