|
19 | 19 | # You should have received a copy of the GNU General Public License |
20 | 20 | # along with wolfProvider. If not, see <http://www.gnu.org/licenses/>. |
21 | 21 |
|
22 | | -# Get the force fail parameter |
23 | | -if [ "${WOLFPROV_FORCE_FAIL}" = "1" ]; then |
24 | | - echo "Force fail mode enabled for all tests" |
25 | | -fi |
26 | | -if [ "${WOLFSSL_ISFIPS}" = "1" ]; then |
27 | | - echo "FIPS mode enabled for all tests" |
28 | | -fi |
29 | | - |
30 | 22 | # Get the directory where this script is located |
31 | 23 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" |
32 | 24 | REPO_ROOT="$( cd "${SCRIPT_DIR}/../.." &> /dev/null && pwd )" |
33 | 25 | UTILS_DIR="${REPO_ROOT}/scripts" |
34 | 26 |
|
35 | | -# Get the built versions |
36 | | -if [ -d "${REPO_ROOT}/openssl-source" ] && [ -d "${REPO_ROOT}/wolfssl-source" ]; then |
37 | | - # Get the actual versions that were built |
38 | | - export OPENSSL_TAG=$(cd ${REPO_ROOT}/openssl-source && |
39 | | - (git describe --tags 2>/dev/null || git branch --show-current)) |
40 | | - export WOLFSSL_TAG=$(cd ${REPO_ROOT}/wolfssl-source && |
41 | | - (git describe --tags 2>/dev/null || git branch --show-current)) |
42 | | -else |
43 | | - echo "[FAIL] OpenSSL or wolfSSL source directories not found" |
44 | | - echo "Please run build-wolfprovider.sh first" |
45 | | - exit 1 |
46 | | -fi |
| 27 | +source "${SCRIPT_DIR}/cmd-test-common.sh" |
47 | 28 |
|
48 | | -# Use the current version tags for testing |
49 | | -export USE_CUR_TAG=1 |
| 29 | +# If OPENSSL_BIN is not set, assume we are using a local build |
| 30 | +if [ -z "${OPENSSL_BIN:-}" ]; then |
| 31 | + # Check if the install directories exist |
| 32 | + if [ ! -d "${REPO_ROOT}/openssl-install" ] || |
| 33 | + [ ! -d "${REPO_ROOT}/wolfssl-install" ]; then |
| 34 | + echo "[FAIL] OpenSSL or wolfSSL install directories not found" |
| 35 | + echo "Please set OPENSSL_BIN or run build-wolfprovider.sh first" |
| 36 | + exit 1 |
| 37 | + fi |
50 | 38 |
|
51 | | -# Source OpenSSL utilities and initialize OpenSSL |
52 | | -source "${UTILS_DIR}/utils-openssl.sh" |
53 | | -init_openssl |
| 39 | + # Setup the environment for a local build |
| 40 | + source "${REPO_ROOT}/scripts/env-setup" |
| 41 | +else |
| 42 | + # We are using a user-provided OpenSSL binary, manually set the test |
| 43 | + # environment variables rather than using env-setup. |
| 44 | + # Find the location of the wolfProvider modules |
| 45 | + if [ -z "${WOLFPROV_PATH:-}" ]; then |
| 46 | + export WOLFPROV_PATH=$(find /usr/lib /usr/local/lib -type d -name ossl-modules 2>/dev/null | head -n 1) |
| 47 | + fi |
| 48 | + # Set the path to the wolfProvider config file |
| 49 | + if [ -z "${WOLFPROV_CONFIG:-}" ]; then |
| 50 | + if [ "${WOLFSSL_ISFIPS:-0}" = "1" ]; then |
| 51 | + export WOLFPROV_CONFIG="${REPO_ROOT}/provider-fips.conf" |
| 52 | + else |
| 53 | + export WOLFPROV_CONFIG="${REPO_ROOT}/provider.conf" |
| 54 | + fi |
| 55 | + fi |
| 56 | +fi |
54 | 57 |
|
55 | 58 | echo "=== Running wolfProvider Command-Line Tests ===" |
56 | | -echo "Using OpenSSL version: ${OPENSSL_TAG}" |
57 | | -echo "Using wolfSSL version: ${WOLFSSL_TAG}" |
| 59 | +echo "Using OPENSSL_BIN: ${OPENSSL_BIN}" |
| 60 | +echo "Using WOLFPROV_PATH: ${WOLFPROV_PATH}" |
| 61 | +echo "Using WOLFPROV_CONFIG: ${WOLFPROV_CONFIG}" |
| 62 | + |
| 63 | +# Ensure we can switch providers before proceeding |
| 64 | +use_default_provider |
| 65 | +use_wolf_provider |
58 | 66 |
|
59 | 67 | # Run the hash comparison test |
60 | 68 | echo -e "\n=== Running Hash Comparison Test ===" |
|
0 commit comments