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_r244819839
 
 

 ##########
 File path: src/main/native/org/apache/commons/crypto/OpenSslInfoNative.c
 ##########
 @@ -98,24 +84,26 @@ static int load_library(JNIEnv *env)
   return 1;
 }
 
-JNIEXPORT jstring JNICALL 
Java_org_apache_commons_crypto_OpenSslInfoNative_SSLeayVersion
-    (JNIEnv *env, jclass clazz, jint type)
+#ifdef UNIX
+static void get_methods(JNIEnv *env, void *openssl)
+#endif
+#ifdef WINDOWS
+static void get_methods(JNIEnv *env, HMODULE openssl)
+#endif
 {
-    if (!load_library(env)) {
-        return NULL;
-    }
-
-    jstring answer = (*env)->NewStringUTF(env,dlsym_SSLeay_version(type));
-    return answer;
-}
+#ifdef UNIX
+  dlerror();  // Clear any existing error
+#if OPENSSL_VERSION_NUMBER > VERSION_1_1_x
+  LOAD_DYNAMIC_SYMBOL(dlsym_OpenSSL_version_num, env, openssl, 
"OpenSSL_version_num");
+  LOAD_DYNAMIC_SYMBOL(dlsym_OpenSSL_version, env, openssl, "OpenSSL_version");
+#elif OPENSSL_VERSION_NUMBER > VERSION_1_0_x
+  LOAD_DYNAMIC_SYMBOL(dlsym_OpenSSL_version_num, env, openssl, "SSLeay");
+  LOAD_DYNAMIC_SYMBOL(dlsym_OpenSSL_version, env, openssl, "SSLeay_version");
+#endif
+#endif
 
-JNIEXPORT jlong JNICALL Java_org_apache_commons_crypto_OpenSslInfoNative_SSLeay
-    (JNIEnv *env, jobject object)
-{
-    if (!load_library(env)) {
-        return 0;
-    }
-    return dlsym_SSLeay();
+#ifdef WINDOWS
 
 Review comment:
   ?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to