Merge branch 'feature/esp-mqtt_esp32s3_support' into 'master'

ESP32S3 support for ESP-MQTT SSL Mutual Authentication with Digital Signature

Closes IDF-3859

See merge request espressif/esp-idf!15065
This commit is contained in:
Mahavir Jain 2021-09-06 09:52:29 +00:00
commit bc3c9d27f6
5 changed files with 13 additions and 10 deletions

View File

@ -26,7 +26,8 @@ menu "ESP-TLS"
config ESP_TLS_USE_DS_PERIPHERAL
bool "Use Digital Signature (DS) Peripheral with ESP-TLS"
depends on (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32H2) && ESP_TLS_USING_MBEDTLS
depends on (IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32H2 || IDF_TARGET_ESP32S3)
depends on ESP_TLS_USING_MBEDTLS
default y
help
Enable use of the Digital Signature Peripheral for ESP-TLS.The DS peripheral

View File

@ -21,6 +21,8 @@
#include "esp32c3/rom/digital_signature.h"
#elif CONFIG_IDF_TARGET_ESP32H2
#include "esp32h2/rom/digital_signature.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/rom/digital_signature.h"
#else
#error "Selected target does not support esp_rsa_sign_alt (for DS)"
#endif

View File

@ -1,8 +1,8 @@
| Supported Targets | ESP32-S2 | ESP32-C3 |
| Supported Targets | ESP32-S2 | ESP32-C3 | 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 and ESP32-C3 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 and ESP32-C3 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)
@ -12,12 +12,12 @@ It uses ESP-MQTT library which implements mqtt client to connect to mqtt broker.
### Hardware Required
This example can be executed on any ESP32-S2, ESP32-C3 board (which has a built-in DS peripheral), the only required interface is WiFi and connection to internet.
This example can be executed on any ESP32-S2, ESP32-S3, ESP32-C3 board (which has a built-in DS peripheral), the only required interface is WiFi and connection to internet.
### Configure the project
#### 1) Selecting the target
As the project is to be built for the target ESP32-S2, ESP32-C3 it should be selected with the following command
As the project is to be built for the target ESP32-S2, ESP32-S3, ESP32-C3 it should be selected with the following command
```
idf.py set-target /* target */
```
@ -99,7 +99,7 @@ DATA=data
### configure_ds.py
The script [configure_ds.py](./configure_ds.py) is used for configuring the DS peripheral on the ESP32-S2/ESP32-C3 SoC. The steps in the script are based on technical details of certain operations in the Digital Signature calculation, which can be found at Digital Signature Section of [ESP32-S2 TRM](https://www.espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf)
The script [configure_ds.py](./configure_ds.py) is used for configuring the DS peripheral on the ESP32-S2/ESP32-S3/ESP32-C3 SoC. The steps in the script are based on technical details of certain operations in the Digital Signature calculation, which can be found at Digital Signature Section of [ESP32-S2 TRM](https://www.espressif.com/sites/default/files/documentation/esp32-s2_technical_reference_manual_en.pdf)
The configuration script performs the following steps -

View File

@ -46,8 +46,8 @@ csv_filename = esp_ds_data_dir + '/pre_prov.csv'
bin_filename = esp_ds_data_dir + '/pre_prov.bin'
expected_json_path = os.path.join('build', 'config', 'sdkconfig.json')
# Targets supported by the script
supported_targets = {'esp32s2', 'esp32c3'}
supported_key_size = {'esp32s2':[1024, 2048, 3072, 4096], 'esp32c3':[1024, 2048, 3072]}
supported_targets = {'esp32s2', 'esp32c3', 'esp32s3'}
supported_key_size = {'esp32s2':[1024, 2048, 3072, 4096], 'esp32c3':[1024, 2048, 3072], 'esp32s3':[1024, 2048, 3072, 4096]}
# @return
@ -89,7 +89,7 @@ def number_as_bytes(number, pad_bits=None):
# privkey : path to the RSA private key
# priv_key_pass : path to the RSA privaete key password
# hmac_key : HMAC key value ( to calculate DS params)
# idf_target : The target chip for the script (e.g. esp32s2, esp32c3)
# idf_target : The target chip for the script (e.g. esp32s2, esp32c3, esp32s3)
# @info
# The function calculates the encrypted private key parameters.
# Consult the DS documentation (available for the ESP32-S2) in the esp-idf programming guide for more details about the variables and calculations.

View File

@ -1,3 +1,3 @@
idf_component_register(SRCS "app_main.c"
INCLUDE_DIRS "."
REQUIRED_IDF_TARGETS esp32s2 esp32c3)
REQUIRED_IDF_TARGETS esp32s2 esp32c3 esp32s3)