Skip to content

Commit

Permalink
simple_http: Convert to WolfSSL
Browse files Browse the repository at this point in the history
Fully convert to WolfSSL as recent version of WolfSSL dropped the
support shims for CyaSSL.

Travis.yml scripts updated to use and cache the new WolfSSL library.

Signed-off-by: Christian Marangi <[email protected]>
  • Loading branch information
Ansuel committed Dec 14, 2023
1 parent d7b9a21 commit 6a18258
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
- secure: fiVVKcMM8Cz8WAj6PB6eD/b+Y77klXOe9jbpehf6QwjFwf6paEHoMsrZ0aFXogm2Uej47GlTdRb3UkBqonbK4ANbu0ewsWCW0RGClZz5ghaSnfwdxEhuXsrFIax7DvJCStk2V84Keb+tSVemx4opxqZAlZ/Nen28S91KSDoJeRA=
matrix:
- BUILD_TYPE=normal
- CYASSL="3.3.2" BUILD_TYPE=cyassl
- WOLFSSL="5.6.4" BUILD_TYPE=wolfssl
cache:
directories:
- dependencies-src
Expand Down
38 changes: 19 additions & 19 deletions .travis_configure_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,47 @@ if [[ "$BUILD_TYPE" == "normal" ]]; then
echo "Running Wifidog configure"
./configure $@

elif [[ "$BUILD_TYPE" == "cyassl" ]]; then
if [[ -z "$CYASSL" ]]; then
echo "CYASSL not set."
elif [[ "$BUILD_TYPE" == "wolfssl" ]]; then
if [[ -z "$WOLFSSL" ]]; then
echo "WOLFSSL not set."
exit 1
fi
CUR=`pwd`
mkdir -p dependencies-src || true
mkdir -p dependencies-installed || true
if [[ ! -f dependencies-installed/include/cyassl/ssl.h ]]; then
echo "Cached CyaSSL install not found. Installing."
if [[ ! -f dependencies-installed/include/wolfssl/ssl.h ]]; then
echo "Cached WolfSSL install not found. Installing."
cd dependencies-src
# Check if travis cache is there
if [[ -f cyassl-${CYASSL}/autogen.sh ]]; then
echo "Found cached CyaSSL package"
if [[ -f wolfssl-${WOLFSSL}/autogen.sh ]]; then
echo "Found cached WolfSSL package"
else
echo "No cache, downloading CyaSSL"
wget https://github.com/cyassl/cyassl/archive/v${CYASSL}.tar.gz \
-O cyassl-${CYASSL}.tar.gz
tar -xzf cyassl-${CYASSL}.tar.gz
echo "No cache, downloading WolfSSL"
wget https://github.com/wolfSSL/wolfssl/archive/v${WOLFSSL}-stable.tar.gz \
-O wolfssl-${WOLFSSL}.tar.gz
tar -xzf wolfssl-${WOLFSSL}.tar.gz
fi
cd cyassl-${CYASSL}
echo "Content of cyassl-${CYASSL}:"
cd wolfssl-${WOLFSSL}
echo "Content of wolfssl-${WOLFSSL}:"
ls
echo "Running CyaSSL autogen.sh"
echo "Running WolfSSL autogen.sh"
./autogen.sh
echo "Running CyaSSL configure"
echo "Running WolfSSL configure"
./configure --prefix="$CUR"/dependencies-installed/ --enable-ecc
# make will pick up the cached object files - real savings
# happen here
echo "Running CyaSSL make"
echo "Running WolfSSL make"
make
echo "Running CyaSSL make install"
echo "Running WolfSSL make install"
make install
cd "$CUR"
else
echo "Cached CyaSSL install found."
echo "Cached WolfSSL install found."
fi
echo "Running Wifidog configure"
export CFLAGS="-I${CUR}/dependencies-installed/include/"
export LDFLAGS="-L${CUR}/dependencies-installed/lib/"
./configure --enable-cyassl $@
./configure --enable-wolfssl $@
else
echo "Unknow BUILD_TYPE $BUILD_TYPE"
exit 1
Expand Down
45 changes: 21 additions & 24 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -85,48 +85,45 @@ AC_SUBST(enable_latex_docs)
# Acutally perform the doxygen check
BB_ENABLE_DOXYGEN

# Enable cyassl?
AC_DEFUN([BB_CYASSL],
# Enable wolfssl?
AC_DEFUN([BB_WOLFSSL],
[
AC_ARG_ENABLE(cyassl, [ --enable-cyassl enable TLS support for auth server communication (no)], [], [enable_cyassl=no])
if test "x$enable_cyassl" = xyes; then
# CyaSSL has been renamed wolfSSL. Old method names are still available
# via cyassl/ssl.h, which maps old methods to new methods via macros.
# To find the proper lib to link against (cyassl or wolfssl), we do have
# the use the new naming scheme below as cyassl/ssl.h is not available for
# AC_SEARCH_LIBS
AC_CHECK_HEADERS(cyassl/ssl.h)
AC_SEARCH_LIBS([CyaTLSv1_client_method], [cyassl], [], [
AC_SEARCH_LIBS([wolfTLSv1_client_method], [wolfssl], [], [
AC_MSG_ERROR([unable to locate SSL lib: either wolfSSL or CyaSSL needed.])
])
AC_ARG_ENABLE(wolfssl, [ --enable-wolfssl enable TLS support for auth server communication (no)], [], [enable_wolfssl=no])
if test "x$enable_wolfssl" = xyes; then
AC_CHECK_HEADERS(wolfssl/ssl.h, [], [],
[
#include <wolfssl/options.h>
])
AC_SEARCH_LIBS([wolfTLSv1_client_method], [wolfssl], [], [
AC_MSG_ERROR([unable to locate SSL lib: wolfSSL needed.])
])
AC_MSG_CHECKING([for the CyaSSL SNI enabled])
AC_MSG_CHECKING([for the Wolfssl SNI enabled])
AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[
#define HAVE_SNI
#include <cyassl/ssl.h>
#include <wolfssl/options.h>
#include <wolfssl/ssl.h>
]], [[
CYASSL_CTX *ctx;
CyaSSL_Init();
ctx = CyaSSL_CTX_new(CyaTLSv1_client_method());
CyaSSL_CTX_UseSNI(ctx, CYASSL_SNI_HOST_NAME, "wifidog.org", 11);
WOLFSSL_CTX *ctx;
wolfSSL_Init();
ctx = wolfSSL_CTX_new(wolfTLSv1_client_method());
wolfSSL_CTX_UseSNI(ctx, WOLFSSL_SNI_HOST_NAME, "wifidog.org", 11);
]])], [enabled_sni=yes], [enabled_sni=no])
if test "x$enabled_sni" = xyes; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_SNI],, "Compile with CyaSSL SNI support")
AC_DEFINE([HAVE_SNI],, "Compile with wolfssl SNI support")
else
AC_MSG_RESULT([no])
fi
AC_DEFINE(USE_CYASSL,, "Compile with CyaSSL support")
AC_DEFINE(USE_WOLFSSL,, "Compile with wolfssl support")
fi
])

# Actually perform the cyassl check
BB_CYASSL
# Actually perform the wolfssl check
BB_WOLFSSL



Expand Down
Loading

0 comments on commit 6a18258

Please sign in to comment.