title: OpenSSL on mutli-core machine
body: <p>I'm doing my first steps into the OpenSSL lib and feel a bit lost. My machine is a multi-threaded (Xeon series, can share more if someone need the info) with Linux OS.</p>
  
  <p>The application build is SSL-Proxy thus I need to handle multiple TCP flows as fast as possible, meaning I want to run the lib as lock-less as possible.</p>
  
  <p>After looking a bit inside <code>crypto/crypto.h</code> mainly on this section:</p>
  
  <pre><code># ifndef OPENSSL_NO_LOCKING
  #  ifndef CRYPTO_w_lock
  #   define CRYPTO_w_lock(type)     \
          CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
  #   define CRYPTO_w_unlock(type)   \
          CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
  #   define CRYPTO_r_lock(type)     \
          CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
  #   define CRYPTO_r_unlock(type)   \
          CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
  #   define CRYPTO_add(addr,amount,type)    \
          CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
  #  endif
  </code></pre>
  
  <p>I was trying to dig in the code/API and got a bit lost. My questions are:</p>
  
  <ul>
  <li>What support does OpenSSL lib have for multi-core/thread applications?</li>
  <li>What parts of the lib can have only one instance (singleton)?</li>
  </ul>