cryptography.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. #
  3. # Copyright 2017 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. O_EXE=`pwd`/$BLDTOP/apps
  15. O_BINC=`pwd`/$BLDTOP/include
  16. O_SINC=`pwd`/$SRCTOP/include
  17. O_LIB=`pwd`/$BLDTOP
  18. export PATH=$O_EXE:$PATH
  19. export LD_LIBRARY_PATH=$O_LIB:$LD_LIBRARY_PATH
  20. # Check/Set openssl version
  21. OPENSSL_VERSION=`openssl version | cut -f 2 -d ' '`
  22. echo "------------------------------------------------------------------"
  23. echo "Testing OpenSSL using Python Cryptography:"
  24. echo " CWD: $PWD"
  25. echo " SRCTOP: $SRCTOP"
  26. echo " BLDTOP: $BLDTOP"
  27. echo " OpenSSL version: $OPENSSL_VERSION"
  28. echo "------------------------------------------------------------------"
  29. cd $SRCTOP
  30. # Create a python virtual env and activate
  31. rm -rf venv-pycrypto
  32. virtualenv venv-pycrypto
  33. . ./venv-pycrypto/bin/activate
  34. cd pyca-cryptography
  35. pip install .[test]
  36. echo "------------------------------------------------------------------"
  37. echo "Building cryptography"
  38. echo "------------------------------------------------------------------"
  39. python ./setup.py clean
  40. CFLAGS="-I$O_BINC -I$O_SINC -L$O_LIB" python ./setup.py build
  41. echo "------------------------------------------------------------------"
  42. echo "Running tests"
  43. echo "------------------------------------------------------------------"
  44. CFLAGS="-I$O_BINC -I$O_SINC -L$O_LIB" python ./setup.py test
  45. cd ../
  46. deactivate
  47. rm -rf venv-pycrypto
  48. exit 0