Skip to content

Commit 7719ffc

Browse files
committed
Add wolfSSL config checks
1 parent 2f1d2df commit 7719ffc

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

tls/client-tls13-certauth-c2s.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
/* This example showcases the usage of the TLS 1.3 certificate_authorities
2323
* extension in the ClientHello message, to indicate to the server which
2424
* certificate authorities the client supports, guiding certificate selection.
25+
*
26+
* Example wolfSSL config for this example: ./configure --enable-opensslall
2527
*/
2628

2729
/* the usual suspects */
@@ -52,7 +54,13 @@
5254
int main(int argc, char** argv)
5355
{
5456
int ret = 0;
55-
#ifdef WOLFSSL_TLS13
57+
#if !defined(NO_WOLFSSL_CLIENT) && !defined(NO_WOLFSSL_SERVER) && \
58+
!defined(WOLFSSL_NO_CA_NAMES) && !defined(NO_CERTS) && \
59+
defined(WOLFSSL_TLS13) && (defined(OPENSSL_EXTRA) || \
60+
defined(OPENSSL_EXTRA_X509_SMALL)) && (defined(OPENSSL_ALL) || \
61+
defined(WOLFSSL_NGINX) || defined(HAVE_LIGHTY)) && \
62+
LIBWOLFSSL_VERSION_HEX > 0x05008002
63+
5664
int sockfd = SOCKET_INVALID;
5765
struct sockaddr_in servAddr;
5866
char buff[256];
@@ -207,7 +215,7 @@ int main(int argc, char** argv)
207215
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
208216
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
209217
#else
210-
printf("Example requires TLS v1.3\n");
218+
printf("Example requires specific wolfSSL features\n");
211219
#endif
212220
(void)argc;
213221
(void)argv;

tls/server-tls13-certauth-c2s.c

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
/* This example showcases the usage of the TLS 1.3 certificate_authorities
2323
* extension in the ClientHello message, to indicate to the server which
2424
* certificate authorities the client supports, guiding certificate selection.
25+
*
26+
* Example wolfSSL config for this example: ./configure --enable-opensslall
2527
*/
2628

2729
/* the usual suspects */
@@ -54,6 +56,12 @@
5456
#define KEY_FILE "../certs/server-key.pem"
5557
#define CA_FILE "../certs/client-cert.pem"
5658

59+
#if !defined(NO_WOLFSSL_CLIENT) && !defined(NO_WOLFSSL_SERVER) && \
60+
!defined(WOLFSSL_NO_CA_NAMES) && !defined(NO_CERTS) && \
61+
defined(WOLFSSL_TLS13) && (defined(OPENSSL_EXTRA) || \
62+
defined(OPENSSL_EXTRA_X509_SMALL)) && (defined(OPENSSL_ALL) || \
63+
defined(WOLFSSL_NGINX) || defined(HAVE_LIGHTY)) && \
64+
LIBWOLFSSL_VERSION_HEX > 0x05008002
5765

5866
static int mSockfd = SOCKET_INVALID;
5967
static int mConnd = SOCKET_INVALID;
@@ -138,11 +146,18 @@ static int cert_setup_callback(WOLFSSL *ssl, void *_arg) {
138146
}
139147
return 1;
140148
}
149+
#endif
141150

142151
int main(int argc, char** argv)
143152
{
144153
int ret = 0;
145-
#ifdef WOLFSSL_TLS13
154+
#if !defined(NO_WOLFSSL_CLIENT) && !defined(NO_WOLFSSL_SERVER) && \
155+
!defined(WOLFSSL_NO_CA_NAMES) && !defined(NO_CERTS) && \
156+
defined(WOLFSSL_TLS13) && (defined(OPENSSL_EXTRA) || \
157+
defined(OPENSSL_EXTRA_X509_SMALL)) && (defined(OPENSSL_ALL) || \
158+
defined(WOLFSSL_NGINX) || defined(HAVE_LIGHTY)) && \
159+
LIBWOLFSSL_VERSION_HEX > 0x05008002
160+
146161
struct sockaddr_in servAddr;
147162
struct sockaddr_in clientAddr;
148163
socklen_t size = sizeof(clientAddr);
@@ -319,7 +334,7 @@ int main(int argc, char** argv)
319334
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
320335

321336
#else
322-
printf("Example requires TLS v1.3\n");
337+
printf("Example requires specific wolfSSL features\n");
323338
#endif /* WOLFSSL_TLS13 */
324339

325340
(void)argc;

0 commit comments

Comments
 (0)