title: What does mean SSL_library_init is not reentrant for practical purposes?
body: <p>I'm using openssl library to open a TLS connexion to some server. Reading the library documentation (yes, some people still read documentations and man pages) I stumbled upon the sentence "SSL_libary_init() is not <a href="https://stackoverflow.com/questions/2799023/what-exactly-is-a-reentrant-function">reentrant</a>".</p>
  
  <p>I understand generally speaking what is a non reentrant function: ie some function that keeps an internal state in such a way that calling it twice at the same time or interrupting it while it executes may cause mayhem (the function not doing what callers are expecting).</p>
  
  <p>But in the specific case of SSL_library_init() I wonder what it actually means.</p>
  
  <ul>
  <li><p>does it mean that if some interrupt occurs while calling SSL_library_init() it won't correctly initialize SSL library ? Hence am I supposed to disable all accessible interrupts before calling it and reenable the needed ones aftwerward ?</p></li>
  <li><p>does it means that it's thread unsafe, and that I should ensure that two threads can't call it at the same time ? (looks likely, even if thread safety does not exactly means the same as reentrant).</p></li>
  <li><p>does it means I should'nt call it two times in the program lifetime, or that calling it while SSL connections are open it will wreak havoc ?</p></li>
  </ul>
  
  <p>AS I'm working on a proxy with one end being client and the other one being server, both ends could potentially be using TLS services, (but i could also be only one end, or none). Should I manage SSL library as a system wide singleton ? If this is the case it's easy enough to manage but it is not exactly a reentracy issue as I understand the word. </p>
  
  <p>I do not know the short word for a function that should only be called once...</p>
  
  <p>I also have a similar question for SSL_CTX_new(). The documentation states it should only be called once per program lifetime. This is annoying as it seems to restrict both server and client (or several independant server or client instances running in the same process) to use the same SSL_METHOD and it does not feel right, but I still hope in this case it's merely some documentation inaccuracy.</p>
  
  <p>Does anyone have enough experience with openSSL to explain what I should or should not do with OpenSSL initialisations code to stay on the safe side ?</p>