-
Notifications
You must be signed in to change notification settings - Fork 17
HTTPS (TLS) support for the ESP32 #267
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
Comments
Some progress update: implemented AES and SHA Accelerators for the ESP32. Here are some demos (I used these to verify the behavior against the physical hardware):
We're still missing the RSA Accelerator peripheral, which is also required for SSL/TLS to work in the simulation. |
Update: There's an initial version of the RSA accelerator. For the curious, here's the MicroPython script that I used for verifying its operation (comparing the outputs VS the real ESP32 device): https://wokwi.com/arduino/projects/321803425724498516 Now that we have the AES, SHA and RSA accelerators, we're getting really close to TLS (HTTPS) support. Here's an example using the Arduino core. It occasionally works, but requires a lot of patience. It can probably can faster after I optimize the AES/RSA accelerator implementation: The MicroPython example currently fails with:
Looking at the Wireshark (PCAP) dump, we can see the TLS connection is established, but immediately aborted due to decrypt error: |
Very nice. Thanks for keeping us updated, @urish! |
Note: spotted the issue that caused the TLS failures: the SHA hardware accelerator shares the state between SHA384 and SHA512, and this behavior wasn't documented. I fixed the implementation, and now TLS works in both Arduino and MicroPython! Sample projects: Many thanks to everyone who voted and supported this feature. |
@urish I'm interested in how you fixed this issue, could you please share the code patch? Thanks. |
Hi @danicampora, that was something internal to the simulator. The SHA accelerator has 16 bytes that stores the internal state (that is part of the SHA512 algorithm). The ESP32 supports several variants of SHA: SHA1, SHA256, SHA384, and SHA512. Initially, I assumed that each variant has a different state storage, but it turned out that SHA384 and SHA512 share the initial state. Thus, if you started a SHA384 operation, but then asked the SHA accelerator to continue with SHA512, you'd have different results on the hardware compared to the simulator. The fix was simply to use the same 16 byte buffer to store the state for both SHA384 and SHA512. You can see the MicroPython script that I used to verify this behavior here: https://wokwi.com/projects/321971676922249810 |
Hi @urish, understood, thank you! |
You're welcome! I'm curious, what project are you working on? |
TLS/SSL support is required for HTTPS. Most Web APIs today use HTTPS (e.g. the Telegram API), so having support for it in Wokwi will be very useful.
You can vote for this feature here: https://wokwi.com/features#feature-1097175424
The text was updated successfully, but these errors were encountered: