Skip to content

Commit 33cb77a

Browse files
authored
cmake: limit GENERAL_NAME bssl probe (#13008)
CMake can report HAVE_GENERAL_NAME_IN_BSSL_NAMESPACE on plain OpenSSL builds. In a build, the probe succeeded with OpenSSL 3.x even though SSLLIB_IS_BORINGSSL and SSLLIB_IS_AWSLC were both false. That made OCSP stapling in src/iocore/net/OCSPStapling.cc take the bssl::GENERAL_NAME path, and the final traffic_server link failed with an undefined reference to bssl::GENERAL_NAME_it(). The probe is not safe to run for non-BoringSSL libraries. OpenSSL 3.x headers allow bssl::GENERAL_NAME_it() to be declared syntactically, but libcrypto only exports the global GENERAL_NAME_it symbol, so a compile-only try_compile can false-positive. Only run the probe for BoringSSL-family builds and force the cache entry off for plain OpenSSL builds.
1 parent 3e5eff6 commit 33cb77a

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

CMakeLists.txt

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -593,19 +593,28 @@ check_cxx_source_compiles(
593593
}"
594594
HAVE_CRYPTO_EX_DUP_TYPE1
595595
)
596-
check_cxx_source_compiles(
597-
"#include <openssl/asn1.h>
598-
namespace bssl {
599-
DECLARE_ASN1_ITEM(GENERAL_NAME)
600-
};
601-
int main() {
602-
if (&bssl::GENERAL_NAME_it == reinterpret_cast<void *>(0x01)) {
603-
return 1;
604-
}
605-
return 0;
606-
}"
607-
HAVE_GENERAL_NAME_IN_BSSL_NAMESPACE
608-
)
596+
if(SSLLIB_IS_BORINGSSL OR SSLLIB_IS_AWSLC)
597+
check_cxx_source_compiles(
598+
"#include <openssl/asn1.h>
599+
namespace bssl {
600+
DECLARE_ASN1_ITEM(GENERAL_NAME)
601+
};
602+
int main() {
603+
if (&bssl::GENERAL_NAME_it == reinterpret_cast<void *>(0x01)) {
604+
return 1;
605+
}
606+
return 0;
607+
}"
608+
HAVE_GENERAL_NAME_IN_BSSL_NAMESPACE
609+
)
610+
else()
611+
# This probe is only meaningful for BoringSSL-family libraries. Force it off
612+
# for OpenSSL so a stale cache or macro shape change can't enable bssl:: code.
613+
set(HAVE_GENERAL_NAME_IN_BSSL_NAMESPACE
614+
FALSE
615+
CACHE INTERNAL "GENERAL_NAME lives in the bssl namespace" FORCE
616+
)
617+
endif()
609618

610619
set(CMAKE_EXTRA_INCLUDE_FILES netinet/in.h netinet/tcp.h)
611620
check_type_size("struct tcp_info" STRUCT_TCP_INFO)

0 commit comments

Comments
 (0)