[meta-python2][PATCH] python-cryptography: fix build with openssl-3


Martin Jansa
 

Signed-off-by: Martin Jansa <Martin.Jansa@...>
---
...me-more-constants-we-don-t-need-5361.patch | 25 +++++++++++++
...or-we-don-t-use-in-cryptography-or-p.patch | 32 +++++++++++++++++
...erties-for-all-openssl-versions-5589.patch | 36 +++++++++++++++++++
.../python/python-cryptography_2.8.bb | 3 ++
4 files changed, 96 insertions(+)
create mode 100644 recipes-devtools/python/python-cryptography/0001-remove-some-more-constants-we-don-t-need-5361.patch
create mode 100644 recipes-devtools/python/python-cryptography/0002-remove-every-error-we-don-t-use-in-cryptography-or-p.patch
create mode 100644 recipes-devtools/python/python-cryptography/0003-define-OAEP-properties-for-all-openssl-versions-5589.patch

diff --git a/recipes-devtools/python/python-cryptography/0001-remove-some-more-constants-we-don-t-need-5361.patch b/recipes-devtools/python/python-cryptography/0001-remove-some-more-constants-we-don-t-need-5361.patch
new file mode 100644
index 0000000..ef5a597
--- /dev/null
+++ b/recipes-devtools/python/python-cryptography/0001-remove-some-more-constants-we-don-t-need-5361.patch
@@ -0,0 +1,25 @@
+From 513720d786816eb66296f8701b1377afc9e151f4 Mon Sep 17 00:00:00 2001
+From: Paul Kehrer <paul.l.kehrer@...>
+Date: Thu, 30 Jul 2020 09:44:31 -0500
+Subject: [PATCH] remove some more constants we don't need (#5361)
+
+these are gone in 3.0 anyway and were removed in that draft PR
+---
+ src/_cffi_src/openssl/crypto.py | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/src/_cffi_src/openssl/crypto.py b/src/_cffi_src/openssl/crypto.py
+index d8835442..1a6dbbcd 100644
+--- a/src/_cffi_src/openssl/crypto.py
++++ b/src/_cffi_src/openssl/crypto.py
+@@ -23,10 +23,6 @@ static const int OPENSSL_CFLAGS;
+ static const int OPENSSL_BUILT_ON;
+ static const int OPENSSL_PLATFORM;
+ static const int OPENSSL_DIR;
+-static const int CRYPTO_MEM_CHECK_ON;
+-static const int CRYPTO_MEM_CHECK_OFF;
+-static const int CRYPTO_MEM_CHECK_ENABLE;
+-static const int CRYPTO_MEM_CHECK_DISABLE;
+ """
+
+ FUNCTIONS = """
diff --git a/recipes-devtools/python/python-cryptography/0002-remove-every-error-we-don-t-use-in-cryptography-or-p.patch b/recipes-devtools/python/python-cryptography/0002-remove-every-error-we-don-t-use-in-cryptography-or-p.patch
new file mode 100644
index 0000000..e7b4e20
--- /dev/null
+++ b/recipes-devtools/python/python-cryptography/0002-remove-every-error-we-don-t-use-in-cryptography-or-p.patch
@@ -0,0 +1,32 @@
+From 9e5b84a9c0acc5f1e503495fd615439d82085188 Mon Sep 17 00:00:00 2001
+From: Paul Kehrer <paul.l.kehrer@...>
+Date: Mon, 27 Jul 2020 06:31:41 -0500
+Subject: [PATCH] remove every error we don't use in cryptography or pyopenssl
+ (#5355)
+
+* remove every error we don't use in cryptography or pyopenssl
+
+sorry external consumers, carrying things we don't use and don't have
+downstream tests for has become too much of a burden
+
+* re-add a constant we need for tests for now
+
+* pyopenssl needs these three
+
+MJ: remove only EVP_R_KEYGEN_FAILURE to fix build with openssl-3
+---
+ src/_cffi_src/openssl/err.py | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/_cffi_src/openssl/err.py b/src/_cffi_src/openssl/err.py
+index d4033f5a..f573bdf3 100644
+--- a/src/_cffi_src/openssl/err.py
++++ b/src/_cffi_src/openssl/err.py
+@@ -66,7 +66,6 @@ static const int EVP_R_DIFFERENT_KEY_TYPES;
+ static const int EVP_R_INITIALIZATION_ERROR;
+ static const int EVP_R_INPUT_NOT_INITIALIZED;
+ static const int EVP_R_INVALID_KEY_LENGTH;
+-static const int EVP_R_KEYGEN_FAILURE;
+ static const int EVP_R_MISSING_PARAMETERS;
+ static const int EVP_R_NO_CIPHER_SET;
+ static const int EVP_R_NO_DIGEST_SET;
diff --git a/recipes-devtools/python/python-cryptography/0003-define-OAEP-properties-for-all-openssl-versions-5589.patch b/recipes-devtools/python/python-cryptography/0003-define-OAEP-properties-for-all-openssl-versions-5589.patch
new file mode 100644
index 0000000..eafec49
--- /dev/null
+++ b/recipes-devtools/python/python-cryptography/0003-define-OAEP-properties-for-all-openssl-versions-5589.patch
@@ -0,0 +1,36 @@
+From 5df5945d7b613ffef80f50c3febac86358c93cc3 Mon Sep 17 00:00:00 2001
+From: Paul Kehrer <paul.l.kehrer@...>
+Date: Thu, 26 Nov 2020 11:52:47 -0600
+Subject: [PATCH] define OAEP properties for all openssl versions (#5589)
+
+In 3.0 these aren't macros so we can't test this way. All our supported
+OpenSSLs have these bindings now and LibreSSL does not.
+---
+ src/_cffi_src/openssl/rsa.py | 10 +++-------
+ 1 file changed, 3 insertions(+), 7 deletions(-)
+
+diff --git a/src/_cffi_src/openssl/rsa.py b/src/_cffi_src/openssl/rsa.py
+index 216e633a..e2fbc422 100644
+--- a/src/_cffi_src/openssl/rsa.py
++++ b/src/_cffi_src/openssl/rsa.py
+@@ -60,17 +60,13 @@ int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *, EVP_MD *);
+ CUSTOMIZATIONS = """
+ static const long Cryptography_HAS_PSS_PADDING = 1;
+
+-#if defined(EVP_PKEY_CTX_set_rsa_oaep_md)
++#if !CRYPTOGRAPHY_IS_LIBRESSL
+ static const long Cryptography_HAS_RSA_OAEP_MD = 1;
+-#else
+-static const long Cryptography_HAS_RSA_OAEP_MD = 0;
+-int (*EVP_PKEY_CTX_set_rsa_oaep_md)(EVP_PKEY_CTX *, EVP_MD *) = NULL;
+-#endif
+-
+-#if defined(EVP_PKEY_CTX_set0_rsa_oaep_label)
+ static const long Cryptography_HAS_RSA_OAEP_LABEL = 1;
+ #else
++static const long Cryptography_HAS_RSA_OAEP_MD = 0;
+ static const long Cryptography_HAS_RSA_OAEP_LABEL = 0;
++int (*EVP_PKEY_CTX_set_rsa_oaep_md)(EVP_PKEY_CTX *, EVP_MD *) = NULL;
+ int (*EVP_PKEY_CTX_set0_rsa_oaep_label)(EVP_PKEY_CTX *, unsigned char *,
+ int) = NULL;
+ #endif
diff --git a/recipes-devtools/python/python-cryptography_2.8.bb b/recipes-devtools/python/python-cryptography_2.8.bb
index d56e85f..40d5e69 100644
--- a/recipes-devtools/python/python-cryptography_2.8.bb
+++ b/recipes-devtools/python/python-cryptography_2.8.bb
@@ -65,6 +65,9 @@ FILES:${PN}-dbg += " \
"

SRC_URI += " \
+ file://0001-remove-some-more-constants-we-don-t-need-5361.patch \
+ file://0002-remove-every-error-we-don-t-use-in-cryptography-or-p.patch \
+ file://0003-define-OAEP-properties-for-all-openssl-versions-5589.patch \
file://run-ptest \
"

--
2.32.0

Join openembedded-devel@lists.openembedded.org to automatically receive all group messages.