diff options
author | Ian Cordasco <graffatcolmingov@gmail.com> | 2015-08-01 16:16:16 -0500 |
---|---|---|
committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2015-08-01 16:16:16 -0500 |
commit | 6fdc89517a6466a8ab3632f1caac872a8ba6d9de (patch) | |
tree | ae0b20bd0f8ed446fe76970eaa3ac9d62809f025 | |
parent | c9682adaf78cc0983ef639279d38e8bdccc97321 (diff) | |
download | cryptography-6fdc89517a6466a8ab3632f1caac872a8ba6d9de.tar.gz cryptography-6fdc89517a6466a8ab3632f1caac872a8ba6d9de.tar.bz2 cryptography-6fdc89517a6466a8ab3632f1caac872a8ba6d9de.zip |
Add _encode_asn1_int_gc
Ensure the certificate serial number is freed
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/backend.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py index eae31cd1..c190f591 100644 --- a/src/cryptography/hazmat/backends/openssl/backend.py +++ b/src/cryptography/hazmat/backends/openssl/backend.py @@ -79,6 +79,12 @@ def _encode_asn1_int(backend, x): return i +def _encode_asn1_int_gc(backend, x): + i = _encode_asn1_int(backend, x) + i = backend._ffi.gc(i, backend._lib.ASN1_INTEGER_free) + return i + + def _encode_asn1_str(backend, data, length): """ Create an ASN1_OCTET_STRING from a Python byte string. @@ -1034,7 +1040,7 @@ class Backend(object): assert res == 1 # Set the certificate serial number. - serial_number = _encode_asn1_int(self, builder._serial_number) + serial_number = _encode_asn1_int_gc(self, builder._serial_number) res = self._lib.X509_set_serialNumber(x509_cert, serial_number) assert res == 1 |