You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Alex Remily <al...@gmail.com> on 2018/03/23 12:07:10 UTC

[crypto] OpenSslCryptoRandomTest fails on Mac OS High Sierra

Sending again, this time with a subject line.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [crypto] OpenSslCryptoRandomTest fails on Mac OS High Sierra

Posted by Dapeng Sun <sd...@apache.org>.
Thank Alex and Rob, I will look into it this week.

Regards,
Dapeng

2018-03-24 10:16 GMT+08:00 Alex Remily <al...@gmail.com>:

> I did a bit more troubleshooting.  I confirmed that the rdrand engine
> loads natively on Mac High Sierra by running the below test program in
> XCode.  I believe the issue is one of the commons-crypto build, not
> openssl itself.  Hopefully, someone more familiar with the codebase
> will pick this up and troubleshoot.
>
> See https://software.intel.com/en-us/articles/how-to-use-the-
> rdrand-engine-in-openssl-for-random-number-generation.
>
> /*
> Copyright July, 2014 Intel Corporation
> All Rights Reserved.
>
> The source code, information and material ("Material") contained herein
> is owned by Intel Corporation or its suppliers or licensors, and title
> to such Material remains with Intel Corporation or its suppliers or
> licensors. The Material contains proprietary information of Intel or
> its suppliers and licensors. The Material is protected by worldwide
> copyright laws and treaty provisions. No part of the Material may be used,
> copied, reproduced, modified, published, uploaded, posted, transmitted,
> distributed or disclosed in any way without Intel's prior express written
> permission. No license under any patent, copyright or other intellectual
> property rights in the Material is granted to or conferred upon you,
> either expressly, by implication, inducement, estoppel or otherwise. Any
> license under such intellectual property rights must be express and
> approved by Intel in writing.
>
> Unless otherwise agreed by Intel in writing, you may not remove or alter
> this notice or any other notice embedded in Materials by Intel or Intel's
> suppliers or licensors in any way.
> */
>
> /*
>  * This sample program fills a 64-byte buffer with random data using the
>  * rdrand engine in OpenSSL
>  */
>
> #define BUFFERSZ 64
>
> #include <openssl/engine.h>
> #include <stdio.h>
> #include <string.h>
>
> int main (int argc, char *argv[])
> {
>     unsigned char buf[BUFFERSZ];
>     ENGINE *engine;
>     int i;
>
>     /* Set our buffer to all zeroes for demonstration purposes */
>
>     memset(buf, 0, BUFFERSZ);
>
>     /* Initialize the engine */
>
>     ENGINE_load_rdrand();
>
>     engine= ENGINE_by_id("rdrand");
>     if ( engine == NULL ) {
>         fprintf(stderr, "ENGINE_load_rdrand returned %lu\n",
> ERR_get_error());
>         exit(1);
>     }
>
>     if ( ! ENGINE_init(engine) ) {
>         fprintf(stderr, "ENGINE_init returned %lu\n", ERR_get_error());
>         exit(1);
>     }
>
>     /* Set the engine as the default engine for random numbers */
>
>     if ( ! ENGINE_set_default(engine, ENGINE_METHOD_RAND) ) {
>         fprintf(stderr, "ENGINE_set_default returned %lu\n",
> ERR_get_error());
>         exit(1);
>     }
>
>     /* Now call RAND_bytes to fill our buffer */
>
>     RAND_bytes(buf, BUFFERSZ);
>
>     /* Print our buffer as rows of 16 hex values */
>
>     for (i= 0; i< BUFFERSZ; ++i) {
>         if ( ! (i % 16) && i ) printf("\n");
>         printf("%02x ", buf[i]);
>     }
>     printf("\n");
>
>     ENGINE_finish(engine);
>     ENGINE_free(engine);
>     ENGINE_cleanup();
> }
>
> On Fri, Mar 23, 2018 at 9:01 AM, Rob Tompkins <ch...@gmail.com> wrote:
> > Yes, I can reproduce this error on the Mac running under:
> >
> > Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297;
> 2018-02-24T14:49:05-05:00)
> > Maven home: /usr/local/Cellar/maven/3.5.3/libexec
> > Java version: 1.8.0_162, vendor: Oracle Corporation
> > Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_
> 162.jdk/Contents/Home/jre
> > Default locale: en_US, platform encoding: UTF-8
> > OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "mac"
> >
> >> On Mar 23, 2018, at 8:07 AM, Alex Remily <al...@gmail.com> wrote:
> >>
> >> Sending again, this time with a subject line.
> >>
> >> 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
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> >> For additional commands, e-mail: user-help@commons.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> > For additional commands, e-mail: user-help@commons.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: [crypto] OpenSslCryptoRandomTest fails on Mac OS High Sierra

