Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp790648rdf; Tue, 21 Nov 2023 17:33:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGrqoqgQhCPiI8DgOgR+mah741wb+ehsn3VrtHvIOZX2YdYXkt847dlc27zgVtBjAudOkAQ X-Received: by 2002:a17:902:e78c:b0:1cf:5746:7ad0 with SMTP id cp12-20020a170902e78c00b001cf57467ad0mr5700082plb.14.1700616788190; Tue, 21 Nov 2023 17:33:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700616788; cv=none; d=google.com; s=arc-20160816; b=M4klawLiNY8XV5DOAugUkCqgQ+0Zagm+KJbEWZvuxTqQUqegTd+s6n1xM47iQx4Cqn DgHOE7g+10Wk51cAsW5EMMWQMVqiZSY4CkxsX/OYpS1iryIZuBoUtU5J9FrQxEzk0Hxl 51IhXukD6eTmBwySKwH53VrvGb81YKXVkFiWEzNQffDGr6xfok16qOpeJRorO58H++cU EcPJsdmHn6KpXqMBzh+YWfdzGiODRQQ4Uhyz4U1uDCa62FMHVDQA+HVXlpgJMZU5wq3g +TzaeLmQdB6E3oB46U0IHJQ+o5sg1PMJEGQk5+TyQ5exwZiCi6xFg7y6Y3oPRf7bHgGA 7aYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7gavnGOKlN8Hl7lQdYGMBweZgz7HO9jQl7THizDoGLs=; fh=r6l/0fNLL/AXSlcs77R52Y8eFsr4+G/MvscPXgtp5Xs=; b=vIAihbL6O6Ud+mOCjupTko79kHWEK4UdxxNslm616+IPtcHFQhgOA5UYZ4xbTo4MMI RjW2233QORUjJ23nvyXGSpuastQRxahmbhq3Epzm8ukCLqasyRxojzPwRV1B48U6zJDr 1/51AFkxxCGocDYFwaIXCZfLpHTVHCLtzPLqFNrcgJPbHX9ceomZ6xjPzGEpJqT8Dvw5 SfloayYQlv5HWNKlmevLCqOnWcMVhUhd9yl+zdyDsGWjloXFOzoodwXsXLtjEXJODNTz Kn6DTtfV1YxohrEL07P/HKnaBtAVqZ+cHFo6j+ilvXc0r2iqM3plsjemilxyZsSNUSXo GETg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c+oEnfyd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id u14-20020a170902e80e00b001cf5cc1cac9si2700002plg.221.2023.11.21.17.33.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 17:33:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c+oEnfyd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2F53380DF5EC; Tue, 21 Nov 2023 17:32:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343493AbjKVBcR (ORCPT + 99 others); Tue, 21 Nov 2023 20:32:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235022AbjKVBcP (ORCPT ); Tue, 21 Nov 2023 20:32:15 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76030DD for ; Tue, 21 Nov 2023 17:32:12 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 986FBC433C8; Wed, 22 Nov 2023 01:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700616732; bh=bm2hc6HT2WoAs5lqntk0P/geqlIujjMacD9zqFmU6zE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c+oEnfydqCQHukpHD415uJw6zLd4ltiB/0o5AEVdE2OaAaItk4smuVw9AvNBXVXxQ jK25tuFtjUmGF5101V7+MFPf0juQxLbF1hZleJHVnSJhNubWO1W0TB38gNGIE922lI JwVIuVwtptrIgX+gxtMwwz9ufc87izVGDW+hYQt7eO1rxh97JXEGNNcZnOQfKP5ffs vUpGkia7APJFkH3MDQUrxKKjPV0i5w53IJ4jHQqUomSRgWvHUelFIWFajNZo032+12 LwGA5svWtSqmdRq3cqaGIP/LpJeSoBmyrfXrKbTZoV6ITOuVXzfwXDk4yTP8q9889o ggJyqziI8AeNQ== Date: Tue, 21 Nov 2023 17:32:10 -0800 From: Eric Biggers To: Jerry Shih Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, herbert@gondor.apana.org.au, davem@davemloft.net, andy.chiu@sifive.com, greentime.hu@sifive.com, conor.dooley@microchip.com, guoren@kernel.org, bjorn@rivosinc.com, heiko@sntech.de, ardb@kernel.org, phoebe.chen@sifive.com, hongrong.hsu@sifive.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Subject: Re: [PATCH 09/12] RISC-V: crypto: add Zvknhb accelerated SHA384/512 implementations Message-ID: <20231122013210.GH2172@sol.localdomain> References: <20231025183644.8735-1-jerry.shih@sifive.com> <20231025183644.8735-10-jerry.shih@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231025183644.8735-10-jerry.shih@sifive.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 21 Nov 2023 17:32:18 -0800 (PST) On Thu, Oct 26, 2023 at 02:36:41AM +0800, Jerry Shih wrote: > +static int riscv64_sha512_update(struct shash_desc *desc, const u8 *data, > + unsigned int len) > +{ > + int ret = 0; > + > + /* > + * Make sure struct sha256_state begins directly with the SHA256 > + * 256-bit internal state, as this is what the asm function expect. > + */ > + BUILD_BUG_ON(offsetof(struct sha512_state, state) != 0); There's a copy-paste error here; all the 256 above should be 512. > +static struct shash_alg sha512_alg[] = { > + { > + .digestsize = SHA512_DIGEST_SIZE, > + .init = sha512_base_init, > + .update = riscv64_sha512_update, > + .final = riscv64_sha512_final, > + .finup = riscv64_sha512_finup, > + .descsize = sizeof(struct sha512_state), > + .base.cra_name = "sha512", > + .base.cra_driver_name = "sha512-riscv64-zvkb-zvknhb", > + .base.cra_priority = 150, > + .base.cra_blocksize = SHA512_BLOCK_SIZE, > + .base.cra_module = THIS_MODULE, > + }, > + { > + .digestsize = SHA384_DIGEST_SIZE, > + .init = sha384_base_init, > + .update = riscv64_sha512_update, > + .final = riscv64_sha512_final, > + .finup = riscv64_sha512_finup, > + .descsize = sizeof(struct sha512_state), > + .base.cra_name = "sha384", > + .base.cra_driver_name = "sha384-riscv64-zvkb-zvknhb", > + .base.cra_priority = 150, > + .base.cra_blocksize = SHA384_BLOCK_SIZE, > + .base.cra_module = THIS_MODULE, > + } > +}; *_algs instead of *_alg when there's more than one, please. I.e., sha512_alg => sha512_algs here. - Eric