chriskohlhoff / asio

Asio C++ Library
http://think-async.com/Asio
4.97k stars 1.22k forks source link

Disable OpenSSL auto initialization #708

Open ghost opened 3 years ago

ghost commented 3 years ago

@dmorilha-twilio commented on Jul 25, 2019, 9:24 PM UTC:

We use boost asio together with other libraries which depend on OpenSSL. Currently OpenSSL is initialized multiple times. We would like to be able to disable openssl initialization in boost asio.

During a small investigation, I was able to find this issue that somewhat describes the problem: chriskohlhoff/asio#73

Going further into the investigation, I found openssl_init class which has a boolean template parameter. Unfortunately this class is poorly documented and of nontrivial understanding.

When trying to instantiate the templated class with false I saw no differences. As a matter of fact, nm shows both instances in the data section:

0000000100048480 D boost::asio::ssl::detail::openssl_init<false>::instance_
0000000100048448 D boost::asio::ssl::detail::openssl_init<true>::instance_

It would be awesome to understand how this functionality works, preferably with an example.

This issue was moved by chriskohlhoff from boostorg/asio#265.

sandym commented 3 years ago

We have perfectly working code that uses asio for ssl networking. But now trying to use it from an apache module causes crashes because of this I think. Openssl gets initialised/deinitialised by mod_ssl AND asio.

sandym commented 3 years ago

So the problem was this: https://bz.apache.org/bugzilla/show_bug.cgi?id=60947 Found a work around