Skip to content

Commit c542a6e

Browse files
committed
Follow up to r1931007: make conditional compilation more portable.
* test/test_ssl.c (test_ssl_revoked_server_cert): Move the #if outside of the macro invocation, and use OPENSSL_VERSION_PREREQ for OpenSSL 3.x checks. (test_ssl_ocsp_verify_response_no_signer): Use OPENSSL_VERSION_PREREQ. git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1931008 13f79535-47bb-0310-9956-ffa450edef68
1 parent d88238d commit c542a6e

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

test/test_ssl.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,16 +1394,22 @@ static void test_ssl_revoked_server_cert(CuTest *tc)
13941394
certificate. OpenSSL may call the application multiple times per depth,
13951395
e.g. once to tell that the cert is revoked, and a second time to tell
13961396
that the certificate itself is valid. */
1397+
#if defined(OPENSSL_VERSION_PREREQ) && OPENSSL_VERSION_PREREQ(3, 6)
1398+
/* In OpenSSL 3.6, error handling changed so that only the
1399+
first instance of CERT_UNABLE_TO_GET_CRL is reported. */
1400+
CuAssertStrEquals(tc,
1401+
"cert_cb: failures = CERT_REVOKED, cert = (CN=localhost, depth=0)\n"
1402+
"cert_cb: failures = CERT_UNABLE_TO_GET_CRL, cert = (CN=Serf CA, depth=1)\n"
1403+
"cert_cb: failures = NONE, cert = (CN=localhost, depth=0)\n",
1404+
tb->user_baton);
1405+
#else
13971406
CuAssertStrEquals(tc,
13981407
"cert_cb: failures = CERT_REVOKED, cert = (CN=localhost, depth=0)\n"
13991408
"cert_cb: failures = CERT_UNABLE_TO_GET_CRL, cert = (CN=Serf CA, depth=1)\n"
1400-
#if OPENSSL_VERSION_NUMBER < ((3 << 28) | (6 << 20)) /* OpenSSL 3.6.0 */
1401-
/* In OpenSSL 3.6, error handling changed so that only
1402-
the first CERT_UNABLE_TO_GET_CRL is reported. */
14031409
"cert_cb: failures = CERT_UNABLE_TO_GET_CRL, cert = (CN=Serf Root CA, depth=2)\n"
1404-
#endif
14051410
"cert_cb: failures = NONE, cert = (CN=localhost, depth=0)\n",
14061411
tb->user_baton);
1412+
#endif
14071413
}
14081414

14091415
/* Test if serf is sets up an SSL tunnel to the proxy and doesn't contact the
@@ -2788,7 +2794,7 @@ static void test_ssl_ocsp_verify_response_no_signer(CuTest *tc)
27882794
{
27892795
#ifndef OPENSSL_NO_OCSP
27902796
apr_status_t status = verify_ocsp_response(tc, 1, 0, 0, 0);
2791-
#if OPENSSL_VERSION_NUMBER >= (3 << 28) /* OpenSSL 3.0.0 */
2797+
#if defined(OPENSSL_VERSION_PREREQ) && OPENSSL_VERSION_PREREQ(3, 0)
27922798
/* OCSP responses MUST be signed, and on newer versions of OpenSSL we
27932799
can't even create one without a signature. This error doesn't come
27942800
from response validation but because OCSP_response_create() fails. */

0 commit comments

Comments
 (0)