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_r257416402
 
 

 ##########
 File path: 
src/main/native/org/apache/commons/crypto/org_apache_commons_crypto.h
 ##########
 @@ -94,11 +94,30 @@ void *do_dlsym(JNIEnv *env, void *handle, const char 
*symbol) {
   return func_ptr;
 }
 
+static __attribute__ ((unused))
+void *do_version_dlsym(JNIEnv *env, void *handle) {
+  if (!env || !handle) {
+         THROW(env, "java/lang/InternalError", NULL);
+         return NULL;
+  }
+  void *func_ptr = dlsym(handle, "OpenSSL_version_num");
+  if (func_ptr == NULL) {
+         func_ptr = dlsym(handle, "SSLeay");
+  }
+  return func_ptr;
+}
+
 /* A helper macro to dlsym the requisite dynamic symbol and bail-out on error. 
*/
 #define LOAD_DYNAMIC_SYMBOL(func_ptr, env, handle, symbol) \
   if ((func_ptr = do_dlsym(env, handle, symbol)) == NULL) { \
     return; \
   }
+
+/* A macro to dlsym the appropriate OpenSSL version number function. */
+#define LOAD_OPENSSL_VERSION_FUNCTION(func_ptr, env, handle) \
+if ((func_ptr = do_version_dlsym(env, handle)) == NULL) { \
+       THROW(env, "java/lang/Error", NULL); \
 
 Review comment:
   and here; also the body of the macro should be indented a bit (see macro 
above)

----------------------------------------------------------------
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