Skip to content

Commit

Permalink
Simplified common.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
olszomal authored and mtrojnar committed Dec 2, 2024
1 parent 7f6eba0 commit 9f8deaf
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,21 @@ OPENSSL_VERSION=$(./openssl_version | cut -d ' ' -f 2)
# Restore settings
export LD_LIBRARY_PATH=${TEMP_LD_LIBRARY_PATH}

LIBCRYPTO_VER=$(ldd "${MODULE}" | grep 'libcrypto' | awk '{print $1}')
if [[ "$OPENSSL_VERSION" =~ ^0.* || "$OPENSSL_VERSION" =~ ^1\.0.* ]] \
&& [[ "$LIBCRYPTO_VER" == "libcrypto.so.3" ]]; then
echo -n "Skipping test: Module '${MODULE}' built with '${LIBCRYPTO_VER}'"
echo "is incompatible with OpenSSL version '${OPENSSL_VERSION}'."
exit 77
# Check for ldd command
if command -v ldd >/dev/null 2>&1; then
LIBCRYPTO_VER=$(ldd "${MODULE}" | grep 'libcrypto' | awk '{print $1}')
else
echo "Warning: ldd command not found. Skipping library version detection."
LIBCRYPTO_VER="unknown"
fi

# Check OpenSSL version and library compatibility
if [[ "$OPENSSL_VERSION" =~ ^0.* || "$OPENSSL_VERSION" =~ ^1\.0.* ]]; then
if [[ "$LIBCRYPTO_VER" == "libcrypto.so.3" ]]; then
echo -n "Skipping test: Module '${MODULE}' built with '${LIBCRYPTO_VER}'"
echo "is incompatible with OpenSSL version '${OPENSSL_VERSION}'."
exit 77
fi
fi

echo "Detected system: ${OSTYPE}"
Expand Down Expand Up @@ -214,7 +223,7 @@ import_objects () {
# Import objects with different labels
for param in "$@"; do
if [[ -n "$param" ]]; then
echo -n "* Importing the ${key_type^^} ${param} object id=${obj_id}"
echo -n "* Importing the ${key_type} ${param} object id=${obj_id}"
echo -n " into the token ${token_label} ... "
pkcs11-tool --login --pin ${PIN} --module ${MODULE} \
--token-label "${token_label}"\
Expand Down

0 comments on commit 9f8deaf

Please sign in to comment.