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.
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.
After looking a bit inside crypto/crypto.h
mainly on this section:
# 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
I was trying to dig in the code/API and got a bit lost. My questions are:
- What support does OpenSSL lib have for multi-core/thread applications?
- What parts of the lib can have only one instance (singleton)?