cryptography.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/sh
  2. #
  3. # Copyright 2017-2023 The OpenSSL Project Authors. All Rights Reserved.
  4. # Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
  5. #
  6. # Licensed under the OpenSSL license (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. cd pyca-cryptography
  36. echo "------------------------------------------------------------------"
  37. echo "Building cryptography"
  38. echo "------------------------------------------------------------------"
  39. LDFLAGS="-L$O_LIB" CFLAGS="-I$O_BINC -I$O_SINC" pip install .[test]
  40. pip install -e vectors
  41. echo "------------------------------------------------------------------"
  42. echo "Running tests"
  43. echo "------------------------------------------------------------------"
  44. pytest -n auto tests --wycheproof-root=../wycheproof
  45. cd ../
  46. deactivate
  47. rm -rf venv-cryptography
  48. exit 0