Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2389566lqp; Sun, 24 Mar 2024 17:17:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXDQGDzBMhQX92jgSuzKlrEQ+9Y4HwRJaDPpvYwLvYyuLATcEJKSBPPQa1NMFPd39JCZJ0P6L/dFfZJ+IT54UF5hIY88FadrUNWsF9izA== X-Google-Smtp-Source: AGHT+IFnbZ9Fniz6iDeJrsf6C++jysPF/n1kShPs7pGagOfv3NJF8uBUtxisIx5pZVUq5ZsPUSTk X-Received: by 2002:a05:6122:14b1:b0:4cb:2662:3653 with SMTP id c17-20020a05612214b100b004cb26623653mr2934217vkq.9.1711325824132; Sun, 24 Mar 2024 17:17:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711325824; cv=pass; d=google.com; s=arc-20160816; b=oH8anhi1URwG87/FAj7Z6O/HgzJuZg+uH+SDJ054st/o08gvz+KlxCrmKm9EgJopw0 it/gxEIU6ROrv8v+gOpGXmJlMhA6OVpNEzdydRwdmrdFN8qt6ahLJI26zziO1Zvf1Eq6 ir8LAWAldutbwGji3WD65F69AZEEC/5rcTLZf0t13kuySQlxsxVGEfkmwhYxTtKDpflh qsfjL7eAfwXm6bEhVs50hzXdMQeISDwKlQWTtRQiI/4l1WquF5fhBfHAoOGyOnRDxjFa VDn27GK0E5a2pmnysipHyQKDVrY35u2iCVNK3HhtgDh9HgSZy3ytKWPVx1o09Fv3VssL baiQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AzqP6X1In85RkJqT6QhfBR4M2RTDcntRzfyLKq/J52s=; fh=NY/r+vQyfbV+XABMTgG+JE7E6lH9mrxbrjBQiPsFzNA=; b=itDrolN/PMzgFh4YKiuYCpixTpw2hkc+w1v04PdgQqFO+mD+DbgcMyHzyLPKErCgv2 0/BI5oD9C69b7qt9w+27cfbXhehnOj2iX1siV9MBZwb/TdVyS3pzn5k5ef3BqMUbDfyG IKP8MV7moYDpg+yEUAPEWz4aebmSEGnNeZFEgGaxT/xqX4tfrBUYlEXMVGkp3LfG+pNz usBcQTiI7vZh8yVTJKlj1AVzatBfkTjqVgG1S4JNBM1EXxn4YzKyJXLag/FyzcmK34fL F+bR4RhDdQ3kmjgNoC3tom4n7PWLOD8MBInLmtOnHm1mUcGTJipqDr37TEDS/b9N44MV HGxw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XaTXOi4R; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i4-20020ad45c64000000b00692d61f01acsi6922258qvh.286.2024.03.24.17.17.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 17:17:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XaTXOi4R; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113356-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113356-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C9A251C22F7C for ; Mon, 25 Mar 2024 00:17:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EA3E19B2AB; Sun, 24 Mar 2024 22:42:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XaTXOi4R" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9245619B297; Sun, 24 Mar 2024 22:42:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320157; cv=none; b=CHUclO9VsOeXxNSjbDI10HpW2xMMP9rdOa9e9LDXWI7xXUCa034gQbAsl4II1phnMqnNXkTsFUcLsu2yEDcaOeuN+UYQwv7dfWnPsq4XyMZhnPppnYBBvZTZDCb8T+MFbu81LO2KC9g0CxOqD6MaqkilNiO9BHtA/kCcKFe2NZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320157; c=relaxed/simple; bh=8NG5ryWG5HYBva078aNyd9BCSi5cg3Cn9gXeZNtAs18=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OMQQ94p7CBZlhR0miW0TeV9t1a67tunoIri6f7x+2lHmNz4nmZY6Fp7D0nxxuQUWL3RphernCYYRKMu422YPibCDZ/3MX1ujXcf6qrZOoRjKdm0k6Kb6iEn7Pcz2mkq7HagWiTuMsaEx12f1CMGR/XVsjVf0lKzWStsjJTYL/tk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XaTXOi4R; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA0ABC433B2; Sun, 24 Mar 2024 22:42:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320157; bh=8NG5ryWG5HYBva078aNyd9BCSi5cg3Cn9gXeZNtAs18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XaTXOi4RqsQZd0RiTmku7cWeosh9KZ5alfo0fH2rkg3RgdLT35GE+fSl/V44OsvEo lEcEz7A5Aw9/pBmbavYxbrrvv9enOtp7Emj4zI/u2bFb83rRvcMd/nDIiR2o5vNISq i309gXdyA9vhBuoVkAaVKlKinmrkkD4sgNP7uoS0GJaMnAnAvhelKoESMyHbSDD5hX rptKPqQiQORgJhgVVCLr7ZZKM5AyesPRQnOhdpSyVDJ1rJTntTQTOg8LpHPNnL7n2F GgYHgLq7X65z0BtYSjQ/oQJY4HmGIxvyqeGrlPGhTYS02mPrGVFEMx434nXgg0nUP/ L1xCiS1i4UrrQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Arnd Bergmann , Ard Biesheuvel , Herbert Xu , Sasha Levin Subject: [PATCH 6.8 465/715] crypto: arm/sha - fix function cast warnings Date: Sun, 24 Mar 2024 18:30:44 -0400 Message-ID: <20240324223455.1342824-466-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Arnd Bergmann [ Upstream commit 53cc9baeb9bc2a187eb9c9790d30995148852b12 ] clang-16 warns about casting between incompatible function types: arch/arm/crypto/sha256_glue.c:37:5: error: cast from 'void (*)(u32 *, const void *, unsigned int)' (aka 'void (*)(unsigned int *, const void *, unsigned int)') to 'sha256_block_fn *' (aka 'void (*)(struct sha256_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] 37 | (sha256_block_fn *)sha256_block_data_order); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/arm/crypto/sha512-glue.c:34:3: error: cast from 'void (*)(u64 *, const u8 *, int)' (aka 'void (*)(unsigned long long *, const unsigned char *, int)') to 'sha512_block_fn *' (aka 'void (*)(struct sha512_state *, const unsigned char *, int)') converts to incompatible function type [-Werror,-Wcast-function-type-strict] 34 | (sha512_block_fn *)sha512_block_data_order); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix the prototypes for the assembler functions to match the typedef. The code already relies on the digest being the first part of the state structure, so there is no change in behavior. Fixes: c80ae7ca3726 ("crypto: arm/sha512 - accelerated SHA-512 using ARM generic ASM and NEON") Fixes: b59e2ae3690c ("crypto: arm/sha256 - move SHA-224/256 ASM/NEON implementation to base layer") Signed-off-by: Arnd Bergmann Reviewed-by: Ard Biesheuvel Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- arch/arm/crypto/sha256_glue.c | 13 +++++-------- arch/arm/crypto/sha512-glue.c | 12 +++++------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/arch/arm/crypto/sha256_glue.c b/arch/arm/crypto/sha256_glue.c index 433ee4ddce6c8..f85933fdec75f 100644 --- a/arch/arm/crypto/sha256_glue.c +++ b/arch/arm/crypto/sha256_glue.c @@ -24,8 +24,8 @@ #include "sha256_glue.h" -asmlinkage void sha256_block_data_order(u32 *digest, const void *data, - unsigned int num_blks); +asmlinkage void sha256_block_data_order(struct sha256_state *state, + const u8 *data, int num_blks); int crypto_sha256_arm_update(struct shash_desc *desc, const u8 *data, unsigned int len) @@ -33,23 +33,20 @@ int crypto_sha256_arm_update(struct shash_desc *desc, const u8 *data, /* make sure casting to sha256_block_fn() is safe */ BUILD_BUG_ON(offsetof(struct sha256_state, state) != 0); - return sha256_base_do_update(desc, data, len, - (sha256_block_fn *)sha256_block_data_order); + return sha256_base_do_update(desc, data, len, sha256_block_data_order); } EXPORT_SYMBOL(crypto_sha256_arm_update); static int crypto_sha256_arm_final(struct shash_desc *desc, u8 *out) { - sha256_base_do_finalize(desc, - (sha256_block_fn *)sha256_block_data_order); + sha256_base_do_finalize(desc, sha256_block_data_order); return sha256_base_finish(desc, out); } int crypto_sha256_arm_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { - sha256_base_do_update(desc, data, len, - (sha256_block_fn *)sha256_block_data_order); + sha256_base_do_update(desc, data, len, sha256_block_data_order); return crypto_sha256_arm_final(desc, out); } EXPORT_SYMBOL(crypto_sha256_arm_finup); diff --git a/arch/arm/crypto/sha512-glue.c b/arch/arm/crypto/sha512-glue.c index 0635a65aa488b..1be5bd498af36 100644 --- a/arch/arm/crypto/sha512-glue.c +++ b/arch/arm/crypto/sha512-glue.c @@ -25,27 +25,25 @@ MODULE_ALIAS_CRYPTO("sha512"); MODULE_ALIAS_CRYPTO("sha384-arm"); MODULE_ALIAS_CRYPTO("sha512-arm"); -asmlinkage void sha512_block_data_order(u64 *state, u8 const *src, int blocks); +asmlinkage void sha512_block_data_order(struct sha512_state *state, + u8 const *src, int blocks); int sha512_arm_update(struct shash_desc *desc, const u8 *data, unsigned int len) { - return sha512_base_do_update(desc, data, len, - (sha512_block_fn *)sha512_block_data_order); + return sha512_base_do_update(desc, data, len, sha512_block_data_order); } static int sha512_arm_final(struct shash_desc *desc, u8 *out) { - sha512_base_do_finalize(desc, - (sha512_block_fn *)sha512_block_data_order); + sha512_base_do_finalize(desc, sha512_block_data_order); return sha512_base_finish(desc, out); } int sha512_arm_finup(struct shash_desc *desc, const u8 *data, unsigned int len, u8 *out) { - sha512_base_do_update(desc, data, len, - (sha512_block_fn *)sha512_block_data_order); + sha512_base_do_update(desc, data, len, sha512_block_data_order); return sha512_arm_final(desc, out); } -- 2.43.0