Fix memory leak(2)
This commit is contained in:
parent
6b43cbbf93
commit
df798627b9
3 changed files with 12 additions and 3 deletions
|
@ -155,9 +155,6 @@ class AeadCryptoBase(object):
|
||||||
# n, n > 0, waiting data
|
# n, n > 0, waiting data
|
||||||
self._chunk = {'mlen': AEAD_MSG_LEN_UNKNOWN, 'data': b''}
|
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
|
# load libsodium for nonce increment
|
||||||
if not sodium_loaded:
|
if not sodium_loaded:
|
||||||
crypto_path = dict(crypto_path) if crypto_path else dict()
|
crypto_path = dict(crypto_path) if crypto_path else dict()
|
||||||
|
|
|
@ -270,6 +270,12 @@ class OpenSSLAeadCrypto(OpenSSLCryptoBase, AeadCryptoBase):
|
||||||
self.cipher_ctx_init()
|
self.cipher_ctx_init()
|
||||||
return plaintext
|
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):
|
class OpenSSLStreamCrypto(OpenSSLCryptoBase):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -308,6 +308,12 @@ class SodiumAeadCrypto(AeadCryptoBase):
|
||||||
self.cipher_ctx_init()
|
self.cipher_ctx_init()
|
||||||
return buf.raw[:cipher_out_len.value]
|
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 = {
|
ciphers = {
|
||||||
'salsa20': (32, 8, SodiumCrypto),
|
'salsa20': (32, 8, SodiumCrypto),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue