Skip to content

Commit 06538e7

Browse files
committed
Detect CyaSSL SNI enabled on build time
* Build should not failed if no CyaSSL SNI enabled.
1 parent f3d43cc commit 06538e7

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

configure.in

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,26 @@ if test "x$enable_cyassl" = xyes; then
9494
AC_SEARCH_LIBS([CyaSSLv23_client_method], [cyassl wolfssl], [], [
9595
AC_MSG_ERROR([unable to find the CyaSSLv23_client_method function.])
9696
])
97+
98+
AC_MSG_CHECKING([for the CyaSSL SNI enabled])
99+
AC_LINK_IFELSE([AC_LANG_PROGRAM(
100+
[[
101+
#define HAVE_SNI
102+
#include <cyassl/ssl.h>
103+
]], [[
104+
CYASSL_CTX *ctx;
105+
CyaSSL_Init();
106+
ctx = CyaSSL_CTX_new(CyaTLSv1_client_method());
107+
CyaSSL_CTX_UseSNI(ctx, CYASSL_SNI_HOST_NAME, "wifidog.org", 11);
108+
]])], [enabled_sni=yes], [enabled_sni=no])
109+
110+
if test "x$enabled_sni" = xyes; then
111+
AC_MSG_RESULT([yes])
112+
AC_DEFINE([HAVE_SNI],, "Compile with CyaSSL SNI support")
113+
else
114+
AC_MSG_RESULT([no])
115+
fi
116+
97117
AC_DEFINE(USE_CYASSL,, "Compile with CyaSSL support")
98118
fi
99119
])

src/conf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,10 @@ config_read(const char *filename)
803803
}
804804
#ifndef USE_CYASSL
805805
debug(LOG_WARNING, "SSLUseSNI is set but no SSL compiled in. Ignoring!");
806+
#else
807+
#ifndef HAVE_SNI
808+
debug(LOG_WARNING, "SSLUseSNI is set but no CyaSSL SNI enabled. Ignoring!");
809+
#endif
806810
#endif
807811
break;
808812
case oBadOption:

src/simple_http.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ get_cyassl_ctx(const char *hostname)
179179
}
180180
}
181181

182+
#ifdef HAVE_SNI
182183
if (config->ssl_use_sni) {
183184
debug(LOG_INFO, "Setting SSL using SNI for hostname %s",
184185
hostname);
@@ -191,6 +192,7 @@ get_cyassl_ctx(const char *hostname)
191192
return NULL;
192193
}
193194
}
195+
#endif
194196

195197
if (config->ssl_verify) {
196198
/* Use trusted certs */

0 commit comments

Comments
 (0)