1. 程式人生 > >sslocal客戶端執行報錯(python3.7)

sslocal客戶端執行報錯(python3.7)

基礎資訊:

平臺:manjaro

python3.7

 
INFO: loading config from /home/admin/shadowsocks/shadowsocksconfig.json
2018-10-19 18:23:04 INFO     loading libcrypto from libcrypto.so.1.1
Traceback (most recent call last):
  File "/usr/bin/sslocal", line 11, in <module>
    load_entry_point('shadowsocks==2.8.2', 'console_scripts', 'sslocal')()
  File "/usr/lib/python3.7/site-packages/shadowsocks/local.py", line 39, in main
    config = shell.get_config(True)
  File "/usr/lib/python3.7/site-packages/shadowsocks/shell.py", line 262, in get_config
    check_config(config, is_local)
  File "/usr/lib/python3.7/site-packages/shadowsocks/shell.py", line 124, in check_config
    encrypt.try_cipher(config['password'], config['method'])
  File "/usr/lib/python3.7/site-packages/shadowsocks/encrypt.py", line 44, in try_cipher
    Encryptor(key, method)
  File "/usr/lib/python3.7/site-packages/shadowsocks/encrypt.py", line 83, in __init__
    random_string(self._method_info[1]))
  File "/usr/lib/python3.7/site-packages/shadowsocks/encrypt.py", line 109, in get_cipher
    return m[2](method, key, iv, op)
  File "/usr/lib/python3.7/site-packages/shadowsocks/crypto/openssl.py", line 76, in __init__
    load_openssl()
  File "/usr/lib/python3.7/site-packages/shadowsocks/crypto/openssl.py", line 52, in load_openssl
    libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,)
  File "/usr/lib/python3.7/ctypes/__init__.py", line 369, in __getattr__
    func = self.__getitem__(name)
  File "/usr/lib/python3.7/ctypes/__init__.py", line 374, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/libcrypto.so.1.1: undefined symbol: EVP_CIPHER_CTX_cleanup

問題的導致是openssl版本更新,裡面的函式卻沒有跟上版本而造成的。

修改方法:

vim /usr/lib/python3.7/site-packages/shadowsocks/crypto/openssl.py      


# 修改地方1, 52行
libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p,) 

改成:libcrypto.EVP_CIPHER_CTX_reset.argtypes = (c_void_p,)

# 修改地方2, 111
libcrypto.EVP_CIPHER_CTX_cleanup(self._ctx) 
改成:libcrypto.EVP_CIPHER_CTX_reset(self._ctx)