Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2496782lqp; Sun, 24 Mar 2024 23:40:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV6ewc7TwSV0XmvEXC8iu/bozTLrRkeVimsg7b8FMz57QGr6KYyQn85OOxhZo4GlPrJc8xT0+Pzx/qted7N60eaV+Zx/8AGtvwc4EXRcw== X-Google-Smtp-Source: AGHT+IGK0M85N66/KUHyFESRCfsbSrddFPME5lbowXMBVelVc11doHmI6R3F6iIGFpbLqyjKgeEs X-Received: by 2002:a17:90a:b881:b0:2a0:486e:780a with SMTP id o1-20020a17090ab88100b002a0486e780amr4228638pjr.15.1711348846830; Sun, 24 Mar 2024 23:40:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711348846; cv=pass; d=google.com; s=arc-20160816; b=vhgmgXHqQgnm71RcZ9Ga71q47fcB2KGfSuS4QFRe48f+I0QiMlaY96wO5uEp3TO1+I wCcVrWYdjmuEuxn7Ebx3Fxht2TNIa97kRMFsQD9m6T7ORJz2LgVn/awDStfs3jVqIfWC tgztPuWFvV3YQVJUyh6nCY3taV/DRcUR01eIdXkBhkPRvGqWDp3GOZhyCPDUCvHAJg1Q ucKbvsuMr6REXojZ8wi9EtFRxyP4tB44mwgOvoIRcS7/dR7deXOf83HVi97CKKIXu0+U VdwirwfsxzuTizNadlUY6+h7Xx2YrYZyHYT5Y5TeBgpcqUYVb/r8LUgDJr0itSkVatwM WWsg== 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=yB3HnCjozkF3oc2xi8GdkHnB+HTnIhJ3OWrfUHY95xnvFiqMICmcIgVtWQG5rAv8EJ oEiBfvpB9t+5IZfm9UYg/v7bjuKADL/nhRctXjEnp3Sqw0jJLjCfuDrxZyM4+RJhBNQy EdG+1ZmrsTnFUEqq/ry4yR6Us12p1jf5eV4oVEaM7Yd4sZn5vfjr1liQ47FDLbF1SDb0 65MWcuZsjtxO8Ikhbdo27YWv8sDtYg3M0gMzFN1lkZnwrtU4WM7sDoZBB5ntfm98MP80 hwgAJeQs5Dh4QyrlyQtGce9YQkHpqPr/Rkm3EEAqc01bmRzGKvaYVT0CmHnJPg4QJgVS BJKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="iL//NJfC"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114578-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id f16-20020a637550000000b005dc7e78163csi6888367pgn.458.2024.03.24.23.40.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 23:40:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-114578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="iL//NJfC"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114578-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114578-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 1261BB21803 for ; Mon, 25 Mar 2024 06:18:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4761829ADF6; Sun, 24 Mar 2024 23:53:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iL//NJfC" 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 430F02308CC; Sun, 24 Mar 2024 23:17:12 +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=1711322232; cv=none; b=mkUIQskB+Rq1H2I004fnAL9A2TftDqCtxvsaX6VBksF54++7Wb0lbR9UmFsm/GZ0gArZJ3lfUqkwGIMLqws4f0f1zls4p5aOEJHFQsNmBRDQYaU5Z3qZHZSvCBOS+/Gsjc9w3oPf7D4EM4rpdps1pAVjxaBSS6CX/Bq02EpRgz0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322232; c=relaxed/simple; bh=8NG5ryWG5HYBva078aNyd9BCSi5cg3Cn9gXeZNtAs18=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J58j13ujz+Flee+PXKMh7afh4Ud5VV/R+gF9pOMkcAVpOPIm42oNbDuUconbHaE5Evh7j5WX1pa+dXCsDkzEDuz6GYkH5/ItoWw6jlLfVXSjIHH/SSp57LsZs/fOoKKPZBybqazUGtPMN6ptJAqOC1mitlxnI+7Z+CGkw2T5b58= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iL//NJfC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B8F7C43390; Sun, 24 Mar 2024 23:17:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322232; bh=8NG5ryWG5HYBva078aNyd9BCSi5cg3Cn9gXeZNtAs18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iL//NJfCOVus2AML/gOPpHH3Jojp3NFUNbUb7woeQBcL13SchEkOfFAVWFx0uV3FT zUfxeHiNgROAgGAe9QOnfTp8pYeKz07z9t7s26Xjn28ZFxBEapRdjDA1VgFL8oNbAz TgeskUHCcWnKZT0OXRSvKRkL0DV5dCyMmjh8yrgvpSWDAgLgEXY4AxAFh7vLv02Du9 EXGlTERCBc6r+cI8LSwCfoDQz15D7Qed8Brwwh9DkRx6zPKYiKfUfW5XhhuwM63GKc ZQcsoTeTp3KQ/tdVBf3uk+0w2VHEOi452xKE67H+flg92TLBgXV0qC6T8yq1Plf29H p4JKSq1Vkex+Q== 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.1 313/451] crypto: arm/sha - fix function cast warnings Date: Sun, 24 Mar 2024 19:09:49 -0400 Message-ID: <20240324231207.1351418-314-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-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