Fix memory leak(2)
This commit is contained in:
parent
6b43cbbf93
commit
df798627b9
|
@ -155,9 +155,6 @@ class AeadCryptoBase(object):
|
|||
# n, n > 0, waiting data
|
||||
self._chunk = {'mlen': AEAD_MSG_LEN_UNKNOWN, 'data': b''}
|
||||
|
||||
self.encrypt_once = self.aead_encrypt
|
||||
self.decrypt_once = self.aead_decrypt
|
||||
|
||||
# load libsodium for nonce increment
|
||||
if not sodium_loaded:
|
||||
crypto_path = dict(crypto_path) if crypto_path else dict()
|
||||
|
|
|
@ -270,6 +270,12 @@ class OpenSSLAeadCrypto(OpenSSLCryptoBase, AeadCryptoBase):
|
|||
self.cipher_ctx_init()
|
||||
return plaintext
|
||||
|
||||
def encrypt_once(self, data):
|
||||
return self.aead_encrypt(data)
|
||||
|
||||
def decrypt_once(self, data):
|
||||
return self.aead_decrypt(data)
|
||||
|
||||
|
||||
class OpenSSLStreamCrypto(OpenSSLCryptoBase):
|
||||
"""
|
||||
|
|
|
@ -308,6 +308,12 @@ class SodiumAeadCrypto(AeadCryptoBase):
|
|||
self.cipher_ctx_init()
|
||||
return buf.raw[:cipher_out_len.value]
|
||||
|
||||
def encrypt_once(self, data):
|
||||
return self.aead_encrypt(data)
|
||||
|
||||
def decrypt_once(self, data):
|
||||
return self.aead_decrypt(data)
|
||||
|
||||
|
||||
ciphers = {
|
||||
'salsa20': (32, 8, SodiumCrypto),
|
||||
|
|
Loading…
Reference in New Issue