This change is to patch the memleak we have with pyOpenSSL in crypto.py
Change-Id: I7eadfaee31d4f96e995875284469552a3a83703b
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5265
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Sharath George
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,21 @@ |
| 0 |
+--- a/src/OpenSSL/crypto.py 2016-10-15 18:26:14.000000000 +0530 |
|
| 1 |
+@@ -1567,6 +1567,8 @@ |
|
| 2 |
+ def _init(self): |
|
| 3 |
+ """ |
|
| 4 |
+ Set up the store context for a subsequent verification operation. |
|
| 5 |
++ Calling this method more than once without first calling |
|
| 6 |
++ :meth:`_cleanup` will leak memory. |
|
| 7 |
+ """ |
|
| 8 |
+ ret = _lib.X509_STORE_CTX_init( |
|
| 9 |
+ self._store_ctx, self._store._store, self._cert._x509, _ffi.NULL |
|
| 10 |
+@@ -1627,6 +1629,9 @@ |
|
| 11 |
+ """ |
|
| 12 |
+ # Always re-initialize the store context in case |
|
| 13 |
+ # :meth:`verify_certificate` is called multiple times. |
|
| 14 |
++ # :meth:`_init` is called in :meth:`__init__` so _cleanup is called |
|
| 15 |
++ # before _init to ensure memory is not leaked. |
|
| 16 |
++ self._cleanup() |
|
| 17 |
+ self._init() |
|
| 18 |
+ ret = _lib.X509_verify_cert(self._store_ctx) |
|
| 19 |
+ self._cleanup() |
| ... | ... |
@@ -3,7 +3,7 @@ |
| 3 | 3 |
Summary: Python wrapper module around the OpenSSL library |
| 4 | 4 |
Name: python-pyOpenSSL |
| 5 | 5 |
Version: 17.2.0 |
| 6 |
-Release: 1%{?dist}
|
|
| 6 |
+Release: 2%{?dist}
|
|
| 7 | 7 |
Url: https://github.com/pyca/pyopenssl |
| 8 | 8 |
License: ASL 2.0 |
| 9 | 9 |
Group: Development/Languages/Python |
| ... | ... |
@@ -11,6 +11,7 @@ Vendor: VMware, Inc. |
| 11 | 11 |
Distribution: Photon |
| 12 | 12 |
Source0: https://files.pythonhosted.org/packages/source/p/pyOpenSSL/pyOpenSSL-%{version}.tar.gz
|
| 13 | 13 |
%define sha1 pyOpenSSL=ab5454f2d297c642c7c3dffeeca359f914a11dd3 |
| 14 |
+Patch0: X509StoreContext_mem_leak.patch |
|
| 14 | 15 |
BuildRequires: python2 |
| 15 | 16 |
BuildRequires: python2-libs |
| 16 | 17 |
BuildRequires: python2-devel |
| ... | ... |
@@ -72,6 +73,7 @@ Python 3 version. |
| 72 | 72 |
|
| 73 | 73 |
%prep |
| 74 | 74 |
%setup -q -n pyOpenSSL-%{version}
|
| 75 |
+%patch0 -p1 |
|
| 75 | 76 |
rm -rf ../p3dir |
| 76 | 77 |
cp -a . ../p3dir |
| 77 | 78 |
|
| ... | ... |
@@ -113,6 +115,8 @@ popd |
| 113 | 113 |
%{python3_sitelib}/*
|
| 114 | 114 |
|
| 115 | 115 |
%changelog |
| 116 |
+* Thu Jun 14 2018 Tapas Kundu <tkundu@vmware.com> 17.2.0-2 |
|
| 117 |
+- Added memory fix for X509StoreContext Class. |
|
| 116 | 118 |
* Mon Aug 14 2017 Xiaolin Li <xiaolinl@vmware.com> 17.2.0-1 |
| 117 | 119 |
- Updated to version 17.2.0 and fixed make check. |
| 118 | 120 |
* Fri Jul 21 2017 Divya Thaluru <dthaluru@vmware.com> 16.2.0-5 |