diff options
| author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-10-03 21:54:05 -0500 |
|---|---|---|
| committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2013-10-06 17:31:31 -0500 |
| commit | f2ce1ae856e43a292ea7a6aae26d75b508f0a363 (patch) | |
| tree | d973c676ff4e4c7925abd9bb1a3b2fbac11bc62a /cryptography | |
| parent | efe0189de0714bbde76082566d0f82df1439cb63 (diff) | |
| download | cryptography-f2ce1ae856e43a292ea7a6aae26d75b508f0a363.tar.gz cryptography-f2ce1ae856e43a292ea7a6aae26d75b508f0a363.tar.bz2 cryptography-f2ce1ae856e43a292ea7a6aae26d75b508f0a363.zip | |
rebase and modify to support some changed behaviors
* Update code to reflect new api object (ffi and lib are no longer private)
* tests updated to take an api object
* skipif marks removed for now as we need to use the api passed to each
individual test. skip testing done inside the test
* changed name of supports in api to supports_cipher (future PRs will
contain supports_hash)
Diffstat (limited to 'cryptography')
| -rw-r--r-- | cryptography/bindings/openssl/api.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/cryptography/bindings/openssl/api.py b/cryptography/bindings/openssl/api.py index 073cb532..c352d3b2 100644 --- a/cryptography/bindings/openssl/api.py +++ b/cryptography/bindings/openssl/api.py @@ -72,9 +72,9 @@ class API(object): """ return self.ffi.string(self.lib.OPENSSL_VERSION_TEXT).decode("ascii") - def supports(self, ciphername): - return (self._ffi.NULL != - self._lib.EVP_get_cipherbyname(ciphername.encode("ascii"))) + def supports_cipher(self, ciphername): + return (self.ffi.NULL != + self.lib.EVP_get_cipherbyname(ciphername.encode("ascii"))) def create_block_cipher_context(self, cipher, mode): ctx = self.ffi.new("EVP_CIPHER_CTX *") @@ -85,9 +85,8 @@ class API(object): ciphername = "{0}-{1}-{2}".format( cipher.name, cipher.key_size, mode.name ).lower() - evp_cipher = self._lib.EVP_get_cipherbyname(ciphername.encode("ascii")) - if evp_cipher == self._ffi.NULL: - raise AssertionError("Unsupported cipher: {0}".format(ciphername)) + evp_cipher = self.lib.EVP_get_cipherbyname(ciphername.encode("ascii")) + assert evp_cipher != self.ffi.NULL if isinstance(mode, interfaces.ModeWithInitializationVector): iv_nonce = mode.initialization_vector else: |
