From patchwork Fri Nov 18 19:44:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 13048740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C2677C433FE for ; Fri, 18 Nov 2022 19:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tYADT9ZJr2eqIsp2BKYQVsDQLkm4ydJMtJHglq8faTM=; b=NAU/xSptF5cZjg 5aGnYz/MkzQ22NN1lsMpwYuOYUyVfplOujFLmXwPoWh/fqAPZ0B8ygj669WKphY6uIPPpYAD8oBLD PSETgRXxtoLlKRV5nafx9Pp4r8Yz6Dbt0+ciEtnE2sUCJhm48mYMOaIWptPaA5dAQ19NU/QalAJa7 L7QVmu7dVvEnc9m12L5uTD4ofcTirjWVAxdFgoWLW+bT8Zh9j9KWnF8JlWULx+WUAJLpbg3ELRW88 bmY32WRvHc1Pc0t6J0WlkOVkL/vdoYjoLuRWN/Z4TlnAiozWDUJLXB2vpxCMnC9VzPwiwn2O4arOF Ch2s/f/XHgmOJyfUGNqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow7O9-007jB8-PS; Fri, 18 Nov 2022 19:51:02 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ow7Jm-007h2x-J5 for linux-arm-kernel@lists.infradead.org; Fri, 18 Nov 2022 19:46:35 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7EF0C62788; Fri, 18 Nov 2022 19:46:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DA40C43470; Fri, 18 Nov 2022 19:46:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668800787; bh=Jktv+/Qu/uCCZJ2itmlKVBoDqxZ3t6fI03aW0+AnaOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g0nHEAK6+gGwwvbGug2zU5o5c9AvD4J8LVD7A5I0bsJep+SZ+nLXLmWdCKLTHuToc gmz0GC4mEPhWbunktEF3A4pKjjUaxa0E/Ypzs2v+vJB/T8SaqYh57y1W3wFN/X7Nd/ 61MPbQJE/3yZUASVFukPNYvg50koFQy7Ied7Wye9UX5rUAA1rhBF25YYEi61gj/SId WoUsuILKqmHaT80VGqyHIjdSrLH/sZwobE6dKDuEZ18bLaex8VOv/Dl8HK+jZcRUYa nbR24R9KPBk8CLjzFvEvGg2CcDfQ26figvmVvtvbxwDp1yykkePPEj6IejOjWr75LD 8jqOfsYpb6JgQ== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org, Sami Tolvanen , "Peter Zijlstra (Intel)" Subject: [PATCH v2 11/12] crypto: arm/nhpoly1305 - eliminate unnecessary CFI wrapper Date: Fri, 18 Nov 2022 11:44:20 -0800 Message-Id: <20221118194421.160414-12-ebiggers@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118194421.160414-1-ebiggers@kernel.org> References: <20221118194421.160414-1-ebiggers@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221118_114630_710681_AA973523 X-CRM114-Status: GOOD ( 13.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Eric Biggers The arm architecture doesn't support CFI yet, and even if it did, the new CFI implementation supports indirect calls to assembly functions. Therefore, there's no need to use a wrapper function for nh_neon(). Acked-by: Peter Zijlstra (Intel) Reviewed-by: Sami Tolvanen Signed-off-by: Eric Biggers --- arch/arm/crypto/nh-neon-core.S | 2 +- arch/arm/crypto/nhpoly1305-neon-glue.c | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/arch/arm/crypto/nh-neon-core.S b/arch/arm/crypto/nh-neon-core.S index 434d80ab531c2..01620a0782ca9 100644 --- a/arch/arm/crypto/nh-neon-core.S +++ b/arch/arm/crypto/nh-neon-core.S @@ -69,7 +69,7 @@ /* * void nh_neon(const u32 *key, const u8 *message, size_t message_len, - * u8 hash[NH_HASH_BYTES]) + * __le64 hash[NH_NUM_PASSES]) * * It's guaranteed that message_len % 16 == 0. */ diff --git a/arch/arm/crypto/nhpoly1305-neon-glue.c b/arch/arm/crypto/nhpoly1305-neon-glue.c index ffa8d73fe722c..e93e41ff26566 100644 --- a/arch/arm/crypto/nhpoly1305-neon-glue.c +++ b/arch/arm/crypto/nhpoly1305-neon-glue.c @@ -14,14 +14,7 @@ #include asmlinkage void nh_neon(const u32 *key, const u8 *message, size_t message_len, - u8 hash[NH_HASH_BYTES]); - -/* wrapper to avoid indirect call to assembly, which doesn't work with CFI */ -static void _nh_neon(const u32 *key, const u8 *message, size_t message_len, - __le64 hash[NH_NUM_PASSES]) -{ - nh_neon(key, message, message_len, (u8 *)hash); -} + __le64 hash[NH_NUM_PASSES]); static int nhpoly1305_neon_update(struct shash_desc *desc, const u8 *src, unsigned int srclen) @@ -33,7 +26,7 @@ static int nhpoly1305_neon_update(struct shash_desc *desc, unsigned int n = min_t(unsigned int, srclen, SZ_4K); kernel_neon_begin(); - crypto_nhpoly1305_update_helper(desc, src, n, _nh_neon); + crypto_nhpoly1305_update_helper(desc, src, n, nh_neon); kernel_neon_end(); src += n; srclen -= n;