mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Avoid race condition when initializing OpenSSL
This commit is contained in:
parent
864d4be0c3
commit
f758a100cb
1 changed files with 7 additions and 7 deletions
|
@ -55,6 +55,13 @@ def _init_libcrypto():
|
|||
'''
|
||||
libcrypto = _load_libcrypto()
|
||||
|
||||
try:
|
||||
libcrypto.OPENSSL_init_crypto()
|
||||
except AttributeError:
|
||||
# Support for OpenSSL < 1.1 (OPENSSL_API_COMPAT < 0x10100000L)
|
||||
libcrypto.OPENSSL_no_config()
|
||||
libcrypto.OPENSSL_add_all_algorithms_noconf()
|
||||
|
||||
libcrypto.RSA_new.argtypes = ()
|
||||
libcrypto.RSA_new.restype = c_void_p
|
||||
libcrypto.RSA_free.argtypes = (c_void_p, )
|
||||
|
@ -69,13 +76,6 @@ def _init_libcrypto():
|
|||
libcrypto.RSA_private_encrypt.argtypes = (c_int, c_char_p, c_char_p, c_void_p, c_int)
|
||||
libcrypto.RSA_public_decrypt.argtypes = (c_int, c_char_p, c_char_p, c_void_p, c_int)
|
||||
|
||||
try:
|
||||
libcrypto.OPENSSL_init_crypto()
|
||||
except AttributeError:
|
||||
# Support for OpenSSL < 1.1 (OPENSSL_API_COMPAT < 0x10100000L)
|
||||
libcrypto.OPENSSL_no_config()
|
||||
libcrypto.OPENSSL_add_all_algorithms_noconf()
|
||||
|
||||
return libcrypto
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue