Skip to content

add magic byte check for Update class #1259

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

Merged
merged 3 commits into from
Dec 20, 2015
Merged

Conversation

Links2004
Copy link
Collaborator

Note: only check of first 0xE9 possible.

@igrr
Copy link
Member

igrr commented Dec 20, 2015

Is this going to break the case when _command == U_SPIFFS?

@Links2004
Copy link
Collaborator Author

good point will change.

@Links2004
Copy link
Collaborator Author

has the SPIFFS also a magic byte at the start?

@igrr
Copy link
Member

igrr commented Dec 20, 2015

It has, but i think hard-coding this into Updater.cpp is not really good. It might be better to move that logic into some "Verifier" (i.e. MD5Verifier, SketchVerifier, SPIFFSVerifier, etc.)

@igrr
Copy link
Member

igrr commented Dec 20, 2015

For SPIFFS the magic is not located at the start of the image:

// always in the physical second last entry of the last object lookup page

@Links2004
Copy link
Collaborator Author

a verify at the beginning is limited to the first byte, (peek problem).
I solved it for network but make it for Stream class is no good idea since it then brake every lib that uses Streams.

for the sketch a verify at the end is possible since we not have override the working one there,
for the SPIFFS this is not possible.

@igrr
Copy link
Member

igrr commented Dec 20, 2015

Ok, then I think for SPIFFS we will just use MD5 verification at the end of update.

@Links2004
Copy link
Collaborator Author

will do some refactoring, start test for flash first byte,
end test the flash size test like i do in the http update.
moved to two new functions

_verifyHeader is called before the beginning of the update progress to verify the first byte using peek
_verifyEnd is called on the end before the eboot command is written to verify first byte + flash config

add missing _reset() on timeout
@Links2004
Copy link
Collaborator Author

updated

@igrr
Copy link
Member

igrr commented Dec 20, 2015

LGTM

Links2004 added a commit that referenced this pull request Dec 20, 2015
add magic byte check for Update class
@Links2004 Links2004 merged commit cc0db8b into esp8266:master Dec 20, 2015
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

Successfully merging this pull request may close these issues.

2 participants