Tamas Ban | 4a5cc97 | 2020-10-27 09:03:56 +0000 | [diff] [blame] | 1 | From 8355985e8f739daaa2e243d28dc49a2d6971a383 Mon Sep 17 00:00:00 2001 |
| 2 | From: Tamas Ban <tamas.ban@arm.com> |
| 3 | Date: Tue, 27 Oct 2020 08:55:37 +0000 |
| 4 | Subject: [PATCH] Enable crypto code sharing between independent binaries |
| 5 | |
| 6 | Signed-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 | |
| 14 | diff --git a/library/code_share.c b/library/code_share.c |
| 15 | new file mode 100644 |
| 16 | index 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 | + */ |
| 23 | diff --git a/library/platform.c b/library/platform.c |
| 24 | index 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 | { |
| 38 | diff --git a/library/platform_util.c b/library/platform_util.c |
| 39 | index 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 | -- |
| 52 | 2.7.4 |
| 53 | |