Skip to content
This repository has been archived by the owner on Mar 1, 2018. It is now read-only.

Commit

Permalink
fix issue #11
Browse files Browse the repository at this point in the history
  • Loading branch information
yann2192 committed Mar 13, 2014
1 parent 8cd837b commit e52b21c
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions pyelliptic/openssl.py
Expand Up @@ -168,13 +168,21 @@ def __init__(self, library):
self.EVP_aes_256_cbc.restype = ctypes.c_void_p
self.EVP_aes_256_cbc.argtypes = []

self.EVP_aes_128_ctr = self._lib.EVP_aes_128_ctr
self.EVP_aes_128_ctr.restype = ctypes.c_void_p
self.EVP_aes_128_ctr.argtypes = []
try:
self.EVP_aes_128_ctr = self._lib.EVP_aes_128_ctr
except AttributeError:
pass
else:
self.EVP_aes_128_ctr.restype = ctypes.c_void_p
self.EVP_aes_128_ctr.argtypes = []

self.EVP_aes_256_ctr = self._lib.EVP_aes_256_ctr
self.EVP_aes_256_ctr.restype = ctypes.c_void_p
self.EVP_aes_256_ctr.argtypes = []
try:
self.EVP_aes_256_ctr = self._lib.EVP_aes_256_ctr
except AttributeError:
pass
else:
self.EVP_aes_256_ctr.restype = ctypes.c_void_p
self.EVP_aes_256_ctr.argtypes = []

self.EVP_aes_128_ofb = self._lib.EVP_aes_128_ofb
self.EVP_aes_128_ofb.restype = ctypes.c_void_p
Expand Down Expand Up @@ -290,13 +298,22 @@ def _set_ciphers(self):
'aes-256-cfb': CipherName('aes-256-cfb', self.EVP_aes_256_cfb128, 16),
'aes-128-ofb': CipherName('aes-128-ofb', self._lib.EVP_aes_128_ofb, 16),
'aes-256-ofb': CipherName('aes-256-ofb', self._lib.EVP_aes_256_ofb, 16),
'aes-128-ctr': CipherName('aes-128-ctr', self._lib.EVP_aes_128_ctr, 16),
'aes-256-ctr': CipherName('aes-256-ctr', self._lib.EVP_aes_256_ctr, 16),
# 'aes-128-ctr': CipherName('aes-128-ctr', self._lib.EVP_aes_128_ctr, 16),
# 'aes-256-ctr': CipherName('aes-256-ctr', self._lib.EVP_aes_256_ctr, 16),
'bf-cfb': CipherName('bf-cfb', self.EVP_bf_cfb64, 8),
'bf-cbc': CipherName('bf-cbc', self.EVP_bf_cbc, 8),
'rc4': CipherName('rc4', self.EVP_rc4, 128), # 128 is the initialisation size not block size
}

if hasattr(self, 'EVP_aes_128_ctr'):
self.cipher_algo['aes-128-ctr'] = CipherName('aes-128-ctr',
self._lib.EVP_aes_128_ctr,
16)
if hasattr(self, 'EVP_aes_256_ctr'):
self.cipher_algo['aes-256-ctr'] = CipherName('aes-256-ctr',
self._lib.EVP_aes_256_ctr,
16)

def _set_curves(self):
self.curves = {
'secp112r1': 704,
Expand Down

0 comments on commit e52b21c

Please sign in to comment.