[GitHub] vanzin commented on a change in pull request #92: OpenSSL 1.1.0 updates with backward compatibility for OpenSSL 1.0.2 and 1.0.1

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] vanzin commented on a change in pull request #92: OpenSSL 1.1.0 updates with backward compatibility for OpenSSL 1.0.2 and 1.0.1

GitBox
vanzin commented on a change in pull request #92: OpenSSL 1.1.0 updates with backward compatibility for OpenSSL 1.0.2 and 1.0.1
URL: https://github.com/apache/commons-crypto/pull/92#discussion_r244818064
 
 

 ##########
 File path: src/main/java/org/apache/commons/crypto/jna/OpenSslNativeJna.java
 ##########
 @@ -20,271 +20,319 @@
 
 import java.nio.ByteBuffer;
 
-import com.sun.jna.Native;
+import com.sun.jna.Function;
+import com.sun.jna.NativeLibrary;
 import com.sun.jna.NativeLong;
 import com.sun.jna.ptr.PointerByReference;
 
 class OpenSslNativeJna {
 
-    static final int OPENSSL_INIT_ENGINE_RDRAND = 0x00000200;
-
-    static final int OOSL_JNA_ENCRYPT_MODE = 1;
-    static final int OOSL_JNA_DECRYPT_MODE = 0;
-
-    static final boolean INIT_OK;
-
-    static final Throwable INIT_ERROR;
-
-    static {
-        boolean ok = false;
-        Throwable thrown = null;
-        try {
-            Native.register("crypto");
-            ERR_load_crypto_strings();
-            ok = true;
-        } catch (Exception e) {
-            thrown = e;
-        } catch (UnsatisfiedLinkError e) {
-            thrown = e;
-        } finally {
-            INIT_OK = ok;
-            INIT_ERROR = thrown;
-        }
+  static final int OPENSSL_INIT_ENGINE_RDRAND = 0x00000200;
+
+  static final int OOSL_JNA_ENCRYPT_MODE = 1;
+  static final int OOSL_JNA_DECRYPT_MODE = 0;
+
+  static final boolean INIT_OK;
+
+  static final Throwable INIT_ERROR;
+
+  public static final long VERSION;
+  public static final long VERSION_1_0_X = 0x10000000;
+  public static final long VERSION_1_1_X = 0x10100000;
+
+  static {
+    NativeLibrary crypto = NativeLibrary.getInstance("crypto");
+    Function version = null;
+    try {
+      version = crypto.getFunction("SSLeay");
+      } catch (UnsatisfiedLinkError e) {
 
 Review comment:
   Indentation is off from here on.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[hidden email]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]