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