diff options
author | Alex Stapleton <alexs@prol.etari.at> | 2014-03-16 10:41:59 +0000 |
---|---|---|
committer | Alex Stapleton <alexs@prol.etari.at> | 2014-03-16 10:41:59 +0000 |
commit | 439d42b325019b06e6bd6f075afbd6fc17f4b244 (patch) | |
tree | 05fd0210b449426da009efa58ef35907717e220d /cryptography | |
parent | 0b02bdd956663c52759a519a42a3f56e0d5e5b53 (diff) | |
download | cryptography-439d42b325019b06e6bd6f075afbd6fc17f4b244.tar.gz cryptography-439d42b325019b06e6bd6f075afbd6fc17f4b244.tar.bz2 cryptography-439d42b325019b06e6bd6f075afbd6fc17f4b244.zip |
Just EVP_PKEY GC free the contained keys.
Fortunately we never use these bare.
Diffstat (limited to 'cryptography')
-rw-r--r-- | cryptography/hazmat/backends/openssl/backend.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py index 27f0b6e3..3d00021b 100644 --- a/cryptography/hazmat/backends/openssl/backend.py +++ b/cryptography/hazmat/backends/openssl/backend.py @@ -345,9 +345,10 @@ class Backend(object): ) def _rsa_cdata_from_private_key(self, private_key): + # Does not GC the RSA cdata. You *must* make sure it's freed + # correctly yourself! ctx = self._lib.RSA_new() assert ctx != self._ffi.NULL - ctx = self._ffi.gc(ctx, self._lib.RSA_free) ctx.p = self._int_to_bn(private_key.p) ctx.q = self._int_to_bn(private_key.q) ctx.d = self._int_to_bn(private_key.d) @@ -359,9 +360,11 @@ class Backend(object): return ctx def _rsa_cdata_from_public_key(self, public_key): + # Does not GC the RSA cdata. You *must* make sure it's freed + # correctly yourself! + ctx = self._lib.RSA_new() assert ctx != self._ffi.NULL - ctx = self._ffi.gc(ctx, self._lib.RSA_free) ctx.e = self._int_to_bn(public_key.e) ctx.n = self._int_to_bn(public_key.n) return ctx |