X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=ctypescrypto%2Fcipher.py;h=4c9ff76b4db6781818cf0314e4226ba9f82192ac;hb=06ce3387113bc54ba6dcd24095d29e2a0010e0e4;hp=d4035c1a34a8a5ec909578491b19a7cc5670138b;hpb=287e8a5b1d7f5a8129619f733adbfc8b2de3e4c7;p=oss%2Fctypescrypto.git diff --git a/ctypescrypto/cipher.py b/ctypescrypto/cipher.py index d4035c1..4c9ff76 100644 --- a/ctypescrypto/cipher.py +++ b/ctypescrypto/cipher.py @@ -229,7 +229,7 @@ class Cipher(object): """ try: if self.ctx is not None: - libcrypto.EVP_CIPHER_CTX_cleanup(self.ctx) + self.__ctxcleanup(self.ctx) libcrypto.EVP_CIPHER_CTX_free(self.ctx) del self.ctx except AttributeError: @@ -241,7 +241,14 @@ class Cipher(object): # Used C function block_size # libcrypto.EVP_CIPHER_block_size.argtypes = (c_void_p, ) -libcrypto.EVP_CIPHER_CTX_cleanup.argtypes = (c_void_p, ) + +#Function EVP_CIPHER_CTX_cleanup renamed to EVP_CIPHER_CTX_reset +# in the OpenSSL 1.1.0 +if hasattr(libcrypto,"EVP_CIPHER_CTX_cleanup"): + Cipher.__ctxcleanup = libcrypto.EVP_CIPHER_CTX_cleanup +else: + Cipher.__ctxcleanup = libcrypto.EVP_CIPHER_CTX_reset +Cipher.__ctxcleanup.argtypes = (c_void_p, ) libcrypto.EVP_CIPHER_CTX_free.argtypes = (c_void_p, ) libcrypto.EVP_CIPHER_CTX_new.restype = c_void_p libcrypto.EVP_CIPHER_CTX_set_padding.argtypes = (c_void_p, c_int)