Use vbmeta digest to detect same-version upgrades #92
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using Custota in conjunction with avbroot, there may be situations where a new patched OTA has the same version as the currently running OS. The most common example is updating Magisk.
With this commit, if the OTA's fingerprint matches the current OS fingerprint, Custota will compare the vbmeta digest to determine if an update is necessary. This should reliably detect every scenario where the OTA's version is the same, but the partition contents differ.
The vbmeta digest is not readily accessible in an OTA, so custota-tool will compute it when generating the csig file. This is an unfortunately an expensive operation that requires extracting partitions from the OTA, so it will slow down custota-tool a decent bit.
Because Custota's csig file parser is strict, the file format version has been bumped to version 2. csig files generated by a new version of custota-tool are incompatible with old versions of Custota. However, new versions of Custota can continue to read old version 1 csig files. It will fall back to the old behavior when encountering an old csig file.
Fixes: #38