Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1349 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

libcrypto need to be loaded directly on mac

Reported by: fawzi Assigned to: Nietsnie
Priority: major Milestone: 0.99.8
Component: Core Functionality Version: 0.99.7 Dominik
Keywords: Cc:

Description

with two level namespaces (the default on 10.5) loading a library does not resolve all the imports of dependent sub libraries. so loading ssllib does not give access to crypto, and one has to do it separately.

Index: tango/net/c/OpenSSL.d
===================================================================
--- tango/net/c/OpenSSL.d	(revision 4065)
+++ tango/net/c/OpenSSL.d	(working copy)
@@ -584,6 +584,9 @@
 {
     static SharedLib eaylib = null;
 }
+version(darwin){
+    static SharedLib cryptolib = null;
+}
 static ReadWriteMutex[] _locks = null;
 
 
@@ -822,7 +825,13 @@
         bindFunc(SSL_CTX_set_session_id_context, "SSL_CTX_set_session_id_context", ssllib);
         version(Posix)
         {
-            bindCrypto(ssllib);
+            version(darwin){
+                char[][] loadPathCrypto = [ "/usr/lib/libcrypto.dylib", "libcrypto.dylib" ];
+                cryptolib = loadLib(loadPathCrypto);
+                if (cryptolib !is null) bindCrypto(cryptolib);
+            } else {
+                bindCrypto(ssllib);
+            }
         }
 
         _initOpenSSL();
@@ -847,6 +856,10 @@
     CRYPTO_cleanup_all_ex_data();
     if (ssllib)
         ssllib.unload();
+    version(darwin){
+        if (cryptolib)
+            cryptolib.unload();
+    }
     version(Win32)
     {
         if (eaylib)

Change History

11/02/08 03:27:32 changed by kris

  • owner changed from sean to Nietsnie.

11/05/08 13:50:48 changed by Nietsnie

  • status changed from new to assigned.

Weird, I thought I had added this support already. It must have been in that bunch of OSX patches I had on my macbook before the hard-drive died.

I'll try and get this in as soon as I have a moment.

11/19/08 15:53:35 changed by fawzi

add to it that EVP_CIPHER_CTX_block_size is not defined (at least on mac) it is only a macro.

01/19/09 11:47:08 changed by fawzi

Hi Nietsnie, any progress? should I check it in?

the EVP_CIPHER_CTX_block_size in "OpenSSL 0.9.7l 28 Sep 2006" (the one installed on 10.5) is just a macro. Then the realized the error and later OpenSSL called the macros M_ EVP_CIPHER_CTX_block_size an did still define the function... but that is not the case on mac 10.5

I am not fully sure about the best solution for that... (but the rest can be checked in without problem)

01/20/09 18:43:37 changed by Nietsnie

Sure go ahead and check it in. If you want, just make the EVP_CIPHER_CTX_block_size a regular function and don't setup a function pointer to it. Have it emulate the OpenSSL macro.

Sorry I'm a bit slow on this, been moving and don't have access to my PCs atm.

01/28/09 10:00:14 changed by fawzi

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [4298]) making OpenSSL work on mac 10.5, using c_ulong (plus comment about to do for using it more consistently) fix #1349