lint code

This commit is contained in:
clowwindy 2014-10-31 16:14:28 +08:00
parent c553e7a725
commit 89dc6031e8
2 changed files with 8 additions and 6 deletions

View file

@ -9,10 +9,11 @@ cache:
before_install: before_install:
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -qq build-essential libssl-dev swig python-m2crypto python-numpy dnsutils - 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 - sudo tests/socksify/install.sh
script: script:
- pep8 . - pep8 .
- pyflakes .
- python tests/nose_plugin.py - python tests/nose_plugin.py
- python tests/test.py -c tests/table.json - python tests/test.py -c tests/table.json
- python tests/test.py -c tests/aes.json - python tests/test.py -c tests/aes.json

View file

@ -21,19 +21,20 @@
# SOFTWARE. # SOFTWARE.
import logging import logging
from ctypes import CDLL, c_char_p, c_int, c_long, byref,\
create_string_buffer, c_void_p
__all__ = ['ciphers'] __all__ = ['ciphers']
libcrypto = None
loaded = False loaded = False
buf_size = 2048 buf_size = 2048
def load_openssl(): def load_openssl():
global loaded, libcrypto, CDLL, c_char_p, c_int, c_long, byref,\ global loaded, libcrypto, buf
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
from ctypes.util import find_library from ctypes.util import find_library
for p in ('crypto', 'eay32', 'libeay32'): for p in ('crypto', 'eay32', 'libeay32'):
libcrypto_path = find_library(p) libcrypto_path = find_library(p)
@ -152,7 +153,7 @@ def test():
BLOCK_SIZE = 16384 BLOCK_SIZE = 16384
rounds = 1 * 1024 rounds = 1 * 1024
plain = urandom(BLOCK_SIZE * rounds) plain = urandom(BLOCK_SIZE * rounds)
import M2Crypto.EVP # import M2Crypto.EVP
# cipher = M2Crypto.EVP.Cipher('aes_128_cfb', 'k' * 32, 'i' * 16, 1, # cipher = M2Crypto.EVP.Cipher('aes_128_cfb', 'k' * 32, 'i' * 16, 1,
# key_as_bytes=0, d='md5', salt=None, i=1, # key_as_bytes=0, d='md5', salt=None, i=1,
# padding=1) # padding=1)