From nobody Wed Oct 8 10:00:54 2025 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 B95AA2BD5AB; Mon, 30 Jun 2025 16:05:29 +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=1751299529; cv=none; b=OSpSgpcWVM6Yqk8hRbChkPZGshW2FudL9qXdJj2rk3aJAC4NBStB28WE78/kVJWpkfUkXHPtGCKvt1OUKbzZSNcxI9prQIFaXKK9tfe8cYlonHuIN47At8e57XNeNFS6BqYlbYdoisEpYcFsw1VkaYaX7pGnRQaWHHf+GJVK3PA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751299529; c=relaxed/simple; bh=Re8d5TuPUDJdqxyH89C7qlYblbZnrA5EjF86KsH1XwY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bCupi5/YrAnmdOaaKnBw22Da6MA5Z5mKy+kRF8lgcZ1mcYDeqlud4sVwlv9TSxIoY8z5S5hlispsx3d9DkSGkMcmAC65KWiD2gOg4VW9f9IP2Nb2XWExw+3O+j3FV/5Tuw21+q+78755UQmXtmGhNc7+1T+WGiHPEmlqRuKdjps= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=No3QeIRm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="No3QeIRm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AA2BC4CEF2; Mon, 30 Jun 2025 16:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751299529; bh=Re8d5TuPUDJdqxyH89C7qlYblbZnrA5EjF86KsH1XwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=No3QeIRmm7nlNERtKsn+ZyD7ApGiWkaIJk7FG/8b02RBvVt8BnEm4mMr1kGFRguX7 bZse8gOMDl2RguH9Al5RMXRfo4nMMB50ohKZVkdfhLnFRIrOxW9gvzUC+n00XH0+iY 9TH1JM6PrKklHfOntc9odhZozTrfFL7mhOzBliq2FCV5TlP968eIkkL1Ao0AXuC2Xd aiiB+i1f+mH0ulGtZTu7oHtA749yaAWdo2f/7TRILzujisMvwU7MP9ogNQ3M17vTMJ 4Qx9NLxIq4BVav5bn31e4LZnHmRGclQY/IXM+CjEJBahQ5XnqBxt8dyb/U4BzbSsRz tM1D5LSdhxLZg== From: Eric Biggers To: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org, Ard Biesheuvel , "Jason A . Donenfeld" , Eric Biggers Subject: [PATCH v3 16/16] crypto: sha512 - Remove sha512_base.h Date: Mon, 30 Jun 2025 09:03:20 -0700 Message-ID: <20250630160320.2888-17-ebiggers@kernel.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250630160320.2888-1-ebiggers@kernel.org> References: <20250630160320.2888-1-ebiggers@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" sha512_base.h is no longer used, so remove it. Acked-by: Ard Biesheuvel Signed-off-by: Eric Biggers --- include/crypto/sha512_base.h | 117 ----------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 include/crypto/sha512_base.h diff --git a/include/crypto/sha512_base.h b/include/crypto/sha512_base.h deleted file mode 100644 index d1361b3eb70b0..0000000000000 --- a/include/crypto/sha512_base.h +++ /dev/null @@ -1,117 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * sha512_base.h - core logic for SHA-512 implementations - * - * Copyright (C) 2015 Linaro Ltd - */ - -#ifndef _CRYPTO_SHA512_BASE_H -#define _CRYPTO_SHA512_BASE_H - -#include -#include -#include -#include -#include -#include -#include - -typedef void (sha512_block_fn)(struct sha512_state *sst, u8 const *src, - int blocks); - -static inline int sha384_base_init(struct shash_desc *desc) -{ - struct sha512_state *sctx =3D shash_desc_ctx(desc); - - sctx->state[0] =3D SHA384_H0; - sctx->state[1] =3D SHA384_H1; - sctx->state[2] =3D SHA384_H2; - sctx->state[3] =3D SHA384_H3; - sctx->state[4] =3D SHA384_H4; - sctx->state[5] =3D SHA384_H5; - sctx->state[6] =3D SHA384_H6; - sctx->state[7] =3D SHA384_H7; - sctx->count[0] =3D sctx->count[1] =3D 0; - - return 0; -} - -static inline int sha512_base_init(struct shash_desc *desc) -{ - struct sha512_state *sctx =3D shash_desc_ctx(desc); - - sctx->state[0] =3D SHA512_H0; - sctx->state[1] =3D SHA512_H1; - sctx->state[2] =3D SHA512_H2; - sctx->state[3] =3D SHA512_H3; - sctx->state[4] =3D SHA512_H4; - sctx->state[5] =3D SHA512_H5; - sctx->state[6] =3D SHA512_H6; - sctx->state[7] =3D SHA512_H7; - sctx->count[0] =3D sctx->count[1] =3D 0; - - return 0; -} - -static inline int sha512_base_do_update_blocks(struct shash_desc *desc, - const u8 *data, - unsigned int len, - sha512_block_fn *block_fn) -{ - unsigned int remain =3D len - round_down(len, SHA512_BLOCK_SIZE); - struct sha512_state *sctx =3D shash_desc_ctx(desc); - - len -=3D remain; - sctx->count[0] +=3D len; - if (sctx->count[0] < len) - sctx->count[1]++; - block_fn(sctx, data, len / SHA512_BLOCK_SIZE); - return remain; -} - -static inline int sha512_base_do_finup(struct shash_desc *desc, const u8 *= src, - unsigned int len, - sha512_block_fn *block_fn) -{ - unsigned int bit_offset =3D SHA512_BLOCK_SIZE / 8 - 2; - struct sha512_state *sctx =3D shash_desc_ctx(desc); - union { - __be64 b64[SHA512_BLOCK_SIZE / 4]; - u8 u8[SHA512_BLOCK_SIZE * 2]; - } block =3D {}; - - if (len >=3D SHA512_BLOCK_SIZE) { - int remain; - - remain =3D sha512_base_do_update_blocks(desc, src, len, block_fn); - src +=3D len - remain; - len =3D remain; - } - - if (len >=3D bit_offset * 8) - bit_offset +=3D SHA512_BLOCK_SIZE / 8; - memcpy(&block, src, len); - block.u8[len] =3D 0x80; - sctx->count[0] +=3D len; - block.b64[bit_offset] =3D cpu_to_be64(sctx->count[1] << 3 | - sctx->count[0] >> 61); - block.b64[bit_offset + 1] =3D cpu_to_be64(sctx->count[0] << 3); - block_fn(sctx, block.u8, (bit_offset + 2) * 8 / SHA512_BLOCK_SIZE); - memzero_explicit(&block, sizeof(block)); - - return 0; -} - -static inline int sha512_base_finish(struct shash_desc *desc, u8 *out) -{ - unsigned int digest_size =3D crypto_shash_digestsize(desc->tfm); - struct sha512_state *sctx =3D shash_desc_ctx(desc); - __be64 *digest =3D (__be64 *)out; - int i; - - for (i =3D 0; digest_size > 0; i++, digest_size -=3D sizeof(__be64)) - put_unaligned_be64(sctx->state[i], digest++); - return 0; -} - -#endif /* _CRYPTO_SHA512_BASE_H */ --=20 2.50.0