Browse code

Appy patch Refactor binding initialization to clear error queue at startup. (1802217)

Change-Id: I5741f12b6da047af60e964fd8fb925d42e93f4b0
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/2264
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

xiaolin-vmware authored on 2017/04/05 02:09:24
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+diff --git a/binding.py b/binding2.py
1
+index 39750ab..096faf5 100644
2
+--- a/src/cryptography/hazmat/bindings/openssl/binding.py
3
+@@ -111,7 +111,12 @@ class Binding(object):
4
+ 
5
+     @classmethod
6
+     def _register_osrandom_engine(cls):
7
+-        _openssl_assert(cls.lib, cls.lib.ERR_peek_error() == 0)
8
++        # Clear any errors extant in the queue before we start. In many
9
++        # scenarios other things may be interacting with OpenSSL in the same
10
++        # process space and it has proven untenable to assume that they will
11
++        # reliably clear the error queue. Once we clear it here we will
12
++        # error on any subsequent unexpected item in the stack.
13
++        cls.lib.ERR_clear_error()
14
+         cls._osrandom_engine_id = cls.lib.Cryptography_osrandom_engine_id
15
+         cls._osrandom_engine_name = cls.lib.Cryptography_osrandom_engine_name
16
+         result = cls.lib.Cryptography_add_osrandom_engine()
... ...
@@ -1,9 +1,10 @@
1 1
 %{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
2 2
 %{!?python3_sitelib: %define python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")}
3
+
3 4
 Summary:        Python cryptography library
4 5
 Name:           python-cryptography
5 6
 Version:        1.7.2
6
-Release:        1%{?dist}
7
+Release:        2%{?dist}
7 8
 Url:            https://cryptography.io
8 9
 License:        ASL 2.0
9 10
 Group:          Development/Languages/Python
... ...
@@ -11,6 +12,8 @@ Vendor:         VMware, Inc.
11 11
 Distribution:   Photon
12 12
 Source0:        https://pypi.io/packages/source/c/cryptography/cryptography-%{version}.tar.gz
13 13
 %define sha1    cryptography=2b5bc62fda71992633f83164b1a74c16a784acdf
14
+#https://github.com/pyca/cryptography/pull/3278/commits/6779428e804d17cfb9f23a618b38e1089de93bdd
15
+Patch0:         clear_error_queue_at_startup.patch
14 16
 BuildRequires:  python2
15 17
 BuildRequires:  python2-libs
16 18
 BuildRequires:  python2-devel
... ...
@@ -21,6 +24,10 @@ Requires:       openssl
21 21
 Requires:       python-cffi
22 22
 Requires:       python2
23 23
 Requires:       python2-libs
24
+Requires:       python-idna
25
+Requires:       python-pyasn1
26
+Requires:       python-ipaddress
27
+Requires:       python-setuptools
24 28
 
25 29
 %description
26 30
 Cryptography is a Python library which exposes cryptographic recipes and primitives.
... ...
@@ -34,6 +41,9 @@ BuildRequires:  python3-cffi
34 34
 Requires:       python3
35 35
 Requires:       python3-libs
36 36
 Requires:       python3-cffi
37
+Requires:       python3-idna
38
+Requires:       python3-pyasn1
39
+Requires:       python3-six
37 40
 
38 41
 %description -n python3-cryptography
39 42
 
... ...
@@ -41,6 +51,7 @@ Python 3 version.
41 41
 
42 42
 %prep
43 43
 %setup -q -n cryptography-%{version}
44
+%patch0 -p1
44 45
 
45 46
 %build
46 47
 python setup.py build
... ...
@@ -59,6 +70,8 @@ python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
59 59
 %{python3_sitelib}/*
60 60
 
61 61
 %changelog
62
+*   Mon Apr 03 2017 Xiaolin Li <xiaolinl@vmware.com> 1.7.2-2
63
+-   Appy patch Refactor binding initialization to clear error queue at startup.
62 64
 *   Thu Feb 02 2017 Xiaolin Li <xiaolinl@vmware.com> 1.7.2-1
63 65
 -   Updated to version 1.7.2 and added python3 package.
64 66
 *   Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.2.3-2