blob: 3c220b4e6d815ad77e50cee54d2a2d0d75a99b73 [file] [log] [blame]
Tamas Ban4a5cc972020-10-27 09:03:56 +00001From 8355985e8f739daaa2e243d28dc49a2d6971a383 Mon Sep 17 00:00:00 2001
2From: Tamas Ban <tamas.ban@arm.com>
3Date: Tue, 27 Oct 2020 08:55:37 +0000
4Subject: [PATCH] Enable crypto code sharing between independent binaries
5
6Signed-off-by: Tamas Ban <tamas.ban@arm.com>
7---
8 library/code_share.c | 3 +++
9 library/platform.c | 4 ++--
10 library/platform_util.c | 2 +-
11 3 files changed, 6 insertions(+), 3 deletions(-)
12 create mode 100644 library/code_share.c
13
14diff --git a/library/code_share.c b/library/code_share.c
15new file mode 100644
16index 0000000..2bf67fb
17--- /dev/null
18+++ b/library/code_share.c
19@@ -0,0 +1,3 @@
20+/* This is a deliberately empty file just to check whether the patch for enabling
21+ * extensive crypto code sharing was already applied on the mbedtls library.
22+ */
23diff --git a/library/platform.c b/library/platform.c
24index 420d09e..b3a135c 100644
25--- a/library/platform.c
26+++ b/library/platform.c
27@@ -59,8 +59,8 @@ static void platform_free_uninit( void *ptr )
28 #define MBEDTLS_PLATFORM_STD_FREE platform_free_uninit
29 #endif /* !MBEDTLS_PLATFORM_STD_FREE */
30
31-static void * (*mbedtls_calloc_func)( size_t, size_t ) = MBEDTLS_PLATFORM_STD_CALLOC;
32-static void (*mbedtls_free_func)( void * ) = MBEDTLS_PLATFORM_STD_FREE;
33+void * (*mbedtls_calloc_func)( size_t, size_t ) = MBEDTLS_PLATFORM_STD_CALLOC;
34+void (*mbedtls_free_func)( void * ) = MBEDTLS_PLATFORM_STD_FREE;
35
36 void * mbedtls_calloc( size_t nmemb, size_t size )
37 {
38diff --git a/library/platform_util.c b/library/platform_util.c
39index b1f7450..29b4403 100644
40--- a/library/platform_util.c
41+++ b/library/platform_util.c
42@@ -68,7 +68,7 @@
43 * mbedtls_platform_zeroize() to use a suitable implementation for their
44 * platform and needs.
45 */
46-static void * (* const volatile memset_func)( void *, int, size_t ) = memset;
47+void * (* const volatile memset_func)( void *, int, size_t ) = memset;
48
49 void mbedtls_platform_zeroize( void *buf, size_t len )
50 {
51--
522.7.4
53