mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
openssl: support OpenSSL 1.1.0's new multi-threading API
* ext/openssl/extconf.rb: Check absence of CRYPTO_lock() to see if the OpenSSL has the new threading API. In OpenSSL <= 1.0.2, an application had to set locking callbacks to use OpenSSL in a multi-threaded environment. OpenSSL 1.1.0 now finds pthreads or Windows threads so we don't need to do something special. [ruby-core:75225] [Feature #12324] Also check existence of *_up_ref(). Some structures in OpenSSL have a reference counter. We used to increment it with CRYPTO_add() which is a part of the old API. * ext/openssl/openssl_missing.h: Implement *_up_ref() if missing. * ext/openssl/ossl.c: Don't set locking callbacks if unneeded. * ext/openssl/ossl_pkey.c, ext/openssl/ossl_ssl.c, ext/openssl/ossl_x509cert.c, ext/openssl/ossl_x509crl.c, ext/openssl/ossl_x509store.c: Use *_up_ref() instead of CRYPTO_add(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9199bec9e8
commit
e478bb7d79
9 changed files with 73 additions and 12 deletions
|
@ -45,4 +45,29 @@ int EC_curve_nist2nid(const char *);
|
|||
(newf), (dupf), (freef))
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_X509_UP_REF)
|
||||
# define X509_up_ref(x) \
|
||||
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509)
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_X509_CRL_UP_REF)
|
||||
# define X509_CRL_up_ref(x) \
|
||||
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509_CRL);
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_X509_STORE_UP_REF)
|
||||
# define X509_STORE_up_ref(x) \
|
||||
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_X509_STORE);
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SSL_SESSION_UP_REF)
|
||||
# define SSL_SESSION_up_ref(x) \
|
||||
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_SSL_SESSION);
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_EVP_PKEY_UP_REF)
|
||||
# define EVP_PKEY_up_ref(x) \
|
||||
CRYPTO_add(&(x)->references, 1, CRYPTO_LOCK_EVP_PKEY);
|
||||
#endif
|
||||
|
||||
#endif /* _OSSL_OPENSSL_MISSING_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue