From: Oleksii Beketov
Date: Mon, 13 Apr 2020 20:29:17 +0000 (+0300)
Subject: Android build fix
X-Git-Tag: submit/tizen/20200611.232159~1
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c0899018a662c0092a45b68da8dd6e3b8f6d65f3;p=platform%2Fupstream%2Fiotivity.git
Android build fix
After mbedTLS revision update, GCC < 5.0 treated the x86 ebx as a
fixed reserved register when building as PIC, leading to errors
https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/pull/678
(cherry-picked from f96e428b9658a9d4d60417c53d0689fe7b02d684)
Change-Id: I80928e1bfcfbae5cec0173a5dd8a9b655b1c277a
Signed-off-by: Oleksii Beketov
Signed-off-by: Sudipto
---
diff --git a/extlibs/mbedtls/mbedtls/include/mbedtls/bn_mul.h b/extlibs/mbedtls/mbedtls/include/mbedtls/bn_mul.h
index c33bd8d4a..30262d540 100644
--- a/extlibs/mbedtls/mbedtls/include/mbedtls/bn_mul.h
+++ b/extlibs/mbedtls/mbedtls/include/mbedtls/bn_mul.h
@@ -56,13 +56,17 @@
#if defined(__GNUC__) && \
( !defined(__ARMCC_VERSION) || __ARMCC_VERSION >= 6000000 )
+#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( \
diff --git a/extlibs/mbedtls/ocf.patch b/extlibs/mbedtls/ocf.patch
index c3369446a..c68bc1802 100644
--- a/extlibs/mbedtls/ocf.patch
+++ b/extlibs/mbedtls/ocf.patch
@@ -1,5 +1,28 @@
+diff --git a/include/mbedtls/bn_mul.h b/include/mbedtls/bn_mul.h
+index c33bd8d4a..30262d540 100644
+--- a/include/mbedtls/bn_mul.h
++++ b/include/mbedtls/bn_mul.h
+@@ -56,13 +56,17 @@
+ #if defined(__GNUC__) && \
+ ( !defined(__ARMCC_VERSION) || __ARMCC_VERSION >= 6000000 )
+
++#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( \
diff --git a/include/mbedtls/check_config.h b/include/mbedtls/check_config.h
-index b86e580..ed904fe 100644
+index b86e5807e..ed904fe78 100644
--- a/include/mbedtls/check_config.h
+++ b/include/mbedtls/check_config.h
@@ -250,6 +250,11 @@
@@ -15,7 +38,7 @@ index b86e580..ed904fe 100644
( !defined(MBEDTLS_ECDH_C) || !defined(MBEDTLS_ECDSA_C) || \
!defined(MBEDTLS_X509_CRT_PARSE_C) )
diff --git a/include/mbedtls/compat-1.3.h b/include/mbedtls/compat-1.3.h
-index a58b472..2b2203e 100644
+index a58b47243..2b2203edf 100644
--- a/include/mbedtls/compat-1.3.h
+++ b/include/mbedtls/compat-1.3.h
@@ -268,6 +268,9 @@
@@ -45,13 +68,14 @@ index a58b472..2b2203e 100644
#define TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA
#define TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 MBEDTLS_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256
diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h
-index 654f972..f6ef4ec 100644
+index 654f9725e..f6ef4ec18 100644
--- a/include/mbedtls/config.h
+++ b/include/mbedtls/config.h
-@@ -962,6 +962,21 @@
+@@ -961,6 +961,21 @@
+ */
#define MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED
- /**
++/**
+ * \def MBEDTLS_KEY_EXCHANGE_ECDH_ANON_ENABLED
+ *
+ * Enable the ECDHE-ANON based ciphersuite modes in SSL / TLS.
@@ -66,10 +90,9 @@ index 654f972..f6ef4ec 100644
+#define MBEDTLS_KEY_EXCHANGE_ECDH_ANON_ENABLED
+
+
-+/**
+ /**
* \def MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED
*
- * Enable the ECDHE-ECDSA based ciphersuite modes in SSL / TLS.
@@ -1566,7 +1581,7 @@
*
* Comment this macro to disable support for SSL session tickets
@@ -88,7 +111,7 @@ index 654f972..f6ef4ec 100644
* PEM_PARSE uses AES for decrypting encrypted keys.
*/
diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h
-index d31f6cd..fae852e 100644
+index d31f6cdd5..fae852e81 100644
--- a/include/mbedtls/ssl.h
+++ b/include/mbedtls/ssl.h
@@ -391,7 +391,8 @@ union mbedtls_ssl_premaster_secret
@@ -102,7 +125,7 @@ index d31f6cd..fae852e 100644
#endif
#if defined(MBEDTLS_KEY_EXCHANGE_PSK_ENABLED)
diff --git a/include/mbedtls/ssl_ciphersuites.h b/include/mbedtls/ssl_ciphersuites.h
-index 71053e5..311fb62 100644
+index 71053e5ba..311fb620d 100644
--- a/include/mbedtls/ssl_ciphersuites.h
+++ b/include/mbedtls/ssl_ciphersuites.h
@@ -165,6 +165,8 @@ extern "C" {
@@ -133,7 +156,7 @@ index 71053e5..311fb62 100644
#endif
diff --git a/library/ssl_ciphersuites.c b/library/ssl_ciphersuites.c
-index 518f7dd..3d97b55 100644
+index 518f7dde0..3d97b557c 100644
--- a/library/ssl_ciphersuites.c
+++ b/library/ssl_ciphersuites.c
@@ -108,6 +108,7 @@ static const int ciphersuite_preference[] =
@@ -176,7 +199,7 @@ index 518f7dd..3d97b55 100644
default:
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
-index afced7a..9a49586 100644
+index afced7a99..9a49586a7 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -2023,7 +2023,8 @@ static int ssl_parse_server_dh_params( mbedtls_ssl_context *ssl, unsigned char *
@@ -424,7 +447,7 @@ index afced7a..9a49586 100644
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip write certificate verify" ) );
ssl->state++;
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
-index bc77f80..5665cfd 100644
+index bc77f8020..5665cfd9a 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -2696,6 +2696,7 @@ static int ssl_write_certificate_request( mbedtls_ssl_context *ssl )
@@ -784,7 +807,7 @@ index bc77f80..5665cfd 100644
{
MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= skip parse certificate verify" ) );
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
-index 38690fa..88273a3 100644
+index 38690fa66..88273a349 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -5285,7 +5285,8 @@ int mbedtls_ssl_write_certificate( mbedtls_ssl_context *ssl )
@@ -836,7 +859,7 @@ index 38690fa..88273a3 100644
}
}
diff --git a/library/version_features.c b/library/version_features.c
-index 24143d0..88335d3 100644
+index 24143d052..88335d369 100644
--- a/library/version_features.c
+++ b/library/version_features.c
@@ -372,6 +372,9 @@ static const char *features[] = {
@@ -849,3 +872,6 @@ index 24143d0..88335d3 100644
#if defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)
"MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED",
#endif /* MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED */
+--
+2.20.1
+