summaryrefslogtreecommitdiffstats
path: root/package/mbedtls
diff options
context:
space:
mode:
Diffstat (limited to 'package/mbedtls')
-rw-r--r--package/mbedtls/0001-bn_mul.h-fix-x86-PIC-inline-ASM-compilation-with-GCC.patch74
-rw-r--r--package/mbedtls/mbedtls.hash6
-rw-r--r--package/mbedtls/mbedtls.mk2
3 files changed, 78 insertions, 4 deletions
diff --git a/package/mbedtls/0001-bn_mul.h-fix-x86-PIC-inline-ASM-compilation-with-GCC.patch b/package/mbedtls/0001-bn_mul.h-fix-x86-PIC-inline-ASM-compilation-with-GCC.patch
new file mode 100644
index 0000000000..60bf53f6e4
--- /dev/null
+++ b/package/mbedtls/0001-bn_mul.h-fix-x86-PIC-inline-ASM-compilation-with-GCC.patch
@@ -0,0 +1,74 @@
+From a0ae2ba37ca479c6edddec8634b25686be965e0d Mon Sep 17 00:00:00 2001
+From: Peter Korsgaard <peter@korsgaard.com>
+Date: Mon, 27 Aug 2018 22:50:57 +0200
+Subject: [PATCH] bn_mul.h: fix x86 PIC inline ASM compilation with GCC < 5
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes #1910
+
+With ebx added to the MULADDC_STOP clobber list to fix #1550, the inline
+assembly fails to build with GCC < 5 in PIC mode with the following error:
+
+include/mbedtls/bn_mul.h:46:13: error: PIC register clobbered by ‘ebx’ in ‘asm’
+
+This is because older GCC versions treated the x86 ebx register (which is
+used for the GOT) as a fixed reserved register when building as PIC.
+
+This is fixed by an improved register allocator in GCC 5+. From the release
+notes:
+
+Register allocation improvements: Reuse of the PIC hard register, instead of
+using a fixed register, was implemented on x86/x86-64 targets. This
+improves generated PIC code performance as more hard registers can be used.
+
+https://www.gnu.org/software/gcc/gcc-5/changes.html
+
+As a workaround, detect this situation and disable the inline assembly,
+similar to the MULADDC_CANNOT_USE_R7 logic.
+
+Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
+Upstream: https://github.com/ARMmbed/mbedtls/pull/1986
+---
+ include/mbedtls/bn_mul.h | 18 +++++++++++++++++-
+ 1 file changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/include/mbedtls/bn_mul.h b/include/mbedtls/bn_mul.h
+index b587317d9..74a2d29be 100644
+--- a/include/mbedtls/bn_mul.h
++++ b/include/mbedtls/bn_mul.h
+@@ -50,13 +50,29 @@
+ #if defined(__GNUC__) && \
+ ( !defined(__ARMCC_VERSION) || __ARMCC_VERSION >= 6000000 )
+
++/*
++ * GCC < 5.0 treated the x86 ebx (which is used for the GOT) as a
++ * fixed reserved register when building as PIC, leading to errors
++ * like: bn_mul.h:46:13: error: PIC register clobbered by ‘ebx’ in ‘asm’
++ *
++ * This is fixed by an improved register allocator in GCC 5+. From the
++ * release notes:
++ * Register allocation improvements: Reuse of the PIC hard register,
++ * instead of using a fixed register, was implemented on x86/x86-64
++ * targets. This improves generated PIC code performance as more hard
++ * registers can be used.
++ */
++#if defined(__GNUC__) && __GNUC__ < 5 && defined(__PIC__)
++#define MULADDC_CANNOT_USE_EBX
++#endif
++
+ /*
+ * Disable use of the i386 assembly code below if option -O0, to disable all
+ * compiler optimisations, is passed, detected with __OPTIMIZE__
+ * This is done as the number of registers used in the assembly code doesn't
+ * work with the -O0 option.
+ */
+-#if defined(__i386__) && defined(__OPTIMIZE__)
++#if defined(__i386__) && defined(__OPTIMIZE__) && !defined(MULADDC_CANNOT_USE_EBX)
+
+ #define MULADDC_INIT \
+ asm( \
+--
+2.11.0
+
diff --git a/package/mbedtls/mbedtls.hash b/package/mbedtls/mbedtls.hash
index cf347d299f..47e446dd07 100644
--- a/package/mbedtls/mbedtls.hash
+++ b/package/mbedtls/mbedtls.hash
@@ -1,5 +1,5 @@
-# From https://tls.mbed.org/tech-updates/releases/mbedtls-2.11.0-2.7.4-and-2.1.13-released
-sha1 20394e353050992c5f9699da7c9a336bd2ed2dea mbedtls-2.7.4-apache.tgz
-sha256 34e164d49500e377970c5f6761a146078baae0e086ec88cdcfeb9c96878a38f5 mbedtls-2.7.4-apache.tgz
+# From https://tls.mbed.org/tech-updates/releases/mbedtls-2.12.0-2.7.5-and-2.1.14-released
+sha1 180ca49e2bb6df3826113781b793529a81427ce3 mbedtls-2.7.5-apache.tgz
+sha256 a1302ad9094aabb9880d2755927b466a6bac8e02b68e04dee77321f3859e9b40 mbedtls-2.7.5-apache.tgz
# Locally calculated
sha256 cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 apache-2.0.txt
diff --git a/package/mbedtls/mbedtls.mk b/package/mbedtls/mbedtls.mk
index ab415dd0b8..e07cc3d71c 100644
--- a/package/mbedtls/mbedtls.mk
+++ b/package/mbedtls/mbedtls.mk
@@ -5,7 +5,7 @@
################################################################################
MBEDTLS_SITE = https://tls.mbed.org/code/releases
-MBEDTLS_VERSION = 2.7.4
+MBEDTLS_VERSION = 2.7.5
MBEDTLS_SOURCE = mbedtls-$(MBEDTLS_VERSION)-apache.tgz
MBEDTLS_CONF_OPTS = \
-DENABLE_PROGRAMS=$(if $(BR2_PACKAGE_MBEDTLS_PROGRAMS),ON,OFF) \
OpenPOWER on IntegriCloud