From 1454176222d7682877061803dda3c676533e7741 Mon Sep 17 00:00:00 2001 From: KishorSilabs <112456954+KishorSilabs@users.noreply.github.com> Date: Fri, 25 Aug 2023 18:08:41 +0530 Subject: [PATCH] [Silabs] DIC Changes (#28857) * AWS OTA Changes for SOC * Added missing mbedtls defines and files for dic * Restyled by gn * Removed not required macros --------- Co-authored-by: thirupathi Co-authored-by: Restyled.io --- src/lwip/silabs/lwipopts-rs911x.h | 7 ++++--- .../silabs/efr32/efr32-chip-mbedtls-config.h | 20 +++++++++++++++++++ third_party/silabs/SiWx917_sdk.gni | 4 ++++ third_party/silabs/efr32_sdk.gni | 4 ++++ 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/lwip/silabs/lwipopts-rs911x.h b/src/lwip/silabs/lwipopts-rs911x.h index f5d8e3d6b12129..c4a7addb27f0fe 100644 --- a/src/lwip/silabs/lwipopts-rs911x.h +++ b/src/lwip/silabs/lwipopts-rs911x.h @@ -68,8 +68,12 @@ #ifdef DIC_ENABLE #define LWIP_DNS 1 #define DNS_RAND_TXID() ((u32_t) rand()) +#define TCP_MSS (4 * 1152) +#define TCPIP_THREAD_PRIO (3) #else #define LWIP_DNS 0 +#define TCP_MSS (1152) +#define TCPIP_THREAD_PRIO (2) #endif /* DIC_ENABLE */ #define LWIP_FREERTOS_USE_STATIC_TCPIP_TASK 1 @@ -130,7 +134,6 @@ #define PBUF_CUSTOM_POOL_IDX_START (MEMP_PBUF_POOL_SMALL) #define PBUF_CUSTOM_POOL_IDX_END (MEMP_PBUF_POOL_LARGE) -#define TCP_MSS (1152) #define TCP_SND_BUF (2 * TCP_MSS) #define TCP_LISTEN_BACKLOG (1) @@ -140,8 +143,6 @@ #define TCPIP_THREAD_STACKSIZE (2048) -#define TCPIP_THREAD_PRIO (2) - #define NETIF_MAX_HWADDR_LEN 8U #define LWIP_IPV6_NUM_ADDRESSES 5 diff --git a/src/platform/silabs/efr32/efr32-chip-mbedtls-config.h b/src/platform/silabs/efr32/efr32-chip-mbedtls-config.h index 35ff27436ed88b..536cba392c578a 100644 --- a/src/platform/silabs/efr32/efr32-chip-mbedtls-config.h +++ b/src/platform/silabs/efr32/efr32-chip-mbedtls-config.h @@ -42,6 +42,26 @@ #define MBEDTLS_SSL_OUT_CONTENT_LEN 1560 #define MBEDTLS_PSA_BUILTIN_ALG_TLS12_PRF #define MBEDTLS_MPI_MAX_SIZE 512 +#define MBEDTLS_CTR_DRBG_C +#define MBEDTLS_NO_PLATFORM_ENTROPY +#define MBEDTLS_ENTROPY_HARDWARE_ALT +#define MBEDTLS_SSL_TLS_C +#define MBEDTLS_SSL_CLI_C +#define MBEDTLS_SSL_PROTO_TLS1_2 +#define MBEDTLS_SSL_KEEP_PEER_CERTIFICATE +#define MBEDTLS_SSL_PROTO_DTLS +#define MBEDTLS_CIPHER_MODE_CBC +#define MBEDTLS_CCM_C +#define MBEDTLS_ECJPAKE_C +#define MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED +#define MBEDTLS_SSL_MAX_CONTENT_LEN 768 + +/** + * Enable H Crypto and Entropy modules + */ +#define MBEDTLS_ECDH_C +#define MBEDTLS_ENTROPY_C + #endif // DIC_ENABLE // Configurations necessary for ot coap cert libs diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 8d649dd8490f5c..b138ef10c57537 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -237,6 +237,10 @@ template("siwx917_sdk") { defines += [ "DIC_ENABLE=1" ] } + if (aws_sdk_ota) { + defines += [ "ENABLE_AWS_OTA_FEAT=1" ] + } + libs += [ "${sdk_support_root}/platform/emdrv/nvm3/lib/libnvm3_CM4_gcc.a" ] cflags = [] diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 5b4238b47d6473..2295bd5e14f9fd 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -690,6 +690,10 @@ template("efr32_sdk") { if (enable_dic) { sources += [ "${chip_root}/third_party/silabs/mqtt/stack/mqtt.c", + "${efr32_sdk_root}/util/third_party/mbedtls/library/ctr_drbg.c", + "${efr32_sdk_root}/util/third_party/mbedtls/library/entropy.c", + "${efr32_sdk_root}/util/third_party/mbedtls/library/entropy_poll.c", + "${efr32_sdk_root}/util/third_party/mbedtls/library/rsa.c", "${efr32_sdk_root}/util/third_party/mbedtls/library/rsa_alt_helpers.c", ] }