Alternative to static linking OpenSSL

21 views Asked by At

I am working on a shared library loaded into application that uses libcurl and libopenssl+libcrypto. For certain reasons I have to override memory allocation functions, using curl_global_init_mem and CRYPTO_set_mem_functions. I could ensure time-separation of application and my library calling into these, but at least CRYPTO_set_mem_functions looks like it does not allow to cleanup & unset those functions (despite I can read the original ones). In general, I don't want to break whatever the application is doing.

Is there any alternative to statically linking all the libraries into my shared library? (Size is not that important but I'd miss OS security updates). As my library is loaded after the application starts, I cannot do any LD_PRELOAD tricks. Non-portable (Linux-only) solutions are acceptable.

EDIT: I found that while the allocations made by OpenSSL itself are configurable, in fact there are different (e.g. libc) functions called by the code that do allocate using regular malloc anyway. So in the end I have to invoke my 'plugin' code in a separate process (where I don't have to override those functions) and communicate with the main application with simple IPC (pipes in my case).

0

There are 0 answers