tlsfuzzer.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. #
  3. # Copyright 2021-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 TLSFuzzer test suite
  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 TLSFuzzer 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. export PATH="$O_EXE:$PATH"
  25. export LD_LIBRARY_PATH="$O_LIB:$LD_LIBRARY_PATH"
  26. export OPENSSL_ROOT_DIR="$O_LIB"
  27. # Check/Set openssl version
  28. OPENSSL_VERSION=`openssl version | cut -f 2 -d ' '`
  29. CLI="${O_EXE}/openssl"
  30. SERV="${O_EXE}/openssl"
  31. TMPFILE="${PWD}/tls-fuzzer.$$.tmp"
  32. PSKFILE="${PWD}/tls-fuzzer.psk.$$.tmp"
  33. PYTHON=`which python`
  34. PORT=4433
  35. echo "------------------------------------------------------------------"
  36. echo "Testing OpenSSL using TLSFuzzer:"
  37. echo " CWD: $PWD"
  38. echo " SRCTOP: $SRCTOP"
  39. echo " BLDTOP: $BLDTOP"
  40. echo " OPENSSL_ROOT_DIR: $OPENSSL_ROOT_DIR"
  41. echo " Python: $PYTHON"
  42. echo " TESTDATADIR: $TESTDATADIR"
  43. echo "------------------------------------------------------------------"
  44. cd "${SRCTOP}/tlsfuzzer"
  45. test -L ecdsa || ln -s ../python-ecdsa/src/ecdsa ecdsa
  46. test -L tlslite || ln -s ../tlslite-ng/tlslite tlslite 2>/dev/null
  47. retval=0
  48. tls_fuzzer_prepare
  49. PYTHONPATH=. "${PYTHON}" tests/scripts_retention.py ${TMPFILE} ${SERV} 821
  50. retval=$?
  51. rm -f ${TMPFILE}
  52. [ -f "${PSKFILE}" ] && rm -f ${PSKFILE}
  53. cd $PWD
  54. exit $retval