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