From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E43E2C4332F for ; Mon, 7 Feb 2022 07:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234898AbiBGHxc (ORCPT ); Mon, 7 Feb 2022 02:53:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243745AbiBGHpQ (ORCPT ); Mon, 7 Feb 2022 02:45:16 -0500 Received: from out199-16.us.a.mail.aliyun.com (out199-16.us.a.mail.aliyun.com [47.90.199.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33104C043181; Sun, 6 Feb 2022 23:45:13 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01424;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0V3leFSM_1644219908; Received: from 30.240.99.213(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0V3leFSM_1644219908) by smtp.aliyun-inc.com(127.0.0.1); Mon, 07 Feb 2022 15:45:09 +0800 Message-ID: Date: Mon, 7 Feb 2022 15:45:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 0/2] Fix bugs in public_key_verify_signature() Content-Language: en-US To: Eric Biggers , keyrings@vger.kernel.org, Jarkko Sakkinen , David Howells Cc: linux-crypto@vger.kernel.org, linux-integrity@vger.kernel.org, Stefan Berger , Gilad Ben-Yossef , Vitaly Chikunov , Mimi Zohar References: <20220201003414.55380-1-ebiggers@kernel.org> From: Tianjia Zhang In-Reply-To: <20220201003414.55380-1-ebiggers@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Eric, On 2/1/22 8:34 AM, Eric Biggers wrote: > This patchset fixes some bugs in public_key_verify_signature() where it > could be tricked into using the wrong algorithm, as was discussed at > https://lore.kernel.org/linux-integrity/20211202215507.298415-1-zohar@linux.ibm.com/T/#t > > I'd appreciate it if the people who care about each of the supported > public key algorithms (RSA, ECDSA, ECRDSA, and SM2) would test this > patchset to make sure it still works for their use case(s). I've tested > that X.509 and PKCS#7 with RSA still work. > > Note, I have *not* included a fix for SM2 being implemented incorrectly. > That is another bug that I pointed out in the above thread. I think > that bug is for the people who actually care about SM2. > > This applies to v5.17-rc2. > Sorry for the late reply, thanks for your work. I did the test and the x509 certificate for SM2-with-SM3 is working fine. Tested-by: Tianjia Zhang Regarding the algorithm information in the signature data used by SM2, I will add a patch to fix this issue, thanks for pointing it out. Best regards, Tianjia > Eric Biggers (2): > KEYS: asymmetric: enforce that sig algo matches key algo > KEYS: asymmetric: properly validate hash_algo and encoding > > crypto/asymmetric_keys/pkcs7_verify.c | 6 -- > crypto/asymmetric_keys/public_key.c | 126 ++++++++++++++++------- > crypto/asymmetric_keys/x509_public_key.c | 6 -- > 3 files changed, 91 insertions(+), 47 deletions(-) > > > base-commit: 26291c54e111ff6ba87a164d85d4a4e134b7315c