Posted by Alex Remily <al...@gmail.com>.
I did a bit more troubleshooting.  I confirmed that the rdrand engine
loads natively on Mac High Sierra by running the below test program in
XCode.  I believe the issue is one of the commons-crypto build, not
openssl itself.  Hopefully, someone more familiar with the codebase
will pick this up and troubleshoot.

See https://software.intel.com/en-us/articles/how-to-use-the-rdrand-engine-in-openssl-for-random-number-generation.

/*
Copyright July, 2014 Intel Corporation
All Rights Reserved.

The source code, information and material ("Material") contained herein
is owned by Intel Corporation or its suppliers or licensors, and title
to such Material remains with Intel Corporation or its suppliers or
licensors. The Material contains proprietary information of Intel or
its suppliers and licensors. The Material is protected by worldwide
copyright laws and treaty provisions. No part of the Material may be used,
copied, reproduced, modified, published, uploaded, posted, transmitted,
distributed or disclosed in any way without Intel's prior express written
permission. No license under any patent, copyright or other intellectual
property rights in the Material is granted to or conferred upon you,
either expressly, by implication, inducement, estoppel or otherwise. Any
license under such intellectual property rights must be express and
approved by Intel in writing.

Unless otherwise agreed by Intel in writing, you may not remove or alter
this notice or any other notice embedded in Materials by Intel or Intel's
suppliers or licensors in any way.
*/

/*
 * This sample program fills a 64-byte buffer with random data using the
 * rdrand engine in OpenSSL
 */

#define BUFFERSZ 64

#include <openssl/engine.h>
#include <stdio.h>
#include <string.h>

int main (int argc, char *argv[])
{
    unsigned char buf[BUFFERSZ];
    ENGINE *engine;
    int i;

    /* Set our buffer to all zeroes for demonstration purposes */

    memset(buf, 0, BUFFERSZ);

    /* Initialize the engine */

    ENGINE_load_rdrand();

    engine= ENGINE_by_id("rdrand");
    if ( engine == NULL ) {
        fprintf(stderr, "ENGINE_load_rdrand returned %lu\n", ERR_get_error());
        exit(1);
    }

    if ( ! ENGINE_init(engine) ) {
        fprintf(stderr, "ENGINE_init returned %lu\n", ERR_get_error());
        exit(1);
    }

    /* Set the engine as the default engine for random numbers */

    if ( ! ENGINE_set_default(engine, ENGINE_METHOD_RAND) ) {
        fprintf(stderr, "ENGINE_set_default returned %lu\n", ERR_get_error());
        exit(1);
    }

    /* Now call RAND_bytes to fill our buffer */

    RAND_bytes(buf, BUFFERSZ);

    /* Print our buffer as rows of 16 hex values */

    for (i= 0; i< BUFFERSZ; ++i) {
        if ( ! (i % 16) && i ) printf("\n");
        printf("%02x ", buf[i]);
    }
    printf("\n");

    ENGINE_finish(engine);
    ENGINE_free(engine);
    ENGINE_cleanup();
}

On Fri, Mar 23, 2018 at 9:01 AM, Rob Tompkins <ch...@gmail.com> wrote:
> Yes, I can reproduce this error on the Mac running under:
>
> Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T14:49:05-05:00)
> Maven home: /usr/local/Cellar/maven/3.5.3/libexec
> Java version: 1.8.0_162, vendor: Oracle Corporation
> Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "mac"
>
>> On Mar 23, 2018, at 8:07 AM, Alex Remily <al...@gmail.com> wrote:
>>
>> Sending again, this time with a subject line.
>>
>> 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
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [crypto] OpenSslCryptoRandomTest fails on Mac OS High Sierra

Posted by Alex Remily <al...@gmail.com>.
Rob,

I also encountered what I believe is the same error you describe.  Try
adding another include statement to your Makefile.common.  I added the
-I/usr/local/include -I/usr/local/Cellar/openssl/1.0.2n/include to the
below two lines:

Mac-x86_64_CFLAGS    := -Ilib/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC
-mmacosx-version-min=10.5 -fvisibility=hidden -I/usr/local/include
-I/usr/local/Cellar/openssl/1.0.2n/include
Mac-x86_64_CXXFLAGS  := -Ilib/inc_mac -I$(JAVA_HOME)/include -O2 -fPIC
-mmacosx-version-min=10.5 -fvisibility=hidden -I/usr/local/include
-I/usr/local/Cellar/openssl/1.0.2n/include

Once make found the includes for my openssl installation, everything
built fine and maven proceeded on to the test lifecycle where I
encountered the test failures I posted originally.  I may have had to
do something similar to get the build working on Ubuntu 16.04, but I
don't recall exactly.

Best,

Alex

On Fri, Mar 23, 2018 at 9:01 AM, Rob Tompkins <ch...@gmail.com> wrote:
> Yes, I can reproduce this error on the Mac running under:
>
> Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T14:49:05-05:00)
> Maven home: /usr/local/Cellar/maven/3.5.3/libexec
> Java version: 1.8.0_162, vendor: Oracle Corporation
> Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "mac"
>
>> On Mar 23, 2018, at 8:07 AM, Alex Remily <al...@gmail.com> wrote:
>>
>> Sending again, this time with a subject line.
>>
>> 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
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [crypto] OpenSslCryptoRandomTest fails on Mac OS High Sierra

Posted by Rob Tompkins <ch...@gmail.com>.
Yes, I can reproduce this error on the Mac running under:

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T14:49:05-05:00)
Maven home: /usr/local/Cellar/maven/3.5.3/libexec
Java version: 1.8.0_162, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "mac"

> On Mar 23, 2018, at 8:07 AM, Alex Remily <al...@gmail.com> wrote:
> 
> Sending again, this time with a subject line.
> 
> 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
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [crypto] OpenSslCryptoRandomTest fails on Mac OS High Sierra

Posted by Rob Tompkins <ch...@apache.org>.
Hello Alex,

I haven’t spent much time working with [crypto], but I recall seeing something like this when building from a Mac. In fact, my error is upstream to yours:
--------------------------
[INFO] Executing tasks

make:
     [exec] "/Library/Java/JavaVirtualMachines/jdk1.8.0_162.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_162.jdk/Contents/Home/include -O2 -fPIC -mmacosx-version-min=10.5 -fvisibility=hidden -I/usr/local/include -Ilib/include -I/usr/include -I"src/main/native/org/apache/commons/crypto/" -I"/Library/Java/JavaVirtualMachines/jdk1.8.0_162.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] In file included from src/main/native/org/apache/commons/crypto/random/OpenSslCryptoRandomNative.c:19:
     [exec] In file included from src/main/native/org/apache/commons/crypto/random/org_apache_commons_crypto_random.h:22:
     [exec] src/main/native/org/apache/commons/crypto/org_apache_commons_crypto.h:195:10: fatal error: 'openssl/aes.h' file not found
     [exec] #include <openssl/aes.h>
     [exec]          ^~~~~~~~~~~~~~~
     [exec] 1 error generated.
     [exec] make: *** [target/commons-crypto-1.1.0-SNAPSHOT-Mac-x86_64/OpenSslCryptoRandomNative.o] Error 1
------------------------------
before execution of the tests even begin. Did you see something similar when you were first building the project?

Either way, I agree that the documentation on building the project does not seem to result in success.

Cheers,
-Rob


> On Mar 23, 2018, at 8:07 AM, Alex Remily <al...@gmail.com> wrote:
> 
> Sending again, this time with a subject line.
> 
> 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
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org