Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37983037rwd; Wed, 12 Jul 2023 01:04:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlH/JvfKHtYmoNt5edZpKtT9hvM5vREgmXaQcP+fBrT5EvTbwKMYg+1oBG6d9qUo2x0XRIxf X-Received: by 2002:a05:6870:b48e:b0:19f:4dc2:428e with SMTP id y14-20020a056870b48e00b0019f4dc2428emr20331993oap.14.1689149044158; Wed, 12 Jul 2023 01:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689149044; cv=none; d=google.com; s=arc-20160816; b=pLEpDgH/B8l9sgIioG51VXtjFTmUARaJ0ukDupUuvlxyMCTZpWsz1ByWTyeZW3lVNn L3FiP6zb/wfHew3ZsZwp+aWmMHwPF+/ou3k5oUtP/fHcRuqIu6RKa28lqzG9UkR2WHxh xSru728nL9pEuwYyjIomVD77b9/P04k1iiP+Dh6CNzYVdRDmX4YZ7nlhFW+S7jDyou1/ 6UzeY8ifD7djccanCw2dfnjA3pjtxDvvOGUvhHjI6OJu4G1FATmAZyR2ZsUNRNSIYAui 4Hah8Ood6xIpqPnTE3LiuuXEdYEALYmiDPjs93njPE1MFBvIqYRk6QEyzGTqkvhVX4Pe Fc7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=Um1B9av/YquzKvNJu7FsuOTP/FgdzsJGIJWDhEQJ774=; fh=KhGBn25tdmKU+x3cptK28T3RfD8RIWW7vekv9dsgAoA=; b=sq1Ve0aAPE6trRJ5Rc7WO/bX7gyEJNmfZU89xdNa68GUS3sphU++YxvtSAgA65H6Fc hwl+Gv+uR0To4I3B7B5IuPnn/5PlAqCzcsQJ2LQ+gSTb4xIRT1I9Jpa+VGotaMFTQME6 HivB4dSnAvgnQ8bq0zPkdT4VuFCwZUO47G/aDy/WOGA2TgGZbm0cFGyGsPRXsCj0kXv4 U1pRfc+14R0ksThI2v6nBRMcidzOGR74/tDzyPKns/llEC7AQRyAkFoGrQZdZ/5aWAXP lmWk18sMTMjOn35AszhOCo3ZS3Jt0tcFUF9I9c7M16P4fjJnBtMo5JPq4cKW3DRjFItz aQqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=6dBxyx5S; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw3-20020a17090b180300b0025ea380f868si11251015pjb.2.2023.07.12.01.03.43; Wed, 12 Jul 2023 01:04:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=6dBxyx5S; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229659AbjGLH7Q (ORCPT + 99 others); Wed, 12 Jul 2023 03:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232049AbjGLH7I (ORCPT ); Wed, 12 Jul 2023 03:59:08 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 263AD1990; Wed, 12 Jul 2023 00:59:06 -0700 (PDT) Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36C50ZAK015254; Wed, 12 Jul 2023 09:58:39 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=selector1; bh=Um1B9av/YquzKvNJu7FsuOTP/FgdzsJGIJWDhEQJ774=; b=6dBxyx5S7+VNmvzTQOD8oDl0fwA6nWSebqi37ymuLJGuAv5KKl3hJ41fzx6ECqwKH+gI SFxaNFLdtF4T7334wrmMgWNvAV3f33y4EerRKOkDsIuMBrBsT1bsHGRsefu5DcgvkuHN MZqFiX80vqtP/9g3r5leiM1IVtPp0QQpWicLG1aMofP79v2ikBT+shUirt6eZOLj4rXS cnhvyUKswk24bzgKnYD8Sji7/7MurhEkczKHwvf0hoKob8U//n1fzjD8YFvnvn/Oya9g NeMAfcql5D05IxSDm4BtUln6BN1EyinD2GkTseuP36Wby//dNY13IkGwenI8EGFGSG+F nA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3rs6u6dr4k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jul 2023 09:58:39 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 24765100058; Wed, 12 Jul 2023 09:58:37 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E4E9A2115E0; Wed, 12 Jul 2023 09:58:37 +0200 (CEST) Received: from [10.201.22.9] (10.201.22.9) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 12 Jul 2023 09:58:37 +0200 Message-ID: Date: Wed, 12 Jul 2023 09:58:36 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 Subject: Re: [PATCH 2/7] crypto: stm32 - add new algorithms support To: Linus Walleij CC: Herbert Xu , "David S . Miller" , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Lionel Debieve , , , , , References: <20230706073719.1156288-1-thomas.bourgoin@foss.st.com> <20230706073719.1156288-3-thomas.bourgoin@foss.st.com> From: Thomas BOURGOIN In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.201.22.9] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-12_04,2023-07-11_01,2023-05-22_02 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Linus, Did you run your test only with the patch adding the support for STM32MP13 or did you try the whole patch set ? The error is on the test vector number 4, which is an HASH of 64 bytes which is exactly the size of a blcok for SHA1. Did you try to run the test for SHA256 ? (I guess you will see the same error on test vector 4) I have two hypothesis : - it could be related to the padding of the data. (I don't think, the patch does not modify these lines) - it could come from the way the first block of data is handle. To start the first pre computation, we have to write 1 block + 1 word. The test only write one block so maybe the issue is here. On 7/6/23 09:37, Thomas BOURGOIN wrote: > + /* > + * After first block + 1 words are fill up, > + * we only need to fill 1 block to start partial computation > + */ > + rctx->state.blocklen -= sizeof(u32); > + I found a typo in the number of CSR to save/restore for the SHA1 and SHA256 algorithm. It should be 38 instead of 22. Tell me if it fixes the regression. It could be possible to divide the patch in 2 (one patch rework preparing MP13 and one patch with the new algorithm) but for the upstream I do not know if it is relevant to have 2 patches instead of one. Best regards, Thomas --- drivers/crypto/stm32/stm32-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c index a50d73c18d5c..88a186c3dd78 100644 --- a/drivers/crypto/stm32/stm32-hash.c +++ b/drivers/crypto/stm32/stm32-hash.c @@ -74,7 +74,7 @@ /* Context swap register */ #define HASH_CSR_NB_SHA256_HMAC 54 -#define HASH_CSR_NB_SHA256 22 +#define HASH_CSR_NB_SHA256 38 #define HASH_CSR_NB_SHA512_HMAC 103 #define HASH_CSR_NB_SHA512 91 #define HASH_CSR_NB_SHA3_HMAC 88 -- 2.25.1