Skip to content

WifiClientSecure missing peek() method! #1146

@chaeron

Description

@chaeron

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. :-(

Activity

brokentoaster

brokentoaster commented on Mar 14, 2018

@brokentoaster

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

brokentoaster

brokentoaster commented on Mar 14, 2018

@brokentoaster

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

brokentoaster

brokentoaster commented on Mar 14, 2018

@brokentoaster

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

brokentoaster commented on Mar 14, 2018

@brokentoaster

try #1214

copercini

copercini commented on Mar 18, 2018

@copercini
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

copercini commented on Apr 14, 2018

@copercini
Contributor

Now it has =) #1310

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @chaeron@brokentoaster@copercini

        Issue actions

          WifiClientSecure missing peek() method! · Issue #1146 · espressif/arduino-esp32