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>
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>
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>
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>
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>
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>
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>
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>
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>