fix EVP_CIPHER_CTX_new's arg types
This commit is contained in:
parent
9fe3cf17d5
commit
f02e9a3132
1 changed files with 1 additions and 4 deletions
|
@ -49,8 +49,6 @@ def load_openssl():
|
||||||
libcrypto = CDLL(libcrypto_path)
|
libcrypto = CDLL(libcrypto_path)
|
||||||
libcrypto.EVP_get_cipherbyname.restype = c_void_p
|
libcrypto.EVP_get_cipherbyname.restype = c_void_p
|
||||||
libcrypto.EVP_CIPHER_CTX_new.restype = c_void_p
|
libcrypto.EVP_CIPHER_CTX_new.restype = c_void_p
|
||||||
libcrypto.EVP_CIPHER_CTX_new.argtypes = (c_void_p, c_void_p, c_char_p,
|
|
||||||
c_char_p)
|
|
||||||
|
|
||||||
libcrypto.EVP_CipherInit_ex.argtypes = (c_void_p, c_void_p, c_char_p,
|
libcrypto.EVP_CipherInit_ex.argtypes = (c_void_p, c_void_p, c_char_p,
|
||||||
c_char_p, c_char_p, c_int)
|
c_char_p, c_char_p, c_int)
|
||||||
|
@ -90,8 +88,7 @@ class CtypesCrypto(object):
|
||||||
raise Exception('cipher %s not found in libcrypto' % cipher_name)
|
raise Exception('cipher %s not found in libcrypto' % cipher_name)
|
||||||
key_ptr = c_char_p(key)
|
key_ptr = c_char_p(key)
|
||||||
iv_ptr = c_char_p(iv)
|
iv_ptr = c_char_p(iv)
|
||||||
self._ctx = libcrypto.EVP_CIPHER_CTX_new(cipher, None,
|
self._ctx = libcrypto.EVP_CIPHER_CTX_new()
|
||||||
key_ptr, iv_ptr)
|
|
||||||
if not self._ctx:
|
if not self._ctx:
|
||||||
raise Exception('can not create cipher context')
|
raise Exception('can not create cipher context')
|
||||||
r = libcrypto.EVP_CipherInit_ex(self._ctx, cipher, None,
|
r = libcrypto.EVP_CipherInit_ex(self._ctx, cipher, None,
|
||||||
|
|
Loading…
Reference in a new issue