oqsprovider.sh 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/sh
  2. #
  3. # Copyright 2022 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. # OpenSSL external testing using the OQS provider
  11. #
  12. set -e
  13. PWD="$(pwd)"
  14. SRCTOP="$(cd $SRCTOP; pwd)"
  15. BLDTOP="$(cd $BLDTOP; pwd)"
  16. if [ "$SRCTOP" != "$BLDTOP" ] ; then
  17. echo "Out of tree builds not supported with oqsprovider test!"
  18. exit 1
  19. fi
  20. O_EXE="$BLDTOP/apps"
  21. O_BINC="$BLDTOP/include"
  22. O_SINC="$SRCTOP/include"
  23. O_LIB="$BLDTOP"
  24. unset OPENSSL_CONF
  25. export PATH="$O_EXE:$PATH"
  26. export LD_LIBRARY_PATH="$O_LIB:$LD_LIBRARY_PATH"
  27. export OPENSSL_ROOT_DIR="$O_LIB"
  28. # Check/Set openssl version
  29. OPENSSL_VERSION=`openssl version | cut -f 2 -d ' '`
  30. echo "------------------------------------------------------------------"
  31. echo "Testing OpenSSL using oqsprovider:"
  32. echo " CWD: $PWD"
  33. echo " SRCTOP: $SRCTOP"
  34. echo " BLDTOP: $BLDTOP"
  35. echo " OPENSSL_ROOT_DIR: $OPENSSL_ROOT_DIR"
  36. echo " OpenSSL version: $OPENSSL_VERSION"
  37. echo "------------------------------------------------------------------"
  38. if [ ! -d $SRCTOP/oqs-provider/oqs ]; then
  39. # disable rainbow family by default; all further config options listed at
  40. # https://github.com/open-quantum-safe/liboqs/wiki/Customizing-liboqs
  41. (
  42. cd $SRCTOP/oqs-provider \
  43. && git clone --depth 1 --branch main https://github.com/open-quantum-safe/liboqs.git \
  44. && cd liboqs \
  45. && mkdir build \
  46. && cd build \
  47. && cmake -DOQS_ENABLE_SIG_RAINBOW=OFF -DCMAKE_INSTALL_PREFIX=$SRCTOP/oqs-provider/oqs .. \
  48. && make \
  49. && make install
  50. )
  51. fi
  52. if [ ! -f $SRCTOP/oqs-provider/test/ssltestlib.c ]; then
  53. ( cd $SRCTOP/oqs-provider && OPENSSL_BLDTOP=$BLDTOP ./scripts/preptests.sh )
  54. fi
  55. echo " CWD: $PWD"
  56. cmake $SRCTOP/oqs-provider -DCMAKE_INCLUDE_PATH=$SRCTOP/oqs-provider/oqs -DCMAKE_PREFIX_PATH=$SRCTOP/oqs-provider/oqs -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" -DOPENSSL_BLDTOP=$BLDTOP -B _build && cmake --build _build
  57. export CTEST_OUTPUT_ON_FAILURE=1
  58. export HARNESS_OSSL_PREFIX=''
  59. export OPENSSL_APP="$O_EXE/openssl"
  60. if [ -z "$OQS_SKIP_TESTS" ]; then
  61. export OQS_SKIP_TESTS="rainbow,111"
  62. fi
  63. export OPENSSL_MODULES=$PWD/_build/oqsprov
  64. export OQS_PROVIDER_TESTSCRIPTS=$SRCTOP/oqs-provider
  65. $SRCTOP/oqs-provider/scripts/runtests.sh