[PATCH v2 1/6] crypto: sm3 - create SM3 stand-alone library

Tianjia Zhang tianjia.zhang at linux.alibaba.com
Wed Dec 22 05:11:39 PST 2021


Hi Gilad,

On 12/22/21 2:59 PM, Gilad Ben-Yossef wrote:
> On Wed, Dec 22, 2021 at 6:50 AM Tianjia Zhang
> <tianjia.zhang at linux.alibaba.com> 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 at benyosef.com>
> 
> 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



More information about the linux-arm-kernel mailing list