From 50f7d40b8934dd6ef5007c89b698ce90e73bb303 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Fri, 10 Feb 2023 10:30:45 +0530 Subject: [PATCH] mqtt/ssl_ds: enable the example for ESP32-H2 target --- components/soc/esp32h2/include/soc/Kconfig.soc_caps.in | 8 ++++++++ components/soc/esp32h2/include/soc/soc_caps.h | 5 ++--- examples/protocols/mqtt/ssl_ds/README.md | 8 ++++---- examples/protocols/mqtt/ssl_ds/main/app_main.c | 1 - examples/protocols/mqtt/ssl_ds/sdkconfig.defaults.esp32h2 | 2 ++ 5 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 examples/protocols/mqtt/ssl_ds/sdkconfig.defaults.esp32h2 diff --git a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in index 2b3e1e53c6..9bdf1856e2 100644 --- a/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in +++ b/components/soc/esp32h2/include/soc/Kconfig.soc_caps.in @@ -95,6 +95,14 @@ config SOC_SHA_SUPPORTED bool default y +config SOC_HMAC_SUPPORTED + bool + default y + +config SOC_DIG_SIGN_SUPPORTED + bool + default y + config SOC_BOD_SUPPORTED bool default y diff --git a/components/soc/esp32h2/include/soc/soc_caps.h b/components/soc/esp32h2/include/soc/soc_caps.h index aaeef2c468..4a7edbaa0b 100644 --- a/components/soc/esp32h2/include/soc/soc_caps.h +++ b/components/soc/esp32h2/include/soc/soc_caps.h @@ -57,8 +57,8 @@ #define SOC_AES_SUPPORTED 1 // #define SOC_MPI_SUPPORTED 1 // TODO: IDF-6415 #define SOC_SHA_SUPPORTED 1 -// #define SOC_HMAC_SUPPORTED 1 // TODO: IDF-6279 -// #define SOC_DIG_SIGN_SUPPORTED 1 // TODO: IDF-6285 +#define SOC_HMAC_SUPPORTED 1 +#define SOC_DIG_SIGN_SUPPORTED 1 // #define SOC_FLASH_ENC_SUPPORTED 1 // TODO: IDF-6282 // #define SOC_SECURE_BOOT_SUPPORTED 1 // TODO: IDF-6281 #define SOC_BOD_SUPPORTED 1 @@ -131,7 +131,6 @@ #define SOC_MMU_LINEAR_ADDRESS_REGION_NUM (1U) #define SOC_MMU_DI_VADDR_SHARED (1) /*!< D/I vaddr are shared */ -// TODO: IDF-6285 (Copy from esp32c6, need check) /*-------------------------- DIGITAL SIGNATURE CAPS ----------------------------------------*/ /** The maximum length of a Digital Signature in bits. */ #define SOC_DS_SIGNATURE_MAX_BIT_LEN (3072) diff --git a/examples/protocols/mqtt/ssl_ds/README.md b/examples/protocols/mqtt/ssl_ds/README.md index 7658f5bad3..cd0486b809 100644 --- a/examples/protocols/mqtt/ssl_ds/README.md +++ b/examples/protocols/mqtt/ssl_ds/README.md @@ -1,10 +1,10 @@ -| Supported Targets | ESP32-C3 | ESP32-C6 | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | -------- | -------- | # ESP-MQTT SSL Mutual Authentication with Digital Signature (See the README.md file in the upper level 'examples' directory for more information about examples.) -Espressif's ESP32-S2, ESP32-S3, ESP32-C3 and ESP32-C6 MCU have a built-in Digital Signature (DS) Peripheral, which provides hardware acceleration for RSA signature. More details can be found at [Digital Signature with ESP-TLS](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/protocols/esp_tls.html#digital-signature-with-esp-tls). +Espressif's ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 and ESP32-H2 MCU have a built-in Digital Signature (DS) Peripheral, which provides hardware acceleration for RSA signature. More details can be found at [Digital Signature with ESP-TLS](https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/api-reference/protocols/esp_tls.html#digital-signature-with-esp-tls). This example connects to the broker test.mosquitto.org using ssl transport with client certificate(RSA) and as a demonstration subscribes/unsubscribes and sends a message on certain topic.The RSA signature operation required in the ssl connection is performed with help of the Digital Signature (DS) peripheral. (Please note that the public broker is maintained by the community so may not be always available, for details please visit http://test.mosquitto.org) @@ -19,7 +19,7 @@ This example can be executed on any ESP32-S2, ESP32-S3, ESP32-C3 or ESP32-C6 boa ### Configure the project #### 1) Selecting the target -As the project is to be built for the target ESP32-S2, ESP32-S3, ESP32-C3 or ESP32-C6 it should be selected with the following command +As the project is to be built for the target ESP32-S2, ESP32-S3, ESP32-C3, ESP32-C6 or ESP32-H2 it should be selected with the following command ``` idf.py set-target /* target */ ``` diff --git a/examples/protocols/mqtt/ssl_ds/main/app_main.c b/examples/protocols/mqtt/ssl_ds/main/app_main.c index ba94cf0db3..709143c6c3 100644 --- a/examples/protocols/mqtt/ssl_ds/main/app_main.c +++ b/examples/protocols/mqtt/ssl_ds/main/app_main.c @@ -10,7 +10,6 @@ #include #include #include -#include "esp_wifi.h" #include "esp_system.h" #include "nvs_flash.h" #include "esp_event.h" diff --git a/examples/protocols/mqtt/ssl_ds/sdkconfig.defaults.esp32h2 b/examples/protocols/mqtt/ssl_ds/sdkconfig.defaults.esp32h2 new file mode 100644 index 0000000000..dcbc3a5a77 --- /dev/null +++ b/examples/protocols/mqtt/ssl_ds/sdkconfig.defaults.esp32h2 @@ -0,0 +1,2 @@ +CONFIG_EXAMPLE_CONNECT_WIFI=n +CONFIG_EXAMPLE_CONNECT_ETHERNET=y