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 DBBB2C433EF for ; Wed, 22 Dec 2021 13:11:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245281AbhLVNLs (ORCPT ); Wed, 22 Dec 2021 08:11:48 -0500 Received: from out30-42.freemail.mail.aliyun.com ([115.124.30.42]:46346 "EHLO out30-42.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240720AbhLVNLq (ORCPT ); Wed, 22 Dec 2021 08:11:46 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;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=19;SR=0;TI=SMTPD_---0V.QmgAE_1640178699; Received: from 30.240.100.46(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0V.QmgAE_1640178699) by smtp.aliyun-inc.com(127.0.0.1); Wed, 22 Dec 2021 21:11:42 +0800 Message-ID: Date: Wed, 22 Dec 2021 21:11:39 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH v2 1/6] crypto: sm3 - create SM3 stand-alone library Content-Language: en-US To: Gilad Ben-Yossef Cc: Herbert Xu , "David S. Miller" , Vitaly Chikunov , Eric Biggers , Eric Biggers , Ard Biesheuvel , Jussi Kivilinna , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Linux Crypto Mailing List , x86@kernel.org, Linux ARM , Linux kernel mailing list References: <20211222045022.27069-1-tianjia.zhang@linux.alibaba.com> <20211222045022.27069-2-tianjia.zhang@linux.alibaba.com> From: Tianjia Zhang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Gilad, On 12/22/21 2:59 PM, Gilad Ben-Yossef wrote: > On Wed, Dec 22, 2021 at 6:50 AM Tianjia Zhang > wrote: >> >> Stand-alone implementation of the SM3 algorithm. It is designed >> to have as little dependencies as possible. In other cases you >> should generally use the hash APIs from include/crypto/hash.h. >> Especially when hashing large amounts of data as those APIs may >> be hw-accelerated. In the new SM3 stand-alone library, >> sm3_compress() has also been optimized, instead of simply using >> the code in sm3_generic. >> > > I have a really minor nitpick: the commit message talks about changes > to sm3_compress() which was there in the original code but there is no > such function in the current code which is in a different patch and > file, so if you do another iteration for other reason, perhaps change > the commit message to refer to sm3_transform() instead? it's not > really important enough to warrant a new iteration on it's own... > > Otherwise, I'm not smart enough to evaluate the changes to > sm3_transform() cryptographically but the overall approach of moving > to a standalone library seems sane to me. > > So, for what it's worth - > > Reviewed-by: Gilad Ben-Yossef > > Gilad > Thanks for your suggestion. I agree with you. In the implementation of sm3_generic, sm3_compress() is a sub-function of sm3_transform(). The optimization is indeed for sm3_transform(). I will fix it in the next patch. Best regards, Tianjia