Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wolfSSL Encryption Library Support for Espressif ESP32-C6 #6163

Closed
gojimmypi opened this issue Mar 5, 2023 · 1 comment
Closed

Add wolfSSL Encryption Library Support for Espressif ESP32-C6 #6163

gojimmypi opened this issue Mar 5, 2023 · 1 comment
Assignees

Comments

@gojimmypi
Copy link
Contributor

gojimmypi commented Mar 5, 2023

Version

latest master

Description

Espressif has a new ESP32-C6 Wi-Fi 6 SoC 32-bit RISC-V processor. See espressif/esp-idf#10423 for more details on ESP-IDF support status. See also Espressif Product Comparison for other Modules and SoC dev boards.

The wolfSSL core examples need to be verified and updated as needed. Other examples such as those in wolfssl-examples/ESP32 and wolfssh-examples/Espressif will also need to be checked.

Updates:

The wolfSSL code has been confirmed working on the gojimmypi fork ED25519_SHA2_fix branch. Relatively small changes needed to run wolfssl_test wolfSSL Crypt Test Example on the Espressif ESP32-C6.

Programming

Although the VisualGDB directories are used below, the UI in Visual Studio does not yet have an option for the ESP32C6. Tests run from WSL on Windows 10:

cd /mnt/c/SysGCC/esp32/esp-idf/master/

# ensure latest master:
git fetch  --recurse-submodules
git pull  --recurse-submodules

# prep ESI-IDF
# note any additional instructions that may require separate install steps
. ./export.sh

# test drive Espressif wolfssl_test
cd /mnt/c/workspace/wolfssl-gojimmypi/IDE/Espressif/ESP-IDF/examples/wolfssl_test

# see https://docs.espressif.com/projects/esp-idf/en/latest/esp32c6/get-started/establish-serial-connection.html
#
# Hold Boot button, tap Reset button once, release Boot button. 
# Specifying baud rate on v0.0 board did not work. Leave blank for best results
idf.py -p /dev/ttyS8 --preview set-target esp32c6 build flash

Visual GDB

See the Sysprogs VisualGDB forum for ESP32-C6 Support Feature Request in VisualGDB:
https://sysprogs.com/w/forums/topic/espressif-esp32-c6-esp-idf-support-esp32c6/

Special Notes

See the Espressif ESP32-C6 Tips.

Note: There are 2 USB ports, one labeled USB the other labeled UART.

The USB port labeled 'USB` has the build-in JTAG adapter and is used for flashing firmware (both JTAG and Serial upload). This port is disconnected when pressing the reset button.

The USB UART port is not used for programming and is not disconnected when pressing reset.

