Add patches to fix build against OpenSSL 1.1
This commit is contained in:
parent
975594a6f8
commit
b9084e7946
108
U-Boot-1-2-rsa-Fix-build-with-OpenSSL-1.1.x.patch
Normal file
108
U-Boot-1-2-rsa-Fix-build-with-OpenSSL-1.1.x.patch
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
From patchwork Mon Feb 13 09:00:36 2017
|
||||||
|
Content-Type: text/plain; charset="utf-8"
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
Subject: [U-Boot,1/2] rsa: Fix build with OpenSSL 1.1.x
|
||||||
|
From: Jelle van der Waa <jelle@vdwaa.nl>
|
||||||
|
X-Patchwork-Id: 727164
|
||||||
|
Message-Id: <20170213090037.29223-1-jelle@vdwaa.nl>
|
||||||
|
To: Andrew Duda <aduda@meraki.com>, Simon Glass <sjg@chromium.org>,
|
||||||
|
"mario . six @ gdsys . cc" <mario.six@gdsys.cc>
|
||||||
|
Cc: u-boot@lists.denx.de
|
||||||
|
Date: Mon, 13 Feb 2017 10:00:36 +0100
|
||||||
|
|
||||||
|
The rsa_st struct has been made opaque in 1.1.x, add forward compatible
|
||||||
|
code to access the n, e, d members of rsa_struct.
|
||||||
|
|
||||||
|
EVP_MD_CTX_cleanup has been removed in 1.1.x and EVP_MD_CTX_reset should be
|
||||||
|
called to reinitialise an already created structure.
|
||||||
|
---
|
||||||
|
lib/rsa/rsa-sign.c | 33 +++++++++++++++++++++++++++------
|
||||||
|
1 file changed, 27 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
|
||||||
|
index 8c6637e328..965fb00f95 100644
|
||||||
|
--- a/lib/rsa/rsa-sign.c
|
||||||
|
+++ b/lib/rsa/rsa-sign.c
|
||||||
|
@@ -20,6 +20,19 @@
|
||||||
|
#define HAVE_ERR_REMOVE_THREAD_STATE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
|
+void RSA_get0_key(const RSA *r,
|
||||||
|
+ const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
|
||||||
|
+{
|
||||||
|
+ if (n != NULL)
|
||||||
|
+ *n = r->n;
|
||||||
|
+ if (e != NULL)
|
||||||
|
+ *e = r->e;
|
||||||
|
+ if (d != NULL)
|
||||||
|
+ *d = r->d;
|
||||||
|
+}
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
static int rsa_err(const char *msg)
|
||||||
|
{
|
||||||
|
unsigned long sslErr = ERR_get_error();
|
||||||
|
@@ -409,7 +422,11 @@ static int rsa_sign_with_key(RSA *rsa, struct checksum_algo *checksum_algo,
|
||||||
|
ret = rsa_err("Could not obtain signature");
|
||||||
|
goto err_sign;
|
||||||
|
}
|
||||||
|
- EVP_MD_CTX_cleanup(context);
|
||||||
|
+ #if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
|
+ EVP_MD_CTX_cleanup(context);
|
||||||
|
+ #else
|
||||||
|
+ EVP_MD_CTX_reset(context);
|
||||||
|
+ #endif
|
||||||
|
EVP_MD_CTX_destroy(context);
|
||||||
|
EVP_PKEY_free(key);
|
||||||
|
|
||||||
|
@@ -479,6 +496,7 @@ static int rsa_get_exponent(RSA *key, uint64_t *e)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
BIGNUM *bn_te;
|
||||||
|
+ const BIGNUM *key_e;
|
||||||
|
uint64_t te;
|
||||||
|
|
||||||
|
ret = -EINVAL;
|
||||||
|
@@ -487,17 +505,18 @@ static int rsa_get_exponent(RSA *key, uint64_t *e)
|
||||||
|
if (!e)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
- if (BN_num_bits(key->e) > 64)
|
||||||
|
+ RSA_get0_key(key, NULL, &key_e, NULL);
|
||||||
|
+ if (BN_num_bits(key_e) > 64)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
- *e = BN_get_word(key->e);
|
||||||
|
+ *e = BN_get_word(key_e);
|
||||||
|
|
||||||
|
- if (BN_num_bits(key->e) < 33) {
|
||||||
|
+ if (BN_num_bits(key_e) < 33) {
|
||||||
|
ret = 0;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
- bn_te = BN_dup(key->e);
|
||||||
|
+ bn_te = BN_dup(key_e);
|
||||||
|
if (!bn_te)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
@@ -527,6 +546,7 @@ int rsa_get_params(RSA *key, uint64_t *exponent, uint32_t *n0_invp,
|
||||||
|
{
|
||||||
|
BIGNUM *big1, *big2, *big32, *big2_32;
|
||||||
|
BIGNUM *n, *r, *r_squared, *tmp;
|
||||||
|
+ const BIGNUM *key_n;
|
||||||
|
BN_CTX *bn_ctx = BN_CTX_new();
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
@@ -548,7 +568,8 @@ int rsa_get_params(RSA *key, uint64_t *exponent, uint32_t *n0_invp,
|
||||||
|
if (0 != rsa_get_exponent(key, exponent))
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
|
- if (!BN_copy(n, key->n) || !BN_set_word(big1, 1L) ||
|
||||||
|
+ RSA_get0_key(key, NULL, &key_n, NULL);
|
||||||
|
+ if (!BN_copy(n, key_n) || !BN_set_word(big1, 1L) ||
|
||||||
|
!BN_set_word(big2, 2L) || !BN_set_word(big32, 32L))
|
||||||
|
ret = -1;
|
||||||
|
|
@ -0,0 +1,49 @@
|
|||||||
|
From patchwork Mon Feb 13 09:00:37 2017
|
||||||
|
Content-Type: text/plain; charset="utf-8"
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
Subject: [U-Boot,2/2] rsa: Fix deprecated warnings for OpenSSL 1.1.x
|
||||||
|
From: Jelle van der Waa <jelle@vdwaa.nl>
|
||||||
|
X-Patchwork-Id: 727165
|
||||||
|
Message-Id: <20170213090037.29223-2-jelle@vdwaa.nl>
|
||||||
|
To: Andrew Duda <aduda@meraki.com>, Simon Glass <sjg@chromium.org>,
|
||||||
|
"mario . six @ gdsys . cc" <mario.six@gdsys.cc>
|
||||||
|
Cc: u-boot@lists.denx.de
|
||||||
|
Date: Mon, 13 Feb 2017 10:00:37 +0100
|
||||||
|
|
||||||
|
ERR_remove_thread_state is deprecated in OpenSSL 1.1.x and does not do
|
||||||
|
anything anymore. Thread initialisation and deinitialisation is now
|
||||||
|
handled by the OpenSSL library.
|
||||||
|
|
||||||
|
Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl>
|
||||||
|
---
|
||||||
|
lib/rsa/rsa-sign.c | 8 ++------
|
||||||
|
1 file changed, 2 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
|
||||||
|
index 965fb00f95..347a6aa89e 100644
|
||||||
|
--- a/lib/rsa/rsa-sign.c
|
||||||
|
+++ b/lib/rsa/rsa-sign.c
|
||||||
|
@@ -16,10 +16,6 @@
|
||||||
|
#include <openssl/evp.h>
|
||||||
|
#include <openssl/engine.h>
|
||||||
|
|
||||||
|
-#if OPENSSL_VERSION_NUMBER >= 0x10000000L
|
||||||
|
-#define HAVE_ERR_REMOVE_THREAD_STATE
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
|
void RSA_get0_key(const RSA *r,
|
||||||
|
const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
|
||||||
|
@@ -356,9 +352,9 @@ static void rsa_remove(void)
|
||||||
|
{
|
||||||
|
CRYPTO_cleanup_all_ex_data();
|
||||||
|
ERR_free_strings();
|
||||||
|
-#ifdef HAVE_ERR_REMOVE_THREAD_STATE
|
||||||
|
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L && OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
|
ERR_remove_thread_state(NULL);
|
||||||
|
-#else
|
||||||
|
+#elif OPENSSL_VERSION_NUMBER < 0x10000000L
|
||||||
|
ERR_remove_state(0);
|
||||||
|
#endif
|
||||||
|
EVP_cleanup();
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Name: uboot-tools
|
Name: uboot-tools
|
||||||
Version: 2017.03
|
Version: 2017.03
|
||||||
Release: 0.2%{?candidate:.%{candidate}}%{?dist}
|
Release: 0.3%{?candidate:.%{candidate}}%{?dist}
|
||||||
Summary: U-Boot utilities
|
Summary: U-Boot utilities
|
||||||
|
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
@ -13,6 +13,9 @@ Source1: armv7-boards
|
|||||||
Source2: armv8-boards
|
Source2: armv8-boards
|
||||||
|
|
||||||
Patch1: add-BOOTENV_INIT_COMMAND-for-commands-that-may-be-ne.patch
|
Patch1: add-BOOTENV_INIT_COMMAND-for-commands-that-may-be-ne.patch
|
||||||
|
Patch2: U-Boot-1-2-rsa-Fix-build-with-OpenSSL-1.1.x.patch
|
||||||
|
Patch3: U-Boot-2-2-rsa-Fix-deprecated-warnings-for-OpenSSL-1.1.x.patch
|
||||||
|
|
||||||
# Patch2: port-utilite-to-distro-generic-boot-commands.patch
|
# Patch2: port-utilite-to-distro-generic-boot-commands.patch
|
||||||
# Patch3: mvebu-enable-generic-distro-boot-config.patch
|
# Patch3: mvebu-enable-generic-distro-boot-config.patch
|
||||||
|
|
||||||
@ -21,7 +24,7 @@ BuildRequires: dtc
|
|||||||
BuildRequires: fedora-logos
|
BuildRequires: fedora-logos
|
||||||
BuildRequires: git
|
BuildRequires: git
|
||||||
BuildRequires: netpbm-progs
|
BuildRequires: netpbm-progs
|
||||||
BuildRequires: compat-openssl10-devel
|
BuildRequires: openssl-devel
|
||||||
BuildRequires: SDL-devel
|
BuildRequires: SDL-devel
|
||||||
BuildRequires: python-devel
|
BuildRequires: python-devel
|
||||||
BuildRequires: python-setuptools
|
BuildRequires: python-setuptools
|
||||||
@ -249,6 +252,9 @@ cp -p board/rockchip/evb_rk3399/README doc/README.evb_rk3399
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Feb 13 2017 Peter Robinson <pbrobinson@fedoraproject.org> 2017.03-0.3.rc1
|
||||||
|
- Add patches to fix build against OpenSSL 1.1
|
||||||
|
|
||||||
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2017.03-0.2.rc1
|
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2017.03-0.2.rc1
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user