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 X-Spam-Level: X-Spam-Status: No, score=-4.4 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,FSL_HELO_FAKE,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10279C10F05 for ; Mon, 1 Apr 2019 17:31:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D4EA120830 for ; Mon, 1 Apr 2019 17:31:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AIoBszvv"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="z8EkEhQq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4EA120830 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oaD3IlgjOpaNEH9AG7KzBGvTTI5tYs2g1Lcenq75YKk=; b=AIoBszvv7GPvrt dyz1J1RjLbHGzlHtvpzN934+g44sdsQyiKQB9RWfAXman8mMn0Dtg87mLvNbG2MA6aQWcmcRoICtF CidIsIKcDsXUu/JQpQULbvri5QPGX6iwguBbx6/WjsPc+/HMojqjuSjL+xRuWfu4q8oVZ6RQPpAAM D6omhZPGRVGGIK/27VQFi99dKph7pV/VHnjaoPxjHYh2P066N75nsgrNysERG8kbG5zlPPrjgoBv9 SAqNFASLgSCUL3+Yi+GBRkwF4/XwRAYVaoJqbl10fAPbRHZpVA3kSctsp3HGKSfM5AU08pipaLNKY n96rspeSmHtZo9LhN9nA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB0ly-00046w-LK; Mon, 01 Apr 2019 17:31:02 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB0lv-00046Z-Kj for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 17:31:01 +0000 Received: from gmail.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DACD320856; Mon, 1 Apr 2019 17:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554139859; bh=RN2ZZbMjDHYlc4yGbJxOaRqQcwMFoBWlY+v/Kvr6xDY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=z8EkEhQqkR7yK8x7A1PLPZFVx3FIyY2cC0bbA9KFV6Br6yMMKIxAMAFsjIxneIcHz 2ovlNo7qQOKkU2bHfdGKg8Mt+R+fAtuLHNCE0zQAYdvaxTY1Ssl0EYURemOrds7ILE pC7301ZDQoPxE7cxHJXotQpZ2ae4Tws8TJSoI2n0= Date: Mon, 1 Apr 2019 10:30:57 -0700 From: Eric Biggers To: Lionel Debieve Subject: Re: [PATCH 1/1] crypto: testmgr - call shash_init in crc32c algo Message-ID: <20190401173056.GD131675@gmail.com> References: <1554123264-24243-1-git-send-email-lionel.debieve@st.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1554123264-24243-1-git-send-email-lionel.debieve@st.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_103059_691113_7F0844DE X-CRM114-Status: GOOD ( 17.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin Gaignard , Alexandre Torgue , linux-kernel@vger.kernel.org, Fabien Dessenne , linux-stm32@st-md-mailman.stormreply.com, linux-crypto@vger.kernel.org, Maxime Coquelin , Ludovic Barre , "David S . Miller" , linux-arm-kernel@lists.infradead.org, Herbert Xu Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Lionel, On Mon, Apr 01, 2019 at 02:54:24PM +0200, Lionel Debieve wrote: > In case of device call required in low level driver, > the context must be initialized before calling the final > function. > > Signed-off-by: Lionel Debieve > --- > crypto/testmgr.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/crypto/testmgr.c b/crypto/testmgr.c > index 8386038..4a00d7c 100644 > --- a/crypto/testmgr.c > +++ b/crypto/testmgr.c > @@ -2181,6 +2181,13 @@ static int alg_test_crc32c(const struct alg_test_desc *desc, > shash->tfm = tfm; > shash->flags = 0; > > + err = crypto_shash_init(shash); > + if (err) { > + printk(KERN_ERR "alg: crc32c: init failed for " > + "%s: %d\n", driver, err); > + break; > + } > + > *ctx = 420553207; > err = crypto_shash_final(shash, (u8 *)&val); > if (err) { > -- > 2.7.4 > This defeats the point of the test, which is that crc32c implementations are expected to use the same shash_desc context format and be usable by calling crypto_shash_update() directly after initializing the context manually, without a prior crypto_shash_init(). See for example ext4_chksum() in fs/ext4/ext4.h: static inline u32 ext4_chksum(struct ext4_sb_info *sbi, u32 crc, const void *address, unsigned int length) { struct { struct shash_desc shash; char ctx[4]; } desc; BUG_ON(crypto_shash_descsize(sbi->s_chksum_driver)!=sizeof(desc.ctx)); desc.shash.tfm = sbi->s_chksum_driver; desc.shash.flags = 0; *(u32 *)desc.ctx = crc; BUG_ON(crypto_shash_update(&desc.shash, address, length)); return *(u32 *)desc.ctx; } I think you need to fix the stm32 crc32 driver to not store anything extra in the shash_desc context, and only use hardware during ->update(). - Eric _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel