This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git


The following commit(s) were added to refs/heads/master by this push:
     new 5252a316 CRYPTO-178: isNativeCodeEnabled should not throw
5252a316 is described below

commit 5252a316610251211415e57361675649569190d0
Author: Sebb <s...@apache.org>
AuthorDate: Mon Nov 20 10:04:21 2023 +0000

    CRYPTO-178: isNativeCodeEnabled should not throw
---
 src/changes/changes.xml                                        |  1 +
 .../org/apache/commons/crypto/random/OpenSslCryptoRandom.java  | 10 ----------
 2 files changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ccbcc679..63dbf067 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -65,6 +65,7 @@
   <body>
     <release version="1.2.1" date="202X-MM-DD" description="Minor release 
(Java 8, OpenSSL 1.1.1)">
       <!-- FIX -->
+      <action issue="CRYPTO-178" type="fix" 
dev="sebb">OpenSslCryptoRandom.isNativeCodeEnabled() throws if library cannot 
be loaded</action>
       <action issue="CRYPTO-173" type="fix" dev="sebb">docker build does not 
work on macOS M1</action>
       <action issue="CRYPTO-167" type="fix" dev="sebb">cannot use THROW to 
report missing env</action>
       <action issue="CRYPTO-171" type="fix" dev="sebb">openssl(2) not 
supported since Sierra on macOS M1</action>
diff --git 
a/src/main/java/org/apache/commons/crypto/random/OpenSslCryptoRandom.java 
b/src/main/java/org/apache/commons/crypto/random/OpenSslCryptoRandom.java
index c20e83e8..71606d28 100644
--- a/src/main/java/org/apache/commons/crypto/random/OpenSslCryptoRandom.java
+++ b/src/main/java/org/apache/commons/crypto/random/OpenSslCryptoRandom.java
@@ -59,16 +59,6 @@ final class OpenSslCryptoRandom implements CryptoRandom {
         }
         nativeEnabled = opensslLoaded;
         initException = except;
-        //
-        // Check that nextRandBytes works (is this really needed?)
-        try {
-            checkNative();
-        } catch (final GeneralSecurityException e) {
-            throw new IllegalStateException(e);
-        }
-        if (!OpenSslCryptoRandomNative.nextRandBytes(new byte[1])) {
-            throw new IllegalStateException("Check of nextRandBytes failed");
-        }
     }
 
     private static void checkNative() throws GeneralSecurityException {

Reply via email to