aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTamas Ban <tamas.ban@arm.com>2020-10-27 09:03:56 +0000
committerTamas Ban <tamas.ban@arm.com>2020-12-17 13:06:19 +0000
commit4a5cc9776ed3b053bac57326931f936fbbc660e9 (patch)
tree870ca6368563188d4f252c85b0d3e8cf39d3bfd0 /lib
parentf8b0b2df5e9b954fd5d59ae95684659e73b38c8c (diff)
downloadtrusted-firmware-m-4a5cc9776ed3b053bac57326931f936fbbc660e9.tar.gz
Build: Add mbedtls patch to help code sharing
Adds a patch file that, when applied to mbedtls, will remove the 'static' keyword from some function pointers related to memory allocation. This allows more functions to be shared between MCUboot and the secure firmware. Signed-off-by: Balint Matyi <Balint.Matyi@arm.com> Change-Id: Ibc6cbb3ab18fccc92a5b8608b9f1ef54c1136d2f
Diffstat (limited to 'lib')
-rw-r--r--lib/ext/mbedcrypto/0005-Enable-crypto-code-sharing-between-independent-binar.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/ext/mbedcrypto/0005-Enable-crypto-code-sharing-between-independent-binar.patch b/lib/ext/mbedcrypto/0005-Enable-crypto-code-sharing-between-independent-binar.patch
new file mode 100644
index 000000000..3c220b4e6
--- /dev/null
+++ b/lib/ext/mbedcrypto/0005-Enable-crypto-code-sharing-between-independent-binar.patch
@@ -0,0 +1,53 @@
+From 8355985e8f739daaa2e243d28dc49a2d6971a383 Mon Sep 17 00:00:00 2001
+From: Tamas Ban <tamas.ban@arm.com>
+Date: Tue, 27 Oct 2020 08:55:37 +0000
+Subject: [PATCH] Enable crypto code sharing between independent binaries
+
+Signed-off-by: Tamas Ban <tamas.ban@arm.com>
+---
+ library/code_share.c | 3 +++
+ library/platform.c | 4 ++--
+ library/platform_util.c | 2 +-
+ 3 files changed, 6 insertions(+), 3 deletions(-)
+ create mode 100644 library/code_share.c
+
+diff --git a/library/code_share.c b/library/code_share.c
+new file mode 100644
+index 0000000..2bf67fb
+--- /dev/null
++++ b/library/code_share.c
+@@ -0,0 +1,3 @@
++/* This is a deliberately empty file just to check whether the patch for enabling
++ * extensive crypto code sharing was already applied on the mbedtls library.
++ */
+diff --git a/library/platform.c b/library/platform.c
+index 420d09e..b3a135c 100644
+--- a/library/platform.c
++++ b/library/platform.c
+@@ -59,8 +59,8 @@ static void platform_free_uninit( void *ptr )
+ #define MBEDTLS_PLATFORM_STD_FREE platform_free_uninit
+ #endif /* !MBEDTLS_PLATFORM_STD_FREE */
+
+-static void * (*mbedtls_calloc_func)( size_t, size_t ) = MBEDTLS_PLATFORM_STD_CALLOC;
+-static void (*mbedtls_free_func)( void * ) = MBEDTLS_PLATFORM_STD_FREE;
++void * (*mbedtls_calloc_func)( size_t, size_t ) = MBEDTLS_PLATFORM_STD_CALLOC;
++void (*mbedtls_free_func)( void * ) = MBEDTLS_PLATFORM_STD_FREE;
+
+ void * mbedtls_calloc( size_t nmemb, size_t size )
+ {
+diff --git a/library/platform_util.c b/library/platform_util.c
+index b1f7450..29b4403 100644
+--- a/library/platform_util.c
++++ b/library/platform_util.c
+@@ -68,7 +68,7 @@
+ * mbedtls_platform_zeroize() to use a suitable implementation for their
+ * platform and needs.
+ */
+-static void * (* const volatile memset_func)( void *, int, size_t ) = memset;
++void * (* const volatile memset_func)( void *, int, size_t ) = memset;
+
+ void mbedtls_platform_zeroize( void *buf, size_t len )
+ {
+--
+2.7.4
+