diff options
author | tb <> | 2024-03-30 10:09:43 +0000 |
---|---|---|
committer | tb <> | 2024-03-30 10:09:43 +0000 |
commit | 54a45aee154f1fc7154beaa03d1868a514299ce4 (patch) | |
tree | 05d421377f222c58d812f06ed1bbe385661af601 /src | |
parent | ff541f229729672630c618b24bb4c738d0c0239a (diff) | |
download | openbsd-54a45aee154f1fc7154beaa03d1868a514299ce4.tar.gz openbsd-54a45aee154f1fc7154beaa03d1868a514299ce4.tar.bz2 openbsd-54a45aee154f1fc7154beaa03d1868a514299ce4.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/hidden/crypto_namespace.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/libcrypto/hidden/crypto_namespace.h b/src/lib/libcrypto/hidden/crypto_namespace.h index 5bf9b4d4da..3aec62f1f1 100644 --- a/src/lib/libcrypto/hidden/crypto_namespace.h +++ b/src/lib/libcrypto/hidden/crypto_namespace.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: crypto_namespace.h,v 1.2 2023/02/16 08:38:17 tb Exp $ */ | 1 | /* $OpenBSD: crypto_namespace.h,v 1.3 2024/03/30 10:09:43 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org> | 3 | * Copyright (c) 2016 Philip Guenther <guenther@openbsd.org> |
4 | * | 4 | * |
@@ -25,14 +25,17 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifdef LIBRESSL_NAMESPACE | 27 | #ifdef LIBRESSL_NAMESPACE |
28 | # define LCRYPTO_UNUSED(x) typeof(x) x __attribute__((deprecated)) | ||
29 | #ifdef LIBRESSL_CRYPTO_NAMESPACE | 28 | #ifdef LIBRESSL_CRYPTO_NAMESPACE |
30 | # define LCRYPTO_USED(x) __attribute__((visibility("hidden"))) \ | 29 | # define LCRYPTO_UNUSED(x) __attribute__((deprecated)) \ |
30 | __attribute__((visibility("hidden"))) \ | ||
31 | typeof(x) x asm("_lcry_"#x) | ||
32 | # define LCRYPTO_USED(x) __attribute__((visibility("hidden"))) \ | ||
31 | typeof(x) x asm("_lcry_"#x) | 33 | typeof(x) x asm("_lcry_"#x) |
32 | # define LCRYPTO_ALIAS1(pre,x) asm(".global "#pre#x"; "#pre#x" = _lcry_"#x) | 34 | # define LCRYPTO_ALIAS1(pre,x) asm(".global "#pre#x"; "#pre#x" = _lcry_"#x) |
33 | # define LCRYPTO_ALIAS(x) LCRYPTO_ALIAS1(,x); LCRYPTO_ALIAS1(_libre_,x) | 35 | # define LCRYPTO_ALIAS(x) LCRYPTO_ALIAS1(,x); LCRYPTO_ALIAS1(_libre_,x) |
34 | #else | 36 | #else |
35 | # define LCRYPTO_USED(x) typeof(x) x asm("_libre_"#x) | 37 | # define LCRYPTO_UNUSED(x) typeof(x) x __attribute__((deprecated)) |
38 | # define LCRYPTO_USED(x) typeof(x) x asm("_libre_"#x) | ||
36 | #endif | 39 | #endif |
37 | #else | 40 | #else |
38 | # define LCRYPTO_UNUSED(x) | 41 | # define LCRYPTO_UNUSED(x) |