summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-03-30 10:09:44 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-03-30 10:09:44 +0000
commitb9c2d55594d9c97830c7e806e1beaaaf31713f2e (patch)
treee50d9b431d07e88c6d2e3528c68725d51795095d
parent69e2b467f5b8b9518008b358c7d1d0cd5bf019dd (diff)
Fix LCRYPTO_UNUSED() in namespace builds
If namespace builds are enabled, static links don't work due to missing _lcry_* symbols. Make LCRYPTO_UNUSED() match LCRYPTO_USED() with an extra deprecated attribute. This way we can remove the !LIBRESSL_INTERNAL #ifdef wrapping in public headers. ok beck joshua
-rw-r--r--lib/libcrypto/hidden/crypto_namespace.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libcrypto/hidden/crypto_namespace.h b/lib/libcrypto/hidden/crypto_namespace.h
index 5bf9b4d4da7..3aec62f1f14 100644
--- a/lib/libcrypto/hidden/crypto_namespace.h
+++ b/lib/libcrypto/hidden/crypto_namespace.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: crypto_namespace.h,v 1.2 2023/02/16 08:38:17 tb Exp $ */
+/* $OpenBSD: crypto_namespace.h,v 1.3 2024/03/30 10:09:43 tb Exp $ */
/*
* Copyright (c) 2016 Philip Guenther <guenther@openbsd.org>
*
@@ -25,14 +25,17 @@
*/
#ifdef LIBRESSL_NAMESPACE
-# define LCRYPTO_UNUSED(x) typeof(x) x __attribute__((deprecated))
#ifdef LIBRESSL_CRYPTO_NAMESPACE
-# define LCRYPTO_USED(x) __attribute__((visibility("hidden"))) \
+# define LCRYPTO_UNUSED(x) __attribute__((deprecated)) \
+ __attribute__((visibility("hidden"))) \
+ typeof(x) x asm("_lcry_"#x)
+# define LCRYPTO_USED(x) __attribute__((visibility("hidden"))) \
typeof(x) x asm("_lcry_"#x)
# define LCRYPTO_ALIAS1(pre,x) asm(".global "#pre#x"; "#pre#x" = _lcry_"#x)
# define LCRYPTO_ALIAS(x) LCRYPTO_ALIAS1(,x); LCRYPTO_ALIAS1(_libre_,x)
#else
-# define LCRYPTO_USED(x) typeof(x) x asm("_libre_"#x)
+# define LCRYPTO_UNUSED(x) typeof(x) x __attribute__((deprecated))
+# define LCRYPTO_USED(x) typeof(x) x asm("_libre_"#x)
#endif
#else
# define LCRYPTO_UNUSED(x)