oqsprovider.sh 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 0.7.2 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. echo " CWD: $PWD"
  53. 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
  54. export CTEST_OUTPUT_ON_FAILURE=1
  55. export HARNESS_OSSL_PREFIX=''
  56. export OPENSSL_APP="$O_EXE/openssl"
  57. if [ -z "$OQS_SKIP_TESTS" ]; then
  58. export OQS_SKIP_TESTS="rainbow,111"
  59. fi
  60. export OPENSSL_MODULES=$PWD/_build/oqsprov
  61. export OQS_PROVIDER_TESTSCRIPTS=$SRCTOP/oqs-provider
  62. $SRCTOP/oqs-provider/scripts/runtests.sh