Michel Jaouen | cfeafe0 | 2023-04-04 15:47:25 +0200 | [diff] [blame] | 1 | From 8be39b4353bdeee2f80e42c23a73a276cbd9a8ad Mon Sep 17 00:00:00 2001 |
| 2 | From: TTornblom <thomas.tornblom@iar.com> |
| 3 | Date: Thu, 16 Apr 2020 13:53:38 +0200 |
| 4 | Subject: [PATCH 1/8] BUILD: Update For IAR support |
| 5 | |
| 6 | Applied the same change as in mbed-crypto for using this as a sub |
| 7 | project with the IAR toolchain. Use __asm generic ,and avoid empty |
| 8 | enum. |
| 9 | |
| 10 | Signed-off-by: TTornblom <thomas.tornblom@iar.com> |
| 11 | Signed-off-by: Michel Jaouen <michel.jaouen@st.com> |
| 12 | --- |
| 13 | CMakeLists.txt | 4 +++- |
| 14 | include/mbedtls/ssl.h | 1 + |
| 15 | library/constant_time.c | 2 +- |
| 16 | 3 files changed, 5 insertions(+), 2 deletions(-) |
| 17 | |
| 18 | diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 19 | index 8d3f08a98..096bb6e14 100644 |
| 20 | --- a/CMakeLists.txt |
| 21 | +++ b/CMakeLists.txt |
| 22 | @@ -222,7 +222,9 @@ if(CMAKE_COMPILER_IS_CLANG) |
| 23 | endif(CMAKE_COMPILER_IS_CLANG) |
| 24 | |
| 25 | if(CMAKE_COMPILER_IS_IAR) |
| 26 | - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --warn_about_c_style_casts -Ohz") |
| 27 | + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --warn_about_c_style_casts") |
| 28 | + set(CMAKE_C_FLAGS_RELEASE "-Ohz") |
| 29 | + set(CMAKE_C_FLAGS_DEBUG "--debug -On") |
| 30 | endif(CMAKE_COMPILER_IS_IAR) |
| 31 | |
| 32 | if(CMAKE_COMPILER_IS_MSVC) |
| 33 | diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h |
| 34 | index 68e8d040f..fbd150638 100644 |
| 35 | --- a/include/mbedtls/ssl.h |
| 36 | +++ b/include/mbedtls/ssl.h |
| 37 | @@ -620,6 +620,7 @@ |
| 38 | |
| 39 | /* Dummy type used only for its size */ |
| 40 | union mbedtls_ssl_premaster_secret { |
| 41 | + unsigned MBEDTLS_PRIVATE(dummy); /* Make the union non-empty even with no supported algorithms. */ |
| 42 | #if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED) |
| 43 | unsigned char _pms_rsa[48]; /* RFC 5246 8.1.1 */ |
| 44 | #endif |
| 45 | diff --git a/library/constant_time.c b/library/constant_time.c |
| 46 | index 552a918f4..471d91618 100644 |
| 47 | --- a/library/constant_time.c |
| 48 | +++ b/library/constant_time.c |
| 49 | @@ -77,7 +77,7 @@ static inline uint32_t mbedtls_get_unaligned_volatile_uint32(volatile const unsi |
| 50 | */ |
| 51 | uint32_t r; |
| 52 | #if defined(__arm__) || defined(__thumb__) || defined(__thumb2__) |
| 53 | - asm volatile ("ldr %0, [%1]" : "=r" (r) : "r" (p) :); |
| 54 | + __asm volatile ("ldr %0, [%1]" : "=r" (r) : "r" (p) :); |
| 55 | #elif defined(__aarch64__) |
| 56 | asm volatile ("ldr %w0, [%1]" : "=r" (r) : "r" (p) :); |
| 57 | #endif |
| 58 | -- |
| 59 | 2.32.0 |
| 60 | |