From 8d7bfe342e5fb09e72077e576df673f80c1f691c Mon Sep 17 00:00:00 2001 From: Sebb Date: Wed, 8 Nov 2023 11:17:57 +0000 Subject: [PATCH] Drop check for OpenSSL library The code does also support (some) LibreSsl implementations --- .github/workflows/maven.yml | 5 ++--- .github/workflows/maven_adhoc.yml | 4 ++-- src/test/java/org/apache/commons/crypto/CryptoTest.java | 8 -------- .../org/apache/commons/crypto/jna/OpenSslJnaTest.java | 8 -------- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 22f02cf2c..469c331b8 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -96,7 +96,6 @@ jobs: run: | openssl version -a echo "NAME=libcrypto-1_1-x64.dll" >> $env:GITHUB_ENV - echo "CHECK_SKIP=skip" >> $env:GITHUB_ENV # N.B. '-V -B -ntp' is shorthand for '--show-version --batch-mode --no-transfer-progress' # # The bash shell under Windows changes the openssl default library, so is not used for running tests @@ -117,11 +116,11 @@ jobs: env: OPENSSL_HOME: "C:\\Miniconda\\Library" run: | - mvn -V -B -ntp -DtrimStackTrace=false -D"jni.library.name=$env:NAME" -D"commons.crypto.OpenSslNativeJna=$env:NAME" -D"commons.crypto.openssl.check=$env:CHECK_SKIP" + mvn -V -B -ntp -DtrimStackTrace=false -D"jni.library.name=$env:NAME" -D"commons.crypto.OpenSslNativeJna=$env:NAME" - name: Build with Maven (not Windows) if: ${{ matrix.os != 'windows-latest' }} run: | - mvn -V -B -ntp -DtrimStackTrace=false -D"jni.library.path=$ENGINESDIR" -D"jna.library.path=$ENGINESDIR" -D"commons.crypto.openssl.check=$CHECK_SKIP" + mvn -V -B -ntp -DtrimStackTrace=false -D"jni.library.path=$ENGINESDIR" -D"jna.library.path=$ENGINESDIR" - name: Check benchmark code compiles if: ${{ matrix.java == '8' }} env: diff --git a/.github/workflows/maven_adhoc.yml b/.github/workflows/maven_adhoc.yml index 1c5f8f102..4ffa1c618 100644 --- a/.github/workflows/maven_adhoc.yml +++ b/.github/workflows/maven_adhoc.yml @@ -65,7 +65,7 @@ jobs: OPENSSL_HOME: "C:\\Miniconda\\Library" NAME: "libcrypto-1_1-x64" run: | - mvn clean test -B -V -ntp -D"jna.debug_load=true" -DtrimStackTrace=false -D"jni.library.name=$env:NAME" -D"commons.crypto.OpenSslNativeJna=$env:NAME" -D"commons.crypto.openssl.check=skip" -D"commons.crypto.debug=true" + mvn clean test -B -V -ntp -D"jna.debug_load=true" -DtrimStackTrace=false -D"jni.library.name=$env:NAME" -D"commons.crypto.OpenSslNativeJna=$env:NAME" -D"commons.crypto.debug=true" - name: JNA test if: always() env: @@ -89,4 +89,4 @@ jobs: - name: Maven test default if: always() run: | - mvn surefire:test -B -V -ntp -D"jna.debug_load=true" -DtrimStackTrace=false -D"commons.crypto.openssl.check=skip" -D"commons.crypto.debug=true" + mvn surefire:test -B -V -ntp -D"jna.debug_load=true" -DtrimStackTrace=false -D"commons.crypto.debug=true" diff --git a/src/test/java/org/apache/commons/crypto/CryptoTest.java b/src/test/java/org/apache/commons/crypto/CryptoTest.java index a775b9376..9c1a532e6 100644 --- a/src/test/java/org/apache/commons/crypto/CryptoTest.java +++ b/src/test/java/org/apache/commons/crypto/CryptoTest.java @@ -16,9 +16,6 @@ */ package org.apache.commons.crypto; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.MatcherAssert.assertThat; - import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -61,11 +58,6 @@ public void testMain() throws Throwable { assertTrue(Crypto.isNativeCodeLoaded(), "Native code loaded OK"); Crypto.main(new String[] { }); // show the JNI library details assertTrue(Crypto.isNativeCodeLoaded(), "Completed OK"); - // Ensure that test loaded OpenSSL, not some other library - // This may require jni.library.path to be defined if the default library is not OpenSSL - if (!"skip".equals(System.getProperty("commons.crypto.openssl.check"))) { // allow check to be skipped - assertThat(OpenSslInfoNative.OpenSSLVersion(0), containsString("OpenSSL")); - } } } diff --git a/src/test/java/org/apache/commons/crypto/jna/OpenSslJnaTest.java b/src/test/java/org/apache/commons/crypto/jna/OpenSslJnaTest.java index 1859a4c24..96911e584 100644 --- a/src/test/java/org/apache/commons/crypto/jna/OpenSslJnaTest.java +++ b/src/test/java/org/apache/commons/crypto/jna/OpenSslJnaTest.java @@ -17,9 +17,6 @@ */ package org.apache.commons.crypto.jna; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.MatcherAssert.assertThat; - import org.junit.jupiter.api.Test; public class OpenSslJnaTest { @@ -27,10 +24,5 @@ public class OpenSslJnaTest { @Test public void testMain() throws Throwable { OpenSslJna.main(new String[0]); - // Ensure that test loaded OpenSSL, not some other library - // This may require jna.library.path to be defined if the default library is not OpenSSL - if (!"skip".equals(System.getProperty("commons.crypto.openssl.check"))) { // allow check to be skipped - assertThat(OpenSslNativeJna.OpenSSLVersion(0), containsString("OpenSSL")); - } } }