Successful wolfSSL test output for the ESP32-C6:

ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:2
load:0x4086c410,len:0xd64
load:0x4086e610,len:0x2b00
load:0x40875720,len:0x1794
entry 0x4086c410
I (23) boot: ESP-IDF v5.1-dev-3797-gaf805df3cb-dirty 2nd stage bootloader
I (24) boot: compile time Mar  5 2023 09:02:37
I (25) boot: chip revision: v0.0
I (29) boot.esp32c6: SPI Speed      : 40MHz
I (33) boot.esp32c6: SPI Mode       : DIO
I (38) boot.esp32c6: SPI Flash Size : 2MB
I (43) boot: Enabling RNG early entropy source...
W (48) bootloader_random: bootloader_random_enable() has not been implemented yet
I (56) boot: Partition Table:
I (60) boot: ## Label            Usage          Type ST Offset   Length
I (67) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (75) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (82) boot:  2 factory          factory app      00 00 00010000 00177000
I (90) boot: End of partition table
I (94) esp_image: segment 0: paddr=00010020 vaddr=42068020 size=25e58h (155224) map
I (134) esp_image: segment 1: paddr=00035e80 vaddr=40800000 size=02198h (  8600) load
I (137) esp_image: segment 2: paddr=00038020 vaddr=42000020 size=65788h (415624) map
I (226) esp_image: segment 3: paddr=0009d7b0 vaddr=40802198 size=08110h ( 33040) load
I (236) boot: Loaded app from partition at offset 0x10000
I (237) boot: Disabling RNG early entropy source...
W (237) bootloader_random: bootloader_random_enable() has not been implemented yet
I (256) cpu_start: Pro cpu up.
W (266) clk: esp_perip_clk_init() has not been implemented yet
I (272) cpu_start: Pro cpu start user code
I (273) cpu_start: cpu freq: 160000000 Hz
I (273) cpu_start: Application information:
I (275) cpu_start: Project name:     wolfssl_test
I (281) cpu_start: App version:      v5.5.4-stable-589-g7fa713f36-di
I (288) cpu_start: Compile time:     Mar  5 2023 09:01:47
I (294) cpu_start: ELF file SHA256:  d807a6377be3793f...
I (300) cpu_start: ESP-IDF:          v5.1-dev-3797-gaf805df3cb-dirty
I (307) cpu_start: Min chip rev:     v0.0
I (312) cpu_start: Max chip rev:     v0.99
I (317) cpu_start: Chip rev:         v0.0
I (321) heap_init: Initializing. RAM available for dynamic allocation:
I (328) heap_init: At 4080B1C0 len 00071450 (453 KiB): D/IRAM
I (335) heap_init: At 4087C610 len 00002F54 (11 KiB): STACK/DIRAM
I (342) heap_init: At 50000010 len 00003FF0 (15 KiB): RTCRAM
I (349) spi_flash: detected chip: generic
I (353) spi_flash: flash io: dio
W (357) spi_flash: Detected size(8192k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (370) sleep: Configure to isolate all GPIO pins in sleep state
I (377) sleep: Enable automatic switching of GPIO sleep configuration
I (384) coexist: coex firmware version: 9747c21
I (389) coexist: coexist rom version 5b8dcfa
I (394) app_start: Starting scheduler on CPU0
I (399) main_task: Started on CPU0
I (399) main_task: Calling app_main()
I (399) wolfssl_test: --------------------------------------------------------
I (409) wolfssl_test: --------------------------------------------------------
I (419) wolfssl_test: ---------------------- BEGIN MAIN ----------------------
I (429) wolfssl_test: --------------------------------------------------------
I (439) wolfssl_test: --------------------------------------------------------
I (439) Version Info: Extended Version and Platform Information.
I (449) Version Info: LIBWOLFSSL_VERSION_STRING = 5.5.4
I (459) Version Info: LIBWOLFSSL_VERSION_HEX = 5005004
I (459) Version Info: LIBWOLFSSL_VERSION_GIT_ORIGIN = https://github.com/gojimmypi/wolfssl.git
I (469) Version Info: LIBWOLFSSL_VERSION_GIT_BRANCH = ED25519_SHA2_fix
I (479) Version Info: LIBWOLFSSL_VERSION_GIT_HASH = 7fa713f36091b4ed1143e64416207659bab10a31
I (489) Version Info: LIBWOLFSSL_VERSION_GIT_SHORT_HASH = 7fa713f36
I (489) Version Info: LIBWOLFSSL_VERSION_GIT_HASH_DATE = 'Sun Mar 5 08:46:19 2023 -0800'
I (499) Version Info: CONFIG_IDF_TARGET = esp32c6
I (509) Version Info: NO_ESP32WROOM32_CRYPT defined! HW acceleration DISABLED.
I (519) Version Info: SINGLE_THREADED
------------------------------------------------------------------------------
 wolfSSL version 5.5.4
------------------------------------------------------------------------------
error    test passed!
MEMORY   test passed!
base64   test passed!
base16   test passed!
asn      test passed!
RANDOM   test passed!
MD5      test passed!
MD4      test passed!
SHA      test passed!
SHA-256  test passed!
SHA-384  test passed!
SHA-512  test passed!
SHA-512/224  test passed!
SHA-512/256  test passed!
SHA-3    test passed!
SHAKE128 test passed!
SHAKE256 test passed!
Hash     test passed!
RIPEMD   test passed!
HMAC-MD5 test passed!
HMAC-SHA test passed!
HMAC-SHA256 test passed!
HMAC-SHA384 test passed!
HMAC-SHA512 test passed!
HMAC-SHA3   test passed!
HMAC-KDF    test passed!
TLSv1.3 KDF test passed!
X963-KDF    test passed!
GMAC     test passed!
DES      test passed!
DES3     test passed!
AES      test passed!
AES192   test passed!
AES256   test passed!
AES-GCM  test passed!
AES Key Wrap test passed!
RSA      test passed!
PWDBASED test passed!
openSSL extra test
OPENSSL  test passed!
OPENSSL (EVP MD) passed!
OPENSSL (PKEY0) passed!
OPENSSL (PKEY1) passed!
OPENSSL (EVP Sign/Verify) passed!
ECC      test passed!
ECC buffer test passed!
CURVE25519 test passed!
ED25519  test passed!
PKCS7encrypted  test passed!
PKCS7signed     test passed!
PKCS7enveloped  test passed!
PKCS7authenveloped  test passed!
logging  test passed!
time test passed!
mutex    test passed!
Test complete
I (195169) wolfcrypt_test: Exiting main with return code:  0

I (195179) wolfssl_test: wolf_test_task complete success result code = 0

See #6234 for a roadmap of Espressif updates.

@gojimmypi
Copy link
Contributor Author

Hardware acceleration for the ESP32-C6 was implemented with #6990 (feature parity w/ ESP32 features: SHA, RSA/Math, AES).

New, additional hardware features will be implemented as requested or as time permits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant