275 Commits

Author SHA1 Message Date
Andrew Gunnerson dff2fff028 Version 2.1.0
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
v2.1.0
2023-09-19 23:56:58 -04:00
Andrew Gunnerson 67bca2e58c CHANGELOG.md: Add entry for PR #153
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-19 23:54:51 -04:00
Andrew Gunnerson 1f08cb6d40 Merge pull request #154 from chenxiaolong/changelog
Shorten changelog links
2023-09-19 23:53:28 -04:00
Andrew Gunnerson ed68f09cb9 Shorten changelog links
The longer PR links have weird line wrapping behavior on the Github web
UI, making it more difficult to read.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-19 23:09:23 -04:00
Andrew Gunnerson 64c11c2dc3 Merge pull request #153 from chenxiaolong/error
Disambiguate some error fields and add more error context
2023-09-19 23:08:15 -04:00
Andrew Gunnerson 5115134b5a Disambiguate some error fields and add more error context
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-19 22:54:43 -04:00
Andrew Gunnerson a2d81d6bfe CHANGELOG.md: Add entry for PR #152
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-19 22:53:14 -04:00
Andrew Gunnerson c5709b90f6 Merge pull request #152 from chenxiaolong/avb
Add CLI for packing and unpacking AVB images
2023-09-19 22:49:07 -04:00
Andrew Gunnerson 2928b96f1f Add CLI for packing and unpacking AVB images
This supports all of the `format::avb` functionality, including
repairing dm-verity images. When packing images, all offsets, sizes,
digests, hash trees, FEC data, signatures, etc. are automatically
recomputed. The goal is that the user can edit any partition image
without needing to think about AVB at all.

A new `--repair` option has also been added to the `avb verify` command
to automatically attempt to all dm-verity images.

As a side effect of the changes, RSA2048 keys are now supported.

This commit also removes the `Clone` implementation from the `PSeekFile`
and `SharedCursor` types. These types use the same underlying file or
memory buffer when cloned, allowing parallel threads to read and write
files using the normal `Read`/`Write` APIs. The intention is that
cloning one of these instances would behave as if a new file handle to
the same file was opened. However, the file offset was also copied
instead of being set to 0, which is confusing. A new `reopen()` method
has been added that explicitly sets the initial offset to 0.

Closes: #148

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-19 22:16:03 -04:00
Andrew Gunnerson 5638a8bb4d CHANGELOG.md: Add entry for PR #150
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-18 21:27:06 -04:00
Andrew Gunnerson a582d0b3e6 Merge pull request #150 from chenxiaolong/escape
Switch to bstr for escaping mostly UTF-8 binary data
2023-09-18 21:25:49 -04:00
Andrew Gunnerson 1d08ffa527 Switch to bstr for escaping mostly UTF-8 binary data
bstr is Unicode-aware and won't split multi-byte codepoints into
multiple `\x##`.

This commit also adds an `escape` module for use with serde so we can
serialize mostly UTF-8 binary data into human-readable files, like TOML.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-18 21:10:47 -04:00
Andrew Gunnerson a95ce56246 CHANGELOG.md: Add entry for PR #149
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-18 17:18:26 -04:00
Andrew Gunnerson ca6ce1fb37 Merge pull request #149 from chenxiaolong/stderr
Print status and warning messages to stderr
2023-09-18 17:16:56 -04:00
Andrew Gunnerson d7a46dcaaf Print status and warning messages to stderr
Also, fix warning!() to allow 0 arguments to match status!() and
println!().

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-18 16:48:25 -04:00
Andrew Gunnerson a4978aaac0 CHANGELOG.md: Add entry for PR #146
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-18 16:39:13 -04:00
Andrew Gunnerson 6ca4023b0d Merge pull request #146 from chenxiaolong/fec
Add support for AVB FEC
2023-09-18 16:37:17 -04:00
Andrew Gunnerson acc3308d37 Hash tree is two words
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-18 15:58:38 -04:00
Andrew Gunnerson 9ca3a690df Verify FEC data in HashtreeDescriptor::verify()
This also fixes the wrong error being reported when the hash tree does
not match and adds additional checks to ensure that there are no gaps
between the image data, hash tree, and FEC data.

Issue: #145

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-18 15:57:40 -04:00
Andrew Gunnerson 335c04711e Add support for AVB FEC
This commit adds initial support for the FEC (forward error correction)
used by dm-verity. The new `avbroot fec` commands operate on FEC data
stored in AOSP's standalone FEC file format. It is compatible with
AOSP's `fec` tool.

