Skip to content

Commit e079d20

Browse files
authored
Fix OCSP detection during build (#9754)
The configure script fails to detect OCSP support when building ATS with OpenSSL 3.0. This isn't a problem in the `master` branch, which copied OpenSSL's OCSP code into ATS itself in #9624. However, this remains a problem on existing releases and downstream packages seem to be affected by it. Here's a list of the few I checked: - Alpine - Debian 12 - Fedora 37 - Homebrew - Nixpkgs This happens because OpenSSL 3.0 made changes to its APIs that affected how ATS detects OCSP support. ATS checks the existence of a few functions, including `OCSP_REQ_CTX_add1_header` and `OCSP_REQ_CTX_set1_req`, by attempting to link to them using `AC_CHECK_FUNCS`. In OpenSSL 3.0, these functions were turned into macros making them uneligible for detection with `AC_CHECK_FUNCS`. This change fixes that problem by instead using `AC_LANG_PROGRAM` to check that code using the aforementioned functions compile. This approach works for OpenSSL both before and after 3.0.
1 parent 7226cba commit e079d20

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

build/crypto.m4

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,16 +276,23 @@ dnl
276276
dnl Since OpenSSL 1.1.0
277277
dnl
278278
AC_DEFUN([TS_CHECK_CRYPTO_OCSP], [
279+
enable_tls_ocsp=yes
279280
_ocsp_saved_LIBS=$LIBS
280281
281282
TS_ADDTO(LIBS, [$OPENSSL_LIBS])
282-
AC_CHECK_HEADERS(openssl/ocsp.h, [ocsp_have_headers=1], [enable_tls_ocsp=no])
283-
284-
if test "$ocsp_have_headers" == "1"; then
285-
AC_CHECK_FUNCS(OCSP_sendreq_new OCSP_REQ_CTX_add1_header OCSP_REQ_CTX_set1_req, [enable_tls_ocsp=yes], [enable_tls_ocsp=no])
283+
AC_LINK_IFELSE(
284+
[
285+
AC_LANG_PROGRAM([[
286+
#include <openssl/ocsp.h>
287+
]],
288+
[[
289+
OCSP_sendreq_new(NULL, NULL, NULL, 0);
290+
OCSP_REQ_CTX_add1_header(NULL, NULL, NULL);
291+
OCSP_REQ_CTX_set1_req(NULL, NULL);
292+
]])
293+
], [], [enable_tls_ocsp=no])
286294
287-
LIBS=$_ocsp_saved_LIBS
288-
fi
295+
LIBS=$_ocsp_saved_LIBS
289296
290297
AC_MSG_CHECKING(whether OCSP is supported)
291298
AC_MSG_RESULT([$enable_tls_ocsp])

0 commit comments

Comments
 (0)