From 79a7d2193256308c376413338213e769d046aeef Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 29 Jun 2023 09:26:14 -0700 Subject: [PATCH] Turn on SNI by default on hosts with resources. --- CMakeLists.txt | 9 +++++++-- configure.ac | 17 +++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cafb4a0a..51889ebec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1299,7 +1299,6 @@ endif() # - CRL monitor # - User crypto # - Whitewood netRandom client library -# - SNI # - Max fragment length # - ALPN # - Trusted CA indication @@ -1315,8 +1314,14 @@ add_option(WOLFSSL_CRL "Enable CRL (Use =io for inline CRL HTTP GET) (default: disabled)" "no" "yes;no;io") + +set(SNI_DEFAULT "no") +if(("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64|x86|AMD64|arm64") OR + ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")) + set(SNI_DEFAULT "yes") +endif() set(WOLFSSL_SNI_HELP_STRING "Enable SNI (default: disabled)") -add_option(WOLFSSL_SNI ${WOLFSSL_SNI_HELP_STRING} "no" "yes;no") +add_option(WOLFSSL_SNI ${WOLFSSL_SNI_HELP_STRING} ${SNI_DEFAULT} "yes;no") set(WOLFSSL_TLSX_HELP_STRING "Enable all TLS Extensions (default: disabled)") add_option(WOLFSSL_TLSX ${WOLFSSL_TLSX_HELP_STRING} "no" "yes;no") diff --git a/configure.ac b/configure.ac index 596117ce5..fd3e5fa9b 100644 --- a/configure.ac +++ b/configure.ac @@ -4971,21 +4971,22 @@ AC_ARG_WITH([wnr], # SNI +# enable SNI automatically for x86_64/x86/aarch64/amd64 +SNI_DEFAULT=no +if test "$host_cpu" = "x86_64" || test "$host_cpu" = "x86" || test "$host_cpu" = "aarch64" || test "$host_cpu" = "amd64" +then + SNI_DEFAULT=yes +fi AC_ARG_ENABLE([sni], - [AS_HELP_STRING([--enable-sni],[Enable SNI (default: disabled)])], + [AS_HELP_STRING([--enable-sni],[Enable SNI (default: enabled on x86_64/x86/aarch64/amd64)])], [ ENABLED_SNI=$enableval ], - [ ENABLED_SNI=no ] + [ ENABLED_SNI=$SNI_DEFAULT ] ) -if test "x$ENABLED_QT" = "xyes" +if test "x$ENABLED_QT" = "xyes" || test "$ENABLED_QUIC" = "yes" then ENABLED_SNI="yes" fi -if test "$ENABLED_QUIC" = "yes" -then - ENABLED_SNI=yes -fi - if test "x$ENABLED_SNI" = "xyes" then AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI"