All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: lib/sha1 - use __DISABLE_EXPORTS for SHA1 library
@ 2025-12-17 23:38 Ross Philipson
  2025-12-17 23:57 ` Eric Biggers
  0 siblings, 1 reply; 5+ messages in thread
From: Ross Philipson @ 2025-12-17 23:38 UTC (permalink / raw)
  To: linux-kernel, linux-crypto
  Cc: ebiggers, Jason, ardb, ross.philipson, dpsmith, kanth.ghatraju,
	andrew.cooper3, trenchboot-devel

Allow the SHA1 library code in lib/crypto/sha1.c to be used in a pre-boot
environments. Use the __DISABLE_EXPORTS macro to disable function exports and
define the proper values for that environment as was done earlier for SHA256.

This issue was brought up during the review of the Secure Launch v15 patches
that use SHA1 in a pre-boot environment (link in tags below). This is being
sent as a standalone patch to address this.

Link: https://lore.kernel.org/r/20251216002150.GA11579@quark
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Ross Philipson <ross.philipson@oracle.com>
---
 lib/crypto/sha1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/crypto/sha1.c b/lib/crypto/sha1.c
index 52788278cd17..e5a9e1361058 100644
--- a/lib/crypto/sha1.c
+++ b/lib/crypto/sha1.c
@@ -154,7 +154,7 @@ static void __maybe_unused sha1_blocks_generic(struct sha1_block_state *state,
 	memzero_explicit(workspace, sizeof(workspace));
 }
 
-#ifdef CONFIG_CRYPTO_LIB_SHA1_ARCH
+#if defined(CONFIG_CRYPTO_LIB_SHA1_ARCH) && !defined(__DISABLE_EXPORTS)
 #include "sha1.h" /* $(SRCARCH)/sha1.h */
 #else
 #define sha1_blocks sha1_blocks_generic
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-12-18 18:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-17 23:38 [PATCH] crypto: lib/sha1 - use __DISABLE_EXPORTS for SHA1 library Ross Philipson
2025-12-17 23:57 ` Eric Biggers
2025-12-18 18:25   ` ross.philipson
2025-12-18 18:35     ` Eric Biggers
2025-12-18 18:58       ` ross.philipson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.