Skip to content
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

Improved flash image validation #1916

Merged
merged 4 commits into from
Feb 18, 2024
Merged

Conversation

NotherNgineer
Copy link
Contributor

@NotherNgineer NotherNgineer commented Feb 17, 2024

This PR is meant to prevent flashing of firmware files that are missing some data after being transferred across the USB serial port. The currently flash image validation code in firmware does not validate the checksum of files that are less than 1MB, because it is assumed that it's an older firmware version that did not have a checksum.

The PR adds the following additional validation:

If the firmware flash image has a valid info area with HACKRFFW signature, the version number in the info area is checked to see if it's a version that is know to be 1MB and to have a valid checksum. Firmware versions that must be 1MB and have a valid checksum (or will be rejected) are:

  • Release firmware versions 2.x and higher (through 9.x).
  • Nightly firmware versions n_240125 and newer.

Caveat: If a developer test build (with a git tag for the version string) is less than 1MB, its checksum won't be checked, because they don't have a "." or "n_" in the version string. Perhaps in the future we should also add a signature in the image header to indicate it's a version that should have a checksum.

Test version on Discord (revised):
https://discord.com/channels/719669764804444213/722101917135798312/1208820528207626280

@NotherNgineer NotherNgineer marked this pull request as ready for review February 18, 2024 00:44
@NotherNgineer NotherNgineer marked this pull request as draft February 18, 2024 16:42
@NotherNgineer NotherNgineer marked this pull request as ready for review February 18, 2024 17:01
Copy link
Member

@gullradriel gullradriel left a comment

Choose a reason for hiding this comment

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

Working fine, good to go !

@gullradriel gullradriel merged commit cd80da5 into portapack-mayhem:next Feb 18, 2024
3 checks passed
@NotherNgineer NotherNgineer deleted the flash branch February 19, 2024 22:45
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