update run_method()

This commit is contained in:
mengskysama 2018-02-18 23:21:20 +08:00
parent 2ab8c6bf5d
commit d8a5d9a132

View file

@ -408,22 +408,20 @@ ciphers = {
def run_method(method):
from shadowsocks.crypto import openssl
print(method, ': [stream]', 32)
cipher = MbedTLSStreamCrypto(method, b'k' * 32, b'i' * 16, 1)
decipher = openssl.OpenSSLStreamCrypto(method, b'k' * 32, b'i' * 16, 0)
decipher = MbedTLSStreamCrypto(method, b'k' * 32, b'i' * 16, 0)
util.run_cipher(cipher, decipher)
def run_aead_method(method, key_len=16):
from shadowsocks.crypto import openssl
print(method, ': [payload][tag]', key_len)
key_len = int(key_len)
cipher = MbedTLSAeadCrypto(method, b'k' * key_len, b'i' * key_len, 1)
decipher = openssl.OpenSSLAeadCrypto(
decipher = MbedTLSStreamCrypto(
method,
b'k' * key_len, b'i' * key_len, 0
)
@ -432,12 +430,11 @@ def run_aead_method(method, key_len=16):
def run_aead_method_chunk(method, key_len=16):
from shadowsocks.crypto import openssl
print(method, ': chunk([size][tag][payload][tag]', key_len)
key_len = int(key_len)
cipher = MbedTLSAeadCrypto(method, b'k' * key_len, b'i' * key_len, 1)
decipher = openssl.OpenSSLAeadCrypto(
decipher = MbedTLSStreamCrypto(
method,
b'k' * key_len, b'i' * key_len, 0
)