From 40aa296759cd3801f315fc043abc67cb36a036e6 Mon Sep 17 00:00:00 2001 From: Sean Parkinson Date: Tue, 24 Nov 2026 12:40:41 +1000 Subject: [PATCH] Tests: fix build guards for client-less and TLS 1.2-only builds test_TLSX_SecureRenegotiation_parse calls the TLS 1.2 client method unguarded; wrap its client part in #ifndef NO_WOLFSSL_CLIENT so the server-side checks still run in client-less builds. test_tls_msgtype_connection_id needs TLS 1.3. Document why the hook in tests/api.c is guarded exactly as its only caller. --- tests/api.c | 3 +++ tests/api/test_tls_msgtype.c | 2 +- tests/api/test_tls_parse.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/api.c b/tests/api.c index 126f43851ce..acf6c2a87ad 100644 --- a/tests/api.c +++ b/tests/api.c @@ -5533,6 +5533,9 @@ static int test_wolfSSL_clear_chain_certs(void) return EXPECT_RESULT(); } +/* Guarded exactly as its only caller below is: the caller drives a full + * client/server handshake, so without the client this hook has no user and + * -Werror=unused-function rejects the build. */ #if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && defined(OPENSSL_EXTRA) && \ defined(KEEP_OUR_CERT) && !defined(NO_RSA) && !defined(NO_TLS) && \ !defined(NO_WOLFSSL_SERVER) && !defined(NO_WOLFSSL_CLIENT) && \ diff --git a/tests/api/test_tls_msgtype.c b/tests/api/test_tls_msgtype.c index 6371063ac0f..74cfd86f3e0 100644 --- a/tests/api/test_tls_msgtype.c +++ b/tests/api/test_tls_msgtype.c @@ -1191,7 +1191,7 @@ int test_tls_msgtype_connection_id(void) { EXPECT_DECLS; #if defined(WOLFSSL_DTLS_CID) && !defined(NO_WOLFSSL_CLIENT) && !defined(NO_TLS) && \ - defined(HAVE_TLS_EXTENSIONS) + defined(HAVE_TLS_EXTENSIONS) && defined(WOLFSSL_TLS13) WOLFSSL_CTX* ctx = NULL; WOLFSSL* ssl = NULL; byte buf[8]; diff --git a/tests/api/test_tls_parse.c b/tests/api/test_tls_parse.c index 084b23931cc..e8e1a85431e 100644 --- a/tests/api/test_tls_parse.c +++ b/tests/api/test_tls_parse.c @@ -1153,6 +1153,7 @@ int test_TLSX_SecureRenegotiation_parse(void) /* Client side response direction: *input == 2*TLS_FINISHED_SZ, but the * declared extension length disagrees with it -- length is the * second, independent half of that check. */ +#ifndef NO_WOLFSSL_CLIENT ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method()); ExpectNotNull(ctx); ssl = NULL; @@ -1183,6 +1184,7 @@ int test_TLSX_SecureRenegotiation_parse(void) } wolfSSL_free(ssl); wolfSSL_CTX_free(ctx); +#endif #endif return EXPECT_RESULT(); }