diff --git a/.travis.yml b/.travis.yml index a430a71..9dcb1bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,10 +9,11 @@ cache: before_install: - sudo apt-get update -qq - sudo apt-get install -qq build-essential libssl-dev swig python-m2crypto python-numpy dnsutils - - pip install m2crypto salsa20 pep8 nose + - pip install m2crypto salsa20 pep8 pyflakes nose - sudo tests/socksify/install.sh script: - pep8 . + - pyflakes . - python tests/nose_plugin.py - python tests/test.py -c tests/table.json - python tests/test.py -c tests/aes.json diff --git a/shadowsocks/crypto/ctypes_openssl.py b/shadowsocks/crypto/ctypes_openssl.py index 9c8386b..2f4947a 100644 --- a/shadowsocks/crypto/ctypes_openssl.py +++ b/shadowsocks/crypto/ctypes_openssl.py @@ -21,19 +21,20 @@ # SOFTWARE. import logging +from ctypes import CDLL, c_char_p, c_int, c_long, byref,\ + create_string_buffer, c_void_p __all__ = ['ciphers'] +libcrypto = None loaded = False buf_size = 2048 def load_openssl(): - global loaded, libcrypto, CDLL, c_char_p, c_int, c_long, byref,\ - create_string_buffer, c_void_p, buf - from ctypes import CDLL, c_char_p, c_int, c_long, byref,\ - create_string_buffer, c_void_p + global loaded, libcrypto, buf + from ctypes.util import find_library for p in ('crypto', 'eay32', 'libeay32'): libcrypto_path = find_library(p) @@ -152,7 +153,7 @@ def test(): BLOCK_SIZE = 16384 rounds = 1 * 1024 plain = urandom(BLOCK_SIZE * rounds) - import M2Crypto.EVP + # import M2Crypto.EVP # cipher = M2Crypto.EVP.Cipher('aes_128_cfb', 'k' * 32, 'i' * 16, 1, # key_as_bytes=0, d='md5', salt=None, i=1, # padding=1)