1 #!/bin/sh 2 # 3 # Copyright 2017-2022 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 # 12 # OpenSSL external testing using the Python Cryptography module 13 # 14 set -e 15 set -x 16 17 O_EXE=`pwd`/$BLDTOP/apps 18 O_BINC=`pwd`/$BLDTOP/include 19 O_SINC=`pwd`/$SRCTOP/include 20 O_LIB=`pwd`/$BLDTOP 21 22 export PATH=$O_EXE:$PATH 23 export LD_LIBRARY_PATH=$O_LIB:$LD_LIBRARY_PATH 24 25 # Check/Set openssl version 26 OPENSSL_VERSION=`openssl version | cut -f 2 -d ' '` 27 28 echo "------------------------------------------------------------------" 29 echo "Testing OpenSSL using Python Cryptography:" 30 echo " CWD: $PWD" 31 echo " SRCTOP: $SRCTOP" 32 echo " BLDTOP: $BLDTOP" 33 echo " OpenSSL version: $OPENSSL_VERSION" 34 echo "------------------------------------------------------------------" 35 36 cd $SRCTOP 37 38 # Create a python virtual env and activate 39 rm -rf venv-cryptography 40 python -m venv venv-cryptography 41 . ./venv-cryptography/bin/activate 42 # Upgrade pip to always have latest 43 pip install -U pip 44 45 cd pyca-cryptography 46 47 echo "------------------------------------------------------------------" 48 echo "Building cryptography and installing test requirements" 49 echo "------------------------------------------------------------------" 50 LDFLAGS="-L$O_LIB" CFLAGS="-I$O_BINC -I$O_SINC " pip install .[test] 51 pip install -e vectors 52 53 echo "------------------------------------------------------------------" 54 echo "Print linked libraries" 55 echo "------------------------------------------------------------------" 56 ldd $(find ../venv-cryptography/lib/ -iname '*.so') 57 58 59 echo "------------------------------------------------------------------" 60 echo "Running tests" 61 echo "------------------------------------------------------------------" 62 pytest -n auto tests --wycheproof-root=../wycheproof 63 64 cd ../ 65 deactivate 66 rm -rf venv-cryptography 67 68 exit 0 69 70