Skip to content

WifiClientSecure missing peek() method! #1146

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

Closed
chaeron opened this issue Feb 23, 2018 · 6 comments
Closed

WifiClientSecure missing peek() method! #1146

chaeron opened this issue Feb 23, 2018 · 6 comments

Comments

@chaeron
Copy link

chaeron commented Feb 23, 2018

P

Hardware:

Board: ESP32 Dev Module
Core Installation/update date: 11/jul/2017
IDE name: Arduino IDE
Flash Frequency: 40Mhz
Upload Speed: 115200

Description:

The WifiClientSecure class is missing the peek() method, so the peek() from the parent class (WifiClient) is called instead.

The problem with this is that if you are using WifiClientSecure with the Update library to do OTA updates it will fail with a "Invalid Magic Byte" error when Update tries to read the stream and do a peek() at the first magic byte. Likely because the byte isn't being decrypted.

This means that you currently cannot do an OTA update over HTTPS/SSL. :-(

@brokentoaster
Copy link

This looks like an issue with mbedTLS
Mbed-TLS/mbedtls#563

@brokentoaster
Copy link

UpdateClass::writeStream() could be modified to call _verifyHeader() inside the while(remaining()) loop. Making the call to peek unnecessary.

@brokentoaster
Copy link

The ESP_IMAGE_HEADER_MAGIC is also checked in UpdateClass::_writeBuffer() when the buffer is committed to flash, I think the earlier checks are pointless as no changes will be committed to the flash unless that byte was read correctly.

@brokentoaster
Copy link

try #1214

@copercini
Copy link
Contributor

Hi guys, I've implemented something here: https://github.com/copercini/arduino-esp32/tree/master/libraries/WiFiClientSecure/src but I don't have a server with SSL for test if it's working with the update library

@copercini
Copy link
Contributor

Now it has =) #1310

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

No branches or pull requests

3 participants