Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Permit using the Updater _hash function, even if we don't have a signature appended to the image#8507

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mcspr merged 2 commits intoesp8266:masterfromeinglis:updater_hash
Apr 11, 2022

Conversation

@einglis
Copy link
Contributor

NOTE: Re-submission of PR#8472 due to user error :(

The _hash and _verify functionality of the Updater class are pretty much entwined. But it might be useful to calculate the hash, even without a signature present in the image itself. This change permits that by allowing a zero-length signature.

For reference, one possible use case is where the expected hash is provided separately to the uploaded image. Another is to provide generic post-upload validation of the image: the hash function permits a convenient way of inspecting the complete image against arbitrary conditions; this is particularly useful after HTTP client OTA updates.

(It's fair that reading the whole image back out of flash is not very efficient, but that's not the concern of this PR.)

Copy link
Collaborator

@d-a-vd-a-v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

@einglis
Copy link
ContributorAuthor

Ty

@mcsprmcspr merged commitf78c633 intoesp8266:masterApr 11, 2022
@blue-wind-25
Copy link

After comparing with the old code, I would like to clarify line 247:
_size -= (sigLen + sizeof(uint32_t) /* The siglen word */);

shouldn't it be:
binSize -= (sigLen + sizeof(uint32_t) /* The siglen word */);

because the former will cause line 276 to read from the wrong address.

Thank you.

@eingliseinglis deleted the updater_hash branchApril 12, 2022 19:51
@einglis
Copy link
ContributorAuthor

Good spot,@blue-wind-25. I think you're right.

@blue-wind-25
Copy link

Great, thank you for the confirmation :-)

mcspr added a commit that referenced this pull requestSep 13, 2022
Amends#8507I took the liberty to also do some refactoring; specifically, fixing signed vs. unsigned mismatch in len, using pointer object vs. the original manual malloc & free, try to have named constants for certain addresses and lengths, plus localize printing of u8 arrays.The suggested test to have a 'dummy' verifier works just fine. (...how it actually works and gets the hash to compare with is a whole other question, though)Another issue noticed while testing, in the underlying bearssl api there's an actual limit for hash length.https://github.com/earlephilhower/bearssl-esp8266/blob/6105635531027f5b298aa656d44be2289b2d434f/inc/bearssl_rsa.h#L257
hasenradball pushed a commit to hasenradball/Arduino that referenced this pull requestNov 18, 2024
…ature appended to the image (esp8266#8507)The _hash and _verify functionality of the Updater class are pretty much entwined. But it might be useful to calculate the hash, even without a signature present in the image itself. This change permits that by allowing a zero-length signature.For reference, one possible use case is where the expected hash is provided separately to the uploaded image. Another is to provide generic post-upload validation of the image: the hash function permits a convenient way of inspecting the complete image against arbitrary conditions; this is particularly useful after HTTP client OTA updates.(It's fair that reading the whole image back out of flash is not very efficient, but that's not the concern of this PR.)
hasenradball pushed a commit to hasenradball/Arduino that referenced this pull requestNov 18, 2024
Amendsesp8266#8507I took the liberty to also do some refactoring; specifically, fixing signed vs. unsigned mismatch in len, using pointer object vs. the original manual malloc & free, try to have named constants for certain addresses and lengths, plus localize printing of u8 arrays.The suggested test to have a 'dummy' verifier works just fine. (...how it actually works and gets the hash to compare with is a whole other question, though)Another issue noticed while testing, in the underlying bearssl api there's an actual limit for hash length.https://github.com/earlephilhower/bearssl-esp8266/blob/6105635531027f5b298aa656d44be2289b2d434f/inc/bearssl_rsa.h#L257
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@d-a-vd-a-vd-a-v approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@einglis@blue-wind-25@d-a-v@mcspr

[8]ページ先頭

©2009-2025 Movatter.jp