travis: Run tests against wolfSSL
authorTobias Brunner <tobias@strongswan.org>
Tue, 9 Apr 2019 08:40:54 +0000 (10:40 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 24 Apr 2019 10:26:08 +0000 (12:26 +0200)
Check for wolfssl/options.h because if it isn't included, checking other
headers will trigger a warning about hardening the wolfSSL build, which
will cause the check to fail with -Werror.

If the file doesn't exist because user_settings.h is used, the check may
be skipped by configuring with `ac_cv_header_wolfssl_options_h=yes`.

.travis.yml
configure.ac
scripts/test.sh

index 7e70df5..3a62e2c 100644 (file)
@@ -81,6 +81,8 @@ matrix:
     # the crypto plugins are build-tested with clang via "all" above
     - env: TEST=botan
     - env: TEST=botan LEAK_DETECTIVE=yes
+    - env: TEST=wolfssl
+    - env: TEST=wolfssl LEAK_DETECTIVE=yes
     - env: TEST=openssl
     - env: TEST=openssl LEAK_DETECTIVE=yes
     - env: TEST=openssl-1.0
index 08e8306..9a1c5a3 100644 (file)
@@ -1142,7 +1142,7 @@ if test x$wolfssl = xtrue; then
        AC_CHECK_LIB([$wolfssl_lib],[wolfSSL_Init],[LIBS="$LIBS"],
                [AC_MSG_ERROR([wolfSSL lib$wolfssl_lib not found])],[$DLLIB])
        AC_SUBST(WOLFSSL_LIB, [-l$wolfssl_lib])
-       AC_CHECK_HEADER([wolfssl/ssl.h],,[AC_MSG_ERROR([wolfSSL header wolfssl/ssl.h not found!])])
+       AC_CHECK_HEADER([wolfssl/options.h],,[AC_MSG_ERROR([wolfSSL header wolfssl/options.h not found!])])
 fi
 
 if test x$gcrypt = xtrue; then
index b958db1..0f206b3 100755 (executable)
@@ -34,6 +34,33 @@ build_botan()
        cd -
 }
 
+build_wolfssl()
+{
+       WOLFSSL_REV=v4.0.0-stable
+       WOLFSSL_DIR=$TRAVIS_BUILD_DIR/../wolfssl
+
+       if test -d "$WOLFSSL_DIR"; then
+               return
+       fi
+
+       echo "$ build_wolfssl()"
+
+       WOLFSSL_CFLAGS="-DWOLFSSL_PUBLIC_MP -DWOLFSSL_DES_ECB"
+       WOLFSSL_CONFIG="--enable-keygen --enable-rsapss --enable-aesccm
+                                       --enable-aesctr --enable-des3 --enable-camellia
+                                       --enable-curve25519 --enable-ed25519"
+
+       git clone https://github.com/wolfSSL/wolfssl.git $WOLFSSL_DIR &&
+       cd $WOLFSSL_DIR &&
+       git checkout -qf $WOLFSSL_REV &&
+       ./autogen.sh &&
+       ./configure C_EXTRA_FLAGS="$WOLFSSL_CFLAGS" $WOLFSSL_CONFIG &&
+       make -j4 >/dev/null &&
+       sudo make install >/dev/null &&
+       sudo ldconfig || exit $?
+       cd -
+}
+
 build_tss2()
 {
        TSS2_REV=2.1.0
@@ -135,6 +162,14 @@ botan)
                build_botan
        fi
        ;;
+wolfssl)
+       CONFIG="--disable-defaults --enable-pki --enable-wolfssl --enable-pem"
+       # build with custom options to enable all the features the plugin supports
+       DEPS=""
+       if test "$1" = "deps"; then
+               build_wolfssl
+       fi
+       ;;
 printf-builtin)
        CONFIG="--with-printf-hooks=builtin"
        ;;
@@ -161,6 +196,7 @@ all|coverage|sonarcloud)
        PYDEPS="pytest"
        if test "$1" = "deps"; then
                build_botan
+               build_wolfssl
                build_tss2
        fi
        use_custom_openssl $1