Skip to content

Commit

Permalink
Drop check for OpenSSL library
Browse files Browse the repository at this point in the history
The code does also support (some) LibreSsl implementations
  • Loading branch information
sebbASF committed Nov 8, 2023
1 parent bcc97ea commit 8d7bfe3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maven_adhoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
8 changes: 0 additions & 8 deletions src/test/java/org/apache/commons/crypto/CryptoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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"));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,12 @@
*/
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 {

@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"));
}
}
}

0 comments on commit 8d7bfe3

Please sign in to comment.