I’m building Apache Commons Crypto from source on Mac OS HighSierra (10.13.3)
and the CryptoRandom tests fail, apparently because of failure to load the
underlying random number generation library. All other tests pass. I
successfully built and tested on Ubuntu 16.04 in a similar development
environment, so the problem seems isolated to my Mac. Has anyone had a similar
experience, or have any ideas why the Mac is exhibiting this behavior? I’ve
tested two versions of openssl, and both versions produced identical failures.
Best wishes,
Alex
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Apache Commons Crypto 1.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-3) @
commons-crypto ---
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:parse-version (parse-version) @
commons-crypto ---
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (create-version-file) @
commons-crypto ---
[INFO] Using 'iso-8859-1' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (javadoc.resources) @ commons-crypto ---
[INFO] Executing tasks
main:
[copy] Copying 2 files to
/Users/Alex/Documents/git_repos/commons-crypto/target/apidocs/META-INF
[INFO] Executed tasks
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles)
@ commons-crypto ---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ commons-crypto ---
[INFO] Executing: /bin/sh -c cd
'/Users/Alex/Documents/git_repos/commons-crypto' && 'git' 'rev-parse'
'--verify' 'HEAD'
[INFO] Working directory: /Users/Alex/Documents/git_repos/commons-crypto
[INFO] Storing buildNumber: d69ef9556f44c076034add15feef1c5513248404 at
timestamp: 2018-03-22 17:12:10-0400
[INFO] Storing buildScmBranch: master
[INFO]
[INFO] --- maven-resources-plugin:2.7:resources (default-resources) @
commons-crypto ---
[INFO] Using 'iso-8859-1' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @
commons-crypto ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 38 source files to
/Users/Alex/Documents/git_repos/commons-crypto/target/classes
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (make) @ commons-crypto ---
[INFO] Executing tasks
make:
[exec]
"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javah"
-force -classpath target/classes -o
target/jni-classes/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.h
org.apache.commons.crypto.random.OpenSslCryptoRandomNative
[exec] gcc -arch x86_64 -Ilib/inc_mac
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include -O2
-fPIC -mmacosx-version-min=10.5 -fvisibility=hidden -I/usr/local/include
-I/usr/local/Cellar/openssl/1.0.2n/include -Ilib/include -I/usr/include
-I"src/main/native/org/apache/commons/crypto/"
-I"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include/darwin"
-I"target/jni-classes/org/apache/commons/crypto/cipher"
-I"target/jni-classes/org/apache/commons/crypto/random" -c
src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c -o
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslCryptoRandomNative.o
[exec]
"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javah"
-force -classpath target/classes -o
target/jni-classes/org/apache/commons/crypto/cipher/OpenSslNative.h
org.apache.commons.crypto.cipher.OpenSslNative
[exec] gcc -arch x86_64 -Ilib/inc_mac
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include -O2
-fPIC -mmacosx-version-min=10.5 -fvisibility=hidden -I/usr/local/include
-I/usr/local/Cellar/openssl/1.0.2n/include -Ilib/include -I/usr/include
-I"src/main/native/org/apache/commons/crypto/"
-I"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include/darwin"
-I"target/jni-classes/org/apache/commons/crypto/cipher"
-I"target/jni-classes/org/apache/commons/crypto/random" -c
src/main/native/org/apache/commons/crypto/cipher/OpenSslNative.c -o
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslNative.o
[exec]
"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/javah"
-force -classpath target/classes -o
target/jni-classes/org/apache/commons/crypto/OpenSslInfoNative.h
org.apache.commons.crypto.OpenSslInfoNative
[exec] gcc -arch x86_64 -Ilib/inc_mac
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include -O2
-fPIC -mmacosx-version-min=10.5 -fvisibility=hidden -I/usr/local/include
-I/usr/local/Cellar/openssl/1.0.2n/include -Ilib/include -I/usr/include
-I"src/main/native/org/apache/commons/crypto/"
-I"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include/darwin"
-I"target/jni-classes/org/apache/commons/crypto/cipher"
-I"target/jni-classes/org/apache/commons/crypto/random"
-DVERSION='"1.1.0-SNAPSHOT"' -DPROJECT_NAME='"Apache Commons Crypto"'
-I"target/jni-classes/org/apache/commons/crypto" -c
src/main/native/org/apache/commons/crypto/OpenSslInfoNative.c -o
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslInfoNative.o
[exec] g++ -arch x86_64 -Ilib/inc_mac
-I/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include -O2
-fPIC -mmacosx-version-min=10.5 -fvisibility=hidden -I/usr/local/include
-I/usr/local/Cellar/openssl/1.0.2n/include -Ilib/include -I/usr/include
-I"/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/include/darwin"
-I"target/jni-classes/org/apache/commons/crypto/cipher"
-I"target/jni-classes/org/apache/commons/crypto/random" -o
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/libcommons-crypto.jnilib
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslCryptoRandomNative.o
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslNative.o
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslInfoNative.o -dynamiclib
-L/usr/local/lib
[exec] clang: warning: libstdc++ is deprecated; move to libc++ with a
minimum deployment target of OS X 10.9 [-Wdeprecated]
[exec] strip -x
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/libcommons-crypto.jnilib
[exec] cp
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/libcommons-crypto.jnilib
target/classes/org/apache/commons/crypto/native/Mac/x86_64/libcommons-crypto.jnilib
[exec] cp
target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/libcommons-crypto.jnilib
target/classes/org/apache/commons/crypto/native/Mac/x86_64/libcommons-crypto.jnilib
[INFO] Executed tasks
[INFO]
[INFO] --- maven-bundle-plugin:3.4.0:manifest (bundle-manifest) @
commons-crypto ---
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.16:check (checkAPIcompatibility) @
commons-crypto ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java17:1.0
[INFO]
[INFO] --- maven-resources-plugin:2.7:testResources (default-testResources) @
commons-crypto ---
[INFO] Using 'iso-8859-1' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory
/Users/Alex/Documents/git_repos/commons-crypto/src/test/resources
[INFO] Copying 2 resources to META-INF
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @
commons-crypto ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 38 source files to
/Users/Alex/Documents/git_repos/commons-crypto/target/test-classes
[INFO]
[INFO] --- jacoco-maven-plugin:0.7.7.201606060606:prepare-agent (prepare-agent)
@ commons-crypto ---
[INFO] argLine set to
-javaagent:/Users/Alex/.m2/repository/org/jacoco/org.jacoco.agent/0.7.7.201606060606/org.jacoco.agent-0.7.7.201606060606-runtime.jar=destfile=/Users/Alex/Documents/git_repos/commons-crypto/target/jacoco.exec,excludes=**/examples/*
[INFO]
[INFO] --- maven-surefire-plugin:2.20.1:test (default-test) @ commons-crypto ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.apache.commons.crypto.CryptoTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.063 s
- in org.apache.commons.crypto.CryptoTest
[INFO] Running org.apache.commons.crypto.stream.CtrNoPaddingCipherStreamTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.312 s
- in org.apache.commons.crypto.stream.CtrNoPaddingCipherStreamTest
[INFO] Running org.apache.commons.crypto.stream.CbcPkcs5PaddingCipherStreamTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.079 s
- in org.apache.commons.crypto.stream.CbcPkcs5PaddingCipherStreamTest
[INFO] Running org.apache.commons.crypto.stream.CtrCryptoStreamTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.064 s
- in org.apache.commons.crypto.stream.CtrCryptoStreamTest
[INFO] Running org.apache.commons.crypto.stream.PositionedCryptoInputStreamTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.035 s
- in org.apache.commons.crypto.stream.PositionedCryptoInputStreamTest
[INFO] Running org.apache.commons.crypto.stream.CbcNoPaddingCipherStreamTest
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.056 s
- in org.apache.commons.crypto.stream.CbcNoPaddingCipherStreamTest
[INFO] Running org.apache.commons.crypto.cipher.CryptoCipherFactoryTest
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 s
- in org.apache.commons.crypto.cipher.CryptoCipherFactoryTest
[INFO] Running org.apache.commons.crypto.cipher.JceCipherTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.02 s -
in org.apache.commons.crypto.cipher.JceCipherTest
[INFO] Running org.apache.commons.crypto.cipher.OpenSslCipherTest
[INFO] Tests run: 13, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 s
- in org.apache.commons.crypto.cipher.OpenSslCipherTest
[INFO] Running org.apache.commons.crypto.cipher.GcmCipherTest
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.023 s
- in org.apache.commons.crypto.cipher.GcmCipherTest
[INFO] Running org.apache.commons.crypto.utils.UtilsTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in
org.apache.commons.crypto.utils.UtilsTest
[INFO] Running org.apache.commons.crypto.utils.EnumTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 s
- in org.apache.commons.crypto.utils.EnumTest
[INFO] Running org.apache.commons.crypto.NativeCodeLoaderTest
** INFO: Native (JNI) code loaded successfully
[WARNING] Tests run: 5, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 0.012
s - in org.apache.commons.crypto.NativeCodeLoaderTest
[INFO] Running org.apache.commons.crypto.jna.CtrCryptoJnaStreamTest
[WARNING] Tests run: 4, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 0.081
s - in org.apache.commons.crypto.jna.CtrCryptoJnaStreamTest
[INFO] Running org.apache.commons.crypto.jna.PositionedCryptoInputStreamJnaTest
[WARNING] Tests run: 3, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 0.011
s - in org.apache.commons.crypto.jna.PositionedCryptoInputStreamJnaTest
[INFO] Running org.apache.commons.crypto.jna.CtrNoPaddingCipherJnaStreamTest
[WARNING] Tests run: 4, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 0.02
s - in org.apache.commons.crypto.jna.CtrNoPaddingCipherJnaStreamTest
[INFO] Running org.apache.commons.crypto.jna.OpenSslJnaCipherTest
[WARNING] Tests run: 13, Failures: 0, Errors: 0, Skipped: 13, Time elapsed:
0.004 s - in org.apache.commons.crypto.jna.OpenSslJnaCipherTest
[INFO] Running org.apache.commons.crypto.jna.CbcPkcs5PaddingCipherJnaStreamTest
[WARNING] Tests run: 4, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 0.02
s - in org.apache.commons.crypto.jna.CbcPkcs5PaddingCipherJnaStreamTest
[INFO] Running org.apache.commons.crypto.jna.OpenSslNativeJnaTest
** WARN: JNA could not be enabled: Error looking up function
'ENGINE_load_rdrand': dlsym(0x7fd119e3d2d0, ENGINE_load_rdrand): symbol not
found
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in
org.apache.commons.crypto.jna.OpenSslNativeJnaTest
[INFO] Running org.apache.commons.crypto.jna.CbcNoPaddingCipherJnaStreamTest
[WARNING] Tests run: 4, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 0.026
s - in org.apache.commons.crypto.jna.CbcNoPaddingCipherJnaStreamTest
[INFO] Running org.apache.commons.crypto.jna.OpenSslJnaCryptoRandomTest
[WARNING] Tests run: 2, Failures: 0, Errors: 0, Skipped: 2, Time elapsed: 0 s -
in org.apache.commons.crypto.jna.OpenSslJnaCryptoRandomTest
[INFO] Running org.apache.commons.crypto.random.OpenSslCryptoRandomTest
[ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.007 s
<<< FAILURE! - in org.apache.commons.crypto.random.OpenSslCryptoRandomTest
[ERROR]
testRandomBytes(org.apache.commons.crypto.random.OpenSslCryptoRandomTest) Time
elapsed: 0.007 s <<< ERROR!
java.security.GeneralSecurityException: CryptoRandom:
[org.apache.commons.crypto.random.OpenSslCryptoRandom] failed with
java.lang.reflect.InvocationTargetException
at
org.apache.commons.crypto.random.OpenSslCryptoRandomTest.getCryptoRandom(OpenSslCryptoRandomTest.java:37)
Caused by: java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
at
org.apache.commons.crypto.random.OpenSslCryptoRandomTest.getCryptoRandom(OpenSslCryptoRandomTest.java:37)
Caused by: java.lang.reflect.InvocationTargetException
at
org.apache.commons.crypto.random.OpenSslCryptoRandomTest.getCryptoRandom(OpenSslCryptoRandomTest.java:37)
Caused by: java.security.GeneralSecurityException: Native library could not be
initialised
at
org.apache.commons.crypto.random.OpenSslCryptoRandomTest.getCryptoRandom(OpenSslCryptoRandomTest.java:37)
Caused by: java.lang.UnsatisfiedLinkError: ENGINE_load_rdrand
[ERROR]
testRandomBytesMultiThreaded(org.apache.commons.crypto.random.OpenSslCryptoRandomTest)
Time elapsed: 0 s <<< ERROR!
java.security.GeneralSecurityException: CryptoRandom:
[org.apache.commons.crypto.random.OpenSslCryptoRandom] failed with
java.lang.reflect.InvocationTargetException
at
org.apache.commons.crypto.random.OpenSslCryptoRandomTest.getCryptoRandom(OpenSslCryptoRandomTest.java:37)
Caused by: java.lang.RuntimeException:
java.lang.reflect.InvocationTargetException
at
org.apache.commons.crypto.random.OpenSslCryptoRandomTest.getCryptoRandom(OpenSslCryptoRandomTest.java:37)
Caused by: java.lang.reflect.InvocationTargetException
at
org.apache.commons.crypto.random.OpenSslCryptoRandomTest.getCryptoRandom(OpenSslCryptoRandomTest.java:37)
Caused by: java.security.GeneralSecurityException: Native library could not be
initialised
at
org.apache.commons.crypto.random.OpenSslCryptoRandomTest.getCryptoRandom(OpenSslCryptoRandomTest.java:37)
Caused by: java.lang.UnsatisfiedLinkError: ENGINE_load_rdrand
[INFO] Running org.apache.commons.crypto.random.JavaCryptoRandomTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.366 s
- in org.apache.commons.crypto.random.JavaCryptoRandomTest
[INFO] Running org.apache.commons.crypto.random.OsCryptoRandomTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.401 s
- in org.apache.commons.crypto.random.OsCryptoRandomTest
[INFO] Running org.apache.commons.crypto.random.CryptoRandomFactoryTest
[INFO] Tests run: 10, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 s
- in org.apache.commons.crypto.random.CryptoRandomFactoryTest
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]
OpenSslCryptoRandomTest>AbstractRandomTest.testRandomBytes:35->getCryptoRandom:37
» GeneralSecurity
[ERROR]
OpenSslCryptoRandomTest>AbstractRandomTest.testRandomBytesMultiThreaded:50->getCryptoRandom:37
» GeneralSecurity
[INFO]
[ERROR] Tests run: 113, Failures: 0, Errors: 2, Skipped: 36
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.558 s
[INFO] Finished at: 2018-03-22T17:12:23-04:00
[INFO] Final Memory: 35M/499M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on
project commons-crypto: There are test failures.
[ERROR]
[ERROR] Please refer to
/Users/Alex/Documents/git_repos/commons-crypto/target/surefire-reports for the
individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump,
[date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException