1From cd183cafadbe4dcf3256c81a6804c462e720aeb3 Mon Sep 17 00:00:00 2001
2From: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
3Date: Wed, 3 Apr 2024 14:13:44 +0100
4Subject: [PATCH] cryptlib_mbedtls: use external Mbed TLS
5
6Do not include mbedtls headers files from libspdm fork of Mbed TLS.
7This change is RMM specific, for building cryptlib_mbedtls library
8from RMM.
9
10crt_wrapper_host.c: duplicate symbols
11Rename mbedtls_platform_zeroize as it conflicts with RMM MbedTLS
12
13Signed-off-by: Arunachalam Ganapathy <arunachalam.ganapathy@arm.com>
14---
15 os_stub/cryptlib_mbedtls/CMakeLists.txt              | 9 ---------
16 os_stub/cryptlib_mbedtls/sys_call/crt_wrapper_host.c | 2 +-
17 2 files changed, 1 insertion(+), 10 deletions(-)
18
19diff --git a/os_stub/cryptlib_mbedtls/CMakeLists.txt b/os_stub/cryptlib_mbedtls/CMakeLists.txt
20index a7d5301cac..81607da5f4 100644
21--- a/os_stub/cryptlib_mbedtls/CMakeLists.txt
22+++ b/os_stub/cryptlib_mbedtls/CMakeLists.txt
23@@ -9,10 +9,6 @@ target_include_directories(cryptlib_mbedtls
24         ${LIBSPDM_DIR}/os_stub/include
25         ${LIBSPDM_DIR}/os_stub
26         ${LIBSPDM_DIR}/os_stub/cryptlib_mbedtls
27-        ${LIBSPDM_DIR}/os_stub/mbedtlslib/include
28-        ${LIBSPDM_DIR}/os_stub/mbedtlslib/include/mbedtls
29-        ${LIBSPDM_DIR}/os_stub/mbedtlslib/mbedtls/include
30-        ${LIBSPDM_DIR}/os_stub/mbedtlslib/mbedtls/include/mbedtls
31 )
32
33 target_sources(cryptlib_mbedtls
34@@ -52,8 +48,3 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
35         target_compile_options(cryptlib_mbedtls PRIVATE /wd4090 /wd4200)
36     endif()
37 endif()
38-
39-if(MBEDTLS_CONFIG_FILE)
40-else()
41-    target_compile_definitions(cryptlib_mbedtls PRIVATE -DMBEDTLS_CONFIG_FILE=<libspdm_mbedtls_config.h>)
42-endif()
43diff --git a/os_stub/cryptlib_mbedtls/sys_call/crt_wrapper_host.c b/os_stub/cryptlib_mbedtls/sys_call/crt_wrapper_host.c
44index 9ce520c7c5..72decdba7d 100644
45--- a/os_stub/cryptlib_mbedtls/sys_call/crt_wrapper_host.c
46+++ b/os_stub/cryptlib_mbedtls/sys_call/crt_wrapper_host.c
47@@ -25,7 +25,7 @@ int my_snprintf(char *str, size_t size, const char *format, ...)
48     return 0;
49 }
50
51-void mbedtls_platform_zeroize(void *buf, size_t len)
52+void my_mbedtls_platform_zeroize(void *buf, size_t len)
53 {
54     libspdm_zero_mem(buf, len);
55 }
56--
572.39.2
58
59