Explicit thread cleanup in OpenSSL 1.1.1 possible?

Stephan Mühlstrasser stm at pdflib.com
Fri Mar 27 13:13:54 UTC 2020


with OpenSSL 1.1.1 it is possible to turn off the automatic cleanup with 
an atexit() handler by passing the flag OPENSSL_INIT_NO_ATEXIT to 

Is it possible to configure this also at the thread level, so that no 
automatic thread cleanup occurs, with the option to do an explicit 
per-thread cleanup? I looked at documentation and source code of OpenSSL 
1.1.1 and this seems not to be possible, but I wanted to ask nevertheless.

Background: We are embedding OpenSSL in a Java JNI library, and one 
particular JVM (IBM J9 on z/OS) loads our Java class and the JNI library 
in a dedicated thread. At the end of the program the JVM then unloads 
the the Java class and the JNI library before the thread terminates, and 
when the OpenSSL thread cleanup functions are called the JVM crashes 
because the shared library is gone from the address space. This happens 
because the pinning of the OpenSSL shared library does not work on z/OS.


More information about the openssl-users mailing list