cryptography.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. #
  3. # Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
  4. # Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  5. #
  6. # Licensed under the Apache License 2.0 (the "License"). You may not use
  7. # this file except in compliance with the License. You can obtain a copy
  8. # in the file LICENSE in the source distribution or at
  9. # https://www.openssl.org/source/license.html
  10. #
  11. # OpenSSL external testing using the Python Cryptography module
  12. #
  13. set -e
  14. set -x
  15. O_EXE=`pwd`/$BLDTOP/apps
  16. O_BINC=`pwd`/$BLDTOP/include
  17. O_SINC=`pwd`/$SRCTOP/include
  18. O_LIB=`pwd`/$BLDTOP
  19. export PATH=$O_EXE:$PATH
  20. export LD_LIBRARY_PATH=$O_LIB:$LD_LIBRARY_PATH
  21. # Check/Set openssl version
  22. OPENSSL_VERSION=`openssl version | cut -f 2 -d ' '`
  23. echo "------------------------------------------------------------------"
  24. echo "Testing OpenSSL using Python Cryptography:"
  25. echo " CWD: $PWD"
  26. echo " SRCTOP: $SRCTOP"
  27. echo " BLDTOP: $BLDTOP"
  28. echo " OpenSSL version: $OPENSSL_VERSION"
  29. echo "------------------------------------------------------------------"
  30. cd $SRCTOP
  31. # Create a python virtual env and activate
  32. rm -rf venv-cryptography
  33. python -m venv venv-cryptography
  34. . ./venv-cryptography/bin/activate
  35. # Upgrade pip to always have latest
  36. pip install -U pip
  37. cd pyca-cryptography
  38. echo "------------------------------------------------------------------"
  39. echo "Building cryptography and installing test requirements"
  40. echo "------------------------------------------------------------------"
  41. LDFLAGS="-L$O_LIB" CFLAGS="-I$O_BINC -I$O_SINC " pip install .[test]
  42. pip install -e vectors
  43. echo "------------------------------------------------------------------"
  44. echo "Print linked libraries"
  45. echo "------------------------------------------------------------------"
  46. ldd $(find ../venv-cryptography/lib/ -iname '*.so')
  47. echo "------------------------------------------------------------------"
  48. echo "Running tests"
  49. echo "------------------------------------------------------------------"
  50. pytest -n auto tests --wycheproof-root=../wycheproof
  51. cd ../
  52. deactivate
  53. rm -rf venv-cryptography
  54. exit 0