Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3597809rdh; Mon, 27 Nov 2023 20:12:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGEhao+jYtnmYFUYf7VMMcAuMlDGdsgjB17nHwjJV+RhTLK/+482KUScIbdjYE36PYyinsS X-Received: by 2002:a17:903:41c6:b0:1cf:584e:d724 with SMTP id u6-20020a17090341c600b001cf584ed724mr19001984ple.10.1701144773189; Mon, 27 Nov 2023 20:12:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701144773; cv=none; d=google.com; s=arc-20160816; b=V0H8LDfg5LnS+BNZPZVGTddoQ2SG07kgkmZxFoD+kxcJ7GRWdbabyHIn7jdMhFQOEJ 1XtvZCUO3dLymzioS19tpgtp4CBOybEzHh+Ly4Y4ykbfHNOVP4b2E8clJau2E3gtHzYj bnI34b0HtsIqQ6zy/X7UpG3qaWf1cXcBcS/v14H73SC89g2NEQ6TwzlC4JBWad0IvThB Px5dUC3zD0RyEb2GNZOXDqpTLNU5pAuskQik/lW2iSgkUs0pj9DbrIgXBCfgeC3iv+VS PnKL/TG2+WP+T+CFf1AEHawzvFBgqVllXrOOkqqHUfE0J0iRpyBGlbk7iF+bVeXxHN9E ulJg== 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=VKDzS/uEmhAqsdiTZCkirEtBdtnedcOahGVJozM/QRI=; fh=zbDRpcBgg9Y8vPgjc5rEEysmrqOVa145mcP3uY0f1po=; b=i6nRSnhwY2Y1tjvjLp30jS9B4GfIoq4w9n41/BSM/ANSDlzUa4Zmq7AhuZAaUoQRjt 7fmLCRgpkX9w7llmHUNxgXZe5WSX/BH3BnEDRUU/zfoTMu98DtD2sFnBqBTEsk92TcqN coTodYvD7w+rY+8NwapDggO/0TUZ/8/yoSbS7qgD08jf59y8cAz5mHIGiBrbhE0OLQ6Z VyRu+Un3fk4XJbzfQ7yZYFuZXIneG0716ALvBQa8KrsAgfay41GJhELOMfWNSpT3xrIx 6kHLHfg/Qkc2j0XSnBc8rgNdsWj5dIZ4foSmFmGSmyeHSVagKTnkJYeE6Php437QT3oA pH1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CEWumhAE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f15-20020a170902ce8f00b001cfaf05da38si8607340plg.58.2023.11.27.20.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 20:12:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CEWumhAE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 E6B2980A30FE; Mon, 27 Nov 2023 20:12:51 -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 S234467AbjK1EMd (ORCPT + 99 others); Mon, 27 Nov 2023 23:12:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbjK1EMa (ORCPT ); Mon, 27 Nov 2023 23:12:30 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7748E198 for ; Mon, 27 Nov 2023 20:12:37 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A027DC433C8; Tue, 28 Nov 2023 04:12:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701144757; bh=8sgnTlTTe9L/d3q6KejWDFP12I9AsyGGo8/4VhNtpCw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CEWumhAEPzcP6ei2al6jYGIp3TiLr1CvuhBdMYtBFRd4npdj1hflBmoIui2KHuHiX rjCsWTYe/2Jf401q1YWW5Y9W3zJPFvHEB9Df4EdJqKUhUKQaPLg4mIu6mHj/1RH2Iw 8pfKefIpVE+XyPCSE4GrYI2IudRAyPwoIkZhhSZM1h5F70Lwzdt1t333/2Z+mm6Pap HvrzKTSaaq9xkeRFrqC8+MW8TvOghwdacuvgAlkCG6NbwTI8fiE2fQ/x6RT4cLdVLj qdGAFrpVTW07QHGRmBOKB7Ml2unZzzZAV6K8crtdLfy/OsO+A6RjUXQjOvq38CFjRu HbbiG9Z+p8KJg== Date: Mon, 27 Nov 2023 20:12:35 -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, conor.dooley@microchip.com, ardb@kernel.org, heiko@sntech.de, 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 v2 09/13] RISC-V: crypto: add Zvknha/b accelerated SHA224/256 implementations Message-ID: <20231128041235.GJ1463@sol.localdomain> References: <20231127070703.1697-1-jerry.shih@sifive.com> <20231127070703.1697-10-jerry.shih@sifive.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231127070703.1697-10-jerry.shih@sifive.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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]); Mon, 27 Nov 2023 20:12:52 -0800 (PST) On Mon, Nov 27, 2023 at 03:06:59PM +0800, Jerry Shih wrote: > +/* > + * sha256 using zvkb and zvknha/b vector crypto extension > + * > + * This asm function will just take the first 256-bit as the sha256 state from > + * the pointer to `struct sha256_state`. > + */ > +asmlinkage void > +sha256_block_data_order_zvkb_zvknha_or_zvknhb(struct sha256_state *digest, > + const u8 *data, int num_blks); The SHA-2 and SM3 assembly functions are potentially being called using indirect calls, depending on whether the compiler optimizes out the indirect call that exists in the code or not. These assembly functions also are not defined using SYM_TYPED_FUNC_START. This is not compatible with Control Flow Integrity (CONFIG_CFI_CLANG); these indirect calls might generate CFI failures. I recommend using wrapper functions to avoid this issue, like what is done in arch/arm64/crypto/sha2-ce-glue.c. - Eric