Issue: #145

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-18 15:57:09 -04:00
Andrew Gunnerson fb7be77480 CHANGELOG.md: Add entry for PR #147
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-18 00:27:56 -04:00
Andrew Gunnerson e683fce4ab Merge pull request #147 from chenxiaolong/atomicbool
Stopping spewing Arc everywhere for the cancel signal
2023-09-18 00:24:29 -04:00
Andrew Gunnerson 7493cdc5fa Stopping spewing Arc everywhere for the cancel signal
There's no reason all these functions need to care about the ownership
of the cancel signal.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-18 00:12:09 -04:00
Andrew Gunnerson 8f49f49154 Merge pull request #143 from AgentOak/additional-readme-notes
README.md: Add additional notes about lost keys and OTA updaters
2023-09-12 16:22:19 -04:00
Jan Erik Petersen bc6fdd8513 README.md: Add additional notes about lost keys and OTA updaters 2023-09-12 21:09:26 +02:00
Andrew Gunnerson f6c86473c3 Merge pull request #141 from chenxiaolong/sync
e2e: Switch to attohttpc for HTTP downloads
2023-09-11 18:40:32 -04:00
Andrew Gunnerson d0d51f562c e2e: Switch to attohttpc for HTTP downloads
We don't use async for anything else, so switching to a synchronous HTTP
library lets us get rid of the entire async ecosystem and removes 47
packages from e2e's dependency tree.

The only downside is that ^C worst case takes 5 seconds (TCP connect and
read timeouts) or whatever the OS's DNS lookup timeout is. That's good
enough for a test suite.

Performance wise, e2e still easily saturates a gigabit internet
connection.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-09 23:34:48 -04:00
Andrew Gunnerson f31c4134e4 Version 2.0.3
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
v2.0.3
2023-09-07 14:01:00 -04:00
Andrew Gunnerson dd0d7f334b CHANGELOG.md: Add entry for PR #140
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-07 13:59:43 -04:00
Andrew Gunnerson e4a2a4c24c Merge pull request #140 from chenxiaolong/version
Add `--version` option
2023-09-07 13:58:50 -04:00
Andrew Gunnerson cc9aab197c CHANGELOG.md: Add entry for PR #139
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-07 13:58:23 -04:00
Andrew Gunnerson 92da30f53c Merge pull request #139 from chenxiaolong/xz
Upgrade xz to 5.4.4 and enable all encoders and decoders
2023-09-07 13:52:14 -04:00
Andrew Gunnerson 26142b0271 Upgrade xz to 5.4.4 and enable all encoders and decoders
When using the xz2/static feature, the xz2 crate uses a bundled version
of xz 5.2 and doesn't enable all of the available encoders and decoders.
This prevents certain payload data from being decompressed.

Fixes: #138

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-07 13:40:34 -04:00
Andrew Gunnerson c8df3286df Add --version option
Issue: #138

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-07 13:37:24 -04:00
Andrew Gunnerson 65979beff4 Version 2.0.2
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
v2.0.2
2023-09-06 23:16:01 -04:00
Andrew Gunnerson 47cf015f15 CHANGELOG.md: Add entry for PR #137
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-06 23:15:19 -04:00
Andrew Gunnerson e40e036159 Merge pull request #137 from chenxiaolong/anyhow
Remove unnecessary use of anyhow macro
2023-09-06 23:13:04 -04:00
Andrew Gunnerson 0d2a158ead Remove unnecessary use of anyhow macro
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-06 23:04:18 -04:00
Andrew Gunnerson ddabb19b4a CHANGELOG.md: Add entry for PR #136
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-06 22:51:58 -04:00
Andrew Gunnerson 3c05eb300c Merge pull request #136 from chenxiaolong/offset
PayloadWriter: Only set data_offset for operations that reference blobs
2023-09-06 22:50:31 -04:00
Andrew Gunnerson 2ffb1dfdbd PayloadWriter: Only set data_offset for operations that reference blobs
This fixes `data_offset` being set for `ZERO` and `DISCARD` operations,
which prevents some images (eg. `ossi`) from being flashed due to
update_engine's strict field validation.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-06 22:40:15 -04:00
Andrew Gunnerson f93dc55f70 CHANGELOG.md: Add entry for PR #135
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-06 20:05:41 -04:00
Andrew Gunnerson 393e65f6b4 Merge pull request #135 from chenxiaolong/full
Move full OTA check to patch/extract subcommand function
2023-09-06 20:03:47 -04:00
Andrew Gunnerson 3f86a67038 Move full OTA check to patch/extract subcommand function
This way, the payload-related functions can be used to parse incremental
OTA files.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-06 19:51:48 -04:00
Andrew Gunnerson 4337170f57 Version 2.0.1
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
v2.0.1
2023-09-04 17:11:28 -04:00
Andrew Gunnerson a73365592f CHANGELOG.md: Add entry for PR #132
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-04 16:41:28 -04:00
Andrew Gunnerson 0018e8a5ba Merge pull request #132 from chenxiaolong/magisk
boot.rs: Allow Magisk 263xx
2023-09-04 16:39:14 -04:00
Andrew Gunnerson adf0014da2 boot.rs: Allow Magisk 263xx
There are no changes that break avbroot.

Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
2023-09-04 16:30:39 -04:00
Andrew Gunnerson 1179f9f2fa Version 2.0.0
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
v2.0.0
2023-08-31 23:43:22 -04:00
Andrew Gunnerson bbe793bd2d Merge pull request #130 from chenxiaolong/rust
avbroot 2.0: Rewrite in Rust
2023-08-31 23:42:34 -04:00