undefined symbol: EVP_CIPHER_CTX_cleanup
openssl升级到1.1.0以上版本,应用启动报undefined symbol: EVP_CIPHER_CTX_cleanup错误。
File "/usr/local/bin/sslocal", line 11, in <module>
load_entry_point('shadowsocks==2.8.2', 'console_scripts', 'sslocal')()
File "/usr/local/lib/python3.6/site-packages/shadowsocks/local.py", line 39, in main
config = shell.get_config(True)
File "/usr/local/lib/python3.6/site-packages/shadowsocks/shell.py", line 262, in get_config
check_config(config, is_local)
File "/usr/local/lib/python3.6/site-packages/shadowsocks/shell.py", line 124, in check_config
encrypt.try_cipher(config['password'], config['method'])
File "/usr/local/lib/python3.6/site-packages/shadowsocks/encrypt.py", line 44, in try_cipher
Encryptor(key, method)
File "/usr/local/lib/python3.6/site-packages/shadowsocks/encrypt.py", line 83, in __init__
random_string(self._method_info[1]))
File "/usr/local/lib/python3.6/site-packages/shadowsocks/encrypt.py", line 109, in get_cipher
return m[2](method, key, iv, op)
File "/usr/local/lib/python3.6/site-packages/shadowsocks/crypto/openssl.py", line 76, in __init__
load_openssl()
File "/usr/local/lib/python3.6/site-packages/shadowsocks/crypto/openssl.py", line 52, in load_openssl
libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
File "/usr/lib64/python3.6/ctypes/__init__.py", line 356, in __getattr__
func = self.__getitem__(name)
File "/usr/lib64/python3.6/ctypes/__init__.py", line 361, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
这个问题是由于在openssl1.1.0版本中,废弃了EVP_CIPHER_CTX_cleanup函数。官网解释
EVP_CIPHER_CTX was made opaque in OpenSSL 1.1.0. As a result, EVP_CIPHER_CTX_reset() appeared and EVP_CIPHER_CTX_cleanup() disappeared.
修复
把用到 EVP_CIPHER_CTX_cleanup
的改成EVP_CIPHER_CTX_reset
。
修复例子
im /usr/local/lib/python3.6/site-packages/shadowsocks/crypto/openssl.py
将第52行libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
改为libcrypto.EVP_CIPHER_CTX_reset.argtypes = (c_void_p,)再次搜索cleanup(全文件共2处,此处位于111行),将libcrypto.EVP_CIPHER_CTX_cleanup(self._ctx)
改为libcrypto.EVP_CIPHER_CTX_reset(self._ctx)
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