1 #!/bin/sh 2 # 3 # Copyright 2022-2025 The OpenSSL Project Authors. All Rights Reserved. 4 # 5 # Licensed under the Apache License 2.0 (the "License"). You may not use 6 # this file except in compliance with the License. You can obtain a copy 7 # in the file LICENSE in the source distribution or at 8 # https://www.openssl.org/source/license.html 9 10 # 11 # OpenSSL external testing using the OQS provider 12 # 13 set -e 14 15 PWD="$(pwd)" 16 17 SRCTOP="$(cd $SRCTOP; pwd)" 18 BLDTOP="$(cd $BLDTOP; pwd)" 19 20 if [ "$SRCTOP" != "$BLDTOP" ] ; then 21 echo "Out of tree builds not supported with oqsprovider test!" 22 exit 1 23 fi 24 25 O_EXE="$BLDTOP/apps" 26 O_BINC="$BLDTOP/include" 27 O_SINC="$SRCTOP/include" 28 O_LIB="$BLDTOP" 29 30 unset OPENSSL_CONF 31 32 export PATH="$O_EXE:$PATH" 33 export LD_LIBRARY_PATH="$O_LIB:$LD_LIBRARY_PATH" 34 export OPENSSL_ROOT_DIR="$O_LIB" 35 36 # Check/Set openssl version 37 OPENSSL_VERSION=`openssl version | cut -f 2 -d ' '` 38 39 echo "------------------------------------------------------------------" 40 echo "Testing OpenSSL using oqsprovider:" 41 echo " CWD: $PWD" 42 echo " SRCTOP: $SRCTOP" 43 echo " BLDTOP: $BLDTOP" 44 echo " OPENSSL_ROOT_DIR: $OPENSSL_ROOT_DIR" 45 echo " OpenSSL version: $OPENSSL_VERSION" 46 echo "------------------------------------------------------------------" 47 48 if [ ! -d $SRCTOP/oqs-provider/.local ]; then 49 # this version of oqsprovider dependent on v0.11.0 of liboqs, so set this; 50 # also be sure to use this openssl for liboqs-internal OpenSSL use; 51 # see all libops config options listed at 52 # https://github.com/open-quantum-safe/liboqs/wiki/Customizing-liboqs 53 ( 54 cd $SRCTOP/oqs-provider \ 55 && git clone --depth 1 --branch 0.11.0 https://github.com/open-quantum-safe/liboqs.git \ 56 && cd liboqs \ 57 && mkdir build \ 58 && cd build \ 59 && cmake -DOPENSSL_ROOT_DIR=$OPENSSL_ROOT_DIR -DCMAKE_INSTALL_PREFIX=$SRCTOP/oqs-provider/.local .. \ 60 && make \ 61 && make install 62 ) 63 fi 64 65 echo " CWD: $PWD" 66 liboqs_DIR=$SRCTOP/oqs-provider/.local cmake $SRCTOP/oqs-provider -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" -B _build && cmake --build _build 67 export CTEST_OUTPUT_ON_FAILURE=1 68 export HARNESS_OSSL_PREFIX='' 69 export OPENSSL_APP="$O_EXE/openssl" 70 export OPENSSL_MODULES=$PWD/_build/lib 71 export OQS_PROVIDER_TESTSCRIPTS=$SRCTOP/oqs-provider/scripts 72 export OPENSSL_CONF=$OQS_PROVIDER_TESTSCRIPTS/openssl-ca.cnf 73 # hotfix for wrong cert validity period 74 cp $SRCTOP/test/recipes/95-test_external_oqsprovider_data/oqsprovider-ca.sh $SRCTOP/oqs-provider/scripts/ 75 # Be verbose if harness is verbose: 76 $SRCTOP/oqs-provider/scripts/runtests.sh -V 77