diff options
author | Mohammed Attia <skeuomorf@gmail.com> | 2014-03-08 11:03:06 +0200 |
---|---|---|
committer | Mohammed Attia <skeuomorf@gmail.com> | 2014-04-02 04:49:54 +0200 |
commit | 5aefc9f47f0dff59389ad847950cfd5c9ae8c023 (patch) | |
tree | f410dfb7f9b7fe43047a37e6a013af1de039b519 | |
parent | e3fac5cafbdc57090295bad0acbdbced2821849f (diff) | |
download | cryptography-5aefc9f47f0dff59389ad847950cfd5c9ae8c023.tar.gz cryptography-5aefc9f47f0dff59389ad847950cfd5c9ae8c023.tar.bz2 cryptography-5aefc9f47f0dff59389ad847950cfd5c9ae8c023.zip |
Add key_size to GC
-rw-r--r-- | cryptography/hazmat/backends/openssl/backend.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py index 65e3df47..ca3992fe 100644 --- a/cryptography/hazmat/backends/openssl/backend.py +++ b/cryptography/hazmat/backends/openssl/backend.py @@ -419,8 +419,11 @@ class Backend(object): assert ctx != self._ffi.NULL ctx = self._ffi.gc(ctx, self._lib.DSA_free) + bn = self._int_to_bn(key_size) + bn = self._ffi.gc(bn, self._lib.BN_free) + res = self._lib.DSA_generate_parameters_ex( - ctx, key_size, self._ffi.NULL, self._ffi.NULL, + ctx, bn, self._ffi.NULL, self._ffi.NULL, self._ffi.NULL, self._ffi.NULL ) @@ -445,7 +448,9 @@ class Backend(object): if key_size not in (1024, 2048, 3072): raise ValueError("Key size must be 1024 or 2048 or" "3072 bits") - self.generate_dsa_parameters(key_size, ctx) + bn = self._int_to_bn(key_size) + bn = self._ffi.gc(bn, self._lib.BN_free) + self.generate_dsa_parameters(bn, ctx) self._lib.DSA_generate_key(ctx) @@ -463,6 +468,7 @@ class Backend(object): else: return isinstance(algorithm, hashes.SHA1) + class GetCipherByName(object): def __init__(self, fmt): self._fmt = fmt |