cryptography.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/sh
  2. #
  3. # Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
  4. #
  5. # Licensed under the OpenSSL license (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. # ====================================================================
  11. # Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
  12. #
  13. #
  14. # OpenSSL external testing using the Python Cryptography module
  15. #
  16. set -e
  17. O_EXE=`pwd`/$BLDTOP/apps
  18. O_BINC=`pwd`/$BLDTOP/include
  19. O_SINC=`pwd`/$SRCTOP/include
  20. O_LIB=`pwd`/$BLDTOP
  21. export PATH=$O_EXE:$PATH
  22. export LD_LIBRARY_PATH=$O_LIB:$LD_LIBRARY_PATH
  23. # Check/Set openssl version
  24. OPENSSL_VERSION=`openssl version | cut -f 2 -d ' '`
  25. echo "------------------------------------------------------------------"
  26. echo "Testing OpenSSL using Python Cryptography:"
  27. echo " CWD: $PWD"
  28. echo " SRCTOP: $SRCTOP"
  29. echo " BLDTOP: $BLDTOP"
  30. echo " OpenSSL version: $OPENSSL_VERSION"
  31. echo "------------------------------------------------------------------"
  32. cd $SRCTOP
  33. # Create a python virtual env and activate
  34. rm -rf venv-pycrypto
  35. virtualenv venv-pycrypto
  36. . ./venv-pycrypto/bin/activate
  37. cd pyca-cryptography
  38. pip install .[test]
  39. echo "------------------------------------------------------------------"
  40. echo "Building cryptography"
  41. echo "------------------------------------------------------------------"
  42. python ./setup.py clean
  43. CFLAGS="-I$O_BINC -I$O_SINC -L$O_LIB" python ./setup.py build
  44. echo "------------------------------------------------------------------"
  45. echo "Running tests"
  46. echo "------------------------------------------------------------------"
  47. CFLAGS="-I$O_BINC -I$O_SINC -L$O_LIB" python ./setup.py test
  48. cd ../
  49. deactivate
  50. rm -rf venv-pycrypto
  51. exit 0