Commit Graph

48 Commits

Author SHA1 Message Date
Alice Wang af1d15bea3 apkverify:Raise NotFound error when searching for signature
Bug: 197052966
Test: atest libapkverify.test
Change-Id: Id729dc64226dbfb78524620266510b1ffa559f2e
2022-09-09 18:16:00 +00:00
Alice Wang 9807322a5e apkverify:Test apk digest computation
Test: atest libapkverify.test
Change-Id: I33ade0f39f28494f6a0f7ed0cb324466ed2ae495
2022-09-09 14:10:19 +00:00
Alice Wang 25109dd9e5 Merge "Test V4 apk_digest computation in apkverify" 2022-09-09 13:55:54 +00:00
Alice Wang a94ba17487 Test V4 apk_digest computation in apkverify
Bug: 239534874
Test: atest libapkverify.test
Change-Id: I73df9d67be0fdc922299968a56db7ed87dec171c
2022-09-09 12:30:42 +00:00
Treehugger Robot efe387f6f3 Merge "Test APK section zip methods with real APK files" 2022-09-09 08:50:05 +00:00
Alice Wang ed79eabc0c Test APK section zip methods with real APK files
This CL also renames some variables to make them consistent with
the apk structure spec.

Test: atest libapkverify.test
Change-Id: Iba2a060916a59f295e702d4ef5a3618076acf4ed
2022-09-09 07:28:20 +00:00
Alice Wang 4b7c0bae5c cleanup:Limit the scope of dead_code in v3
Test: m libapkverity
Change-Id: Idd1605608da8aec13ea4b178f3032678b338185d
2022-09-07 15:12:36 +00:00
Alan Stokes 6472ccd6e5 Migrate to Rust 2021 edition
I only wanted this in one place, but thought we might as well do it
all in one go.

In a couple of places I added an explicit edition instead of using the
default (whatever that is).

See https://doc.rust-lang.org/edition-guide/rust-2021/index.html.

Test: find . -name "Android.bp" -type f|xargs grep edition | grep -v 2021
Test: atest ComposHostTestCases MicrodroidHostTestCases
Change-Id: I4de050078b303cc5614d230e0d36d5454d60a807
2022-08-31 14:40:53 +01:00
Andrew Walbran 491382d90d Merge "Moved binder_common to rpcbinder package under binder directory." 2022-08-23 15:31:41 +00:00
Treehugger Robot d1bd3c141b Merge changes I5e4db74f,I167148cd,I512a2cd0
* changes:
  Send UID and VM identifier to existing atoms
  Implement write_vm_exited_stats for VmExited atom
  Implement write_vm_booted_stats for VmBooted atom
2022-08-22 11:11:38 +00:00
Seungjae Yoo 62085c0e65 Send UID and VM identifier to existing atoms
Bug: 236252851
Test: N/A

Change-Id: I5e4db74f9a5cefd071676b9d248e9c5d91c5bfdd
2022-08-22 02:08:34 +00:00
David Brazdil 5f7c3c72c4 Move AVF tests to avf-pre/postsubmit test group
AVF presubmit test config currently runs all tests in the 'presubmit'
group. However, in presubmit the test configs are invoked with all
TEST_MAPPING paths from all affected CLs. Our test config can therefore
run tests from TEST_MAPPINGs outside of the Virtualization repo.

To work around this problem, move all Virtualization tests to
'avf-presubmit' group. Test config running in presubmit will still be
invoked with TEST_MAPPINGs from various repos but only our tests will
match the group.

Rename the postsubmit group to 'avf-postsubmit' for consistency.

Bug: 236755822
Test: atest --test-mapping packages/modules/Virtualization:avf-presubmit
Test: atest --test-mapping packages/modules/Virtualization:avf-postsubmit
Change-Id: I7be5781bef4b6e060a69724c7b4256423adc649c
2022-08-19 15:40:57 +00:00
Andrew Walbran 7eb5ca4ff4 Moved binder_common to rpcbinder package under binder directory.
Bug: 234019127
Bug: 184872979
Test: atest compos_key_tests MicrodroidHostTestCases MicrodroidTestApp libbinder_rs-internal_test
Change-Id: Iceac394d2341f463362e9bbe8908e5d8a1b3f34f
2022-08-19 10:32:26 +00:00
Chris Wailes 6f5a9b5d16 Update source for Rust 1.63.0
Test: m rust
Bug: 241303140
Change-Id: I049703784a73242c84414ea12e0ed82609add8c2
2022-08-11 15:24:21 -07:00
Andrew Walbran 46999c9189 Moved LazyServiceGuard to binder crate.
Bug: 234019127
Test: atest compos_key_tests MicrodroidHostTestCases MicrodroidTestApp libbinder_rs-internal_test
Change-Id: I3b771e1fa401375c4252c486c9af1607a20f7903
2022-08-10 13:37:48 +00:00
Andrew Walbran dcf9d58c40 Use new binder exception constructors moved from binder_common.
Bug: 234019127
Test: atest compos_key_tests MicrodroidHostTestCases MicrodroidTestApp
Change-Id: I938c9d0ebae90c933c9a7ee8c27e9ecb0cc3e5fa
2022-08-09 14:08:54 +00:00
Andrew Walbran 7e265dda44 Merge "Add safe wrapper for RpcPreconnectedClient." 2022-08-03 15:00:57 +00:00
Andrew Walbran c944faeb5d Add safe wrapper for RpcPreconnectedClient.
Test: atest compos_key_tests MicrodroidHostTestCases MicrodroidTestApp
Change-Id: I8dcc6c9b0465950bfaced03699fa3167dc3dc641
2022-08-03 12:31:59 +00:00
Andrew Walbran 065145dc5b Merge "Add safe wrapper for RunRpcServerWithFactory." 2022-08-02 16:45:25 +00:00
Treehugger Robot 634a8719d3 Merge "Fix formatting of doc comment." 2022-08-02 16:22:04 +00:00
Andrew Walbran 0fd0ff0b6f Add safe wrapper for RunRpcServerWithFactory.
Test: atest compos_key_tests MicrodroidHostTestCases MicrodroidTestApp
Change-Id: Iaab166d29e0ec08161db50c5e1419283bf304499
2022-08-02 15:26:53 +00:00
Andrew Walbran aa0ded59bd Fix formatting of doc comment.
Test: N/A
Change-Id: Iabfa2ab57e27a87adeee52f5bec95ea52bd66dd0
2022-08-02 12:48:03 +00:00
Matthew Maurer f73794d612 rust: Visibility exports for bindgen
We are now default restricting bindgen visibility to subpackages. This
change is part of a set of changes adding explicit visibility for
bindgen libraries which are already being used elsewhere.

* If these visibility rules are to allow access by the safe bindings
  library which lives elsewhere in the codebase, no action is needed.
* If safe bindings do not exist, and you own this library, now is a good
  time to think about producing them and transitioning your (now
  enumerated) client list.
* If safe bindings exist, but there is a surprise client of the raw
  bindings on this list, now is a good time to talk to them about why
  they don't want to use your safe bindings.

Bug: 166332519
Test: m
Change-Id: I3f731ac41b36d28a3f86d22133bf57f2721e9baa
2022-07-29 09:04:03 -07:00
Alice Wang 3356d6da92 Add util methods to get payload vbmeta image hash
The methods will be used later to build avmdtool.

Test: libapexutil_rust.test
Change-Id: I28bde2f57cb2c4e05f4cd4be5abf52cb6f788003
2022-07-18 11:28:22 +00:00
Alice Wang 79713d9b6e Migrate from the x509-parser to the openssl crate
Bug: 238630850
Test: atest libapkverify.integration_test
Change-Id: I37605b3696eca0561e669fb501331ab7d7ec72ba
2022-07-15 10:42:13 +00:00
Treehugger Robot c44495dd95 Merge "Extract library for VBMeta image handling" 2022-06-23 13:53:22 +00:00
Andrew Scull 381272544b Extract library for VBMeta image handling
The APEX handling library included VBMeta image verification and parsing
but split this out to its own library so that it can be used by other
components too. The new library hides the libavb FFI to provide a safe
interface.

The library is not complete, it only knows about hashtree descriptors
and its root digest, but other aspects can be exposed as there is need
for them.

Test: atest libvbmeta_rust.test
Test: atest libapexutil_rust.test
Bug: 234564414
Change-Id: Ie176b816f63d2ff7f75deab6c07e1f9bb2e54594
2022-06-23 12:32:57 +00:00
Alan Stokes c3f2ac2fb6 Fix tests on aosp_cf_x86_64_only_phone
Our nested virtualization check failed on this target. Move to a
prefix check to support this device and any other ones that appear.

Also extract the code to do the check to a library, rather than
changing in two places.

Bug: 236922543
Test: Presubmit
Change-Id: Id1d424f5f107e2098d89ca2ea8089ba956f212ca
2022-06-23 12:25:00 +01:00
Seungjae Yoo 460cc830f2 Merge "Improve test coverage v3-only for apkverify" 2022-06-14 00:43:46 +00:00
Seungjae Yoo 91e250a74b Improve test coverage v3-only for apkverify
APKs are brought from tools/apksig/src/test/resources/com/android/apksig
Covered test for all existing v3-only apks at there.

Bug: 233573377
Test: atest libapkverify.integration_test

Change-Id: Icdad3afa352fec2286d70a395f18a0973e6e2def
2022-06-09 09:20:50 +00:00
Andrew Scull 11d53ee9c7 idsig: Include the APK digest
Get the best APK digest from the APK and include it in the generated
idsig.

Test: atest libidsig.test
Bug: 234564414
Change-Id: If55eab3bb62131bcdb9dfeb6000b9a5ba7ab9236
2022-06-01 14:35:58 +00:00
Andrew Scull a11b83a26b apkverify: Add function to pick v4 apk digest
The v4 signing scheme includes an APK digest to match the strongest
digest available in the v3 or v2. Add a function to extract that digest
from an APK.

Test: libapkverify.test
Bug: 234564414
Change-Id: I69ce9c9c5ff6daf1f09e1bd4620ebf1ce015b5fa
2022-06-01 14:35:39 +00:00
Andrew Scull 9173eb83ba apkverify: Rank based on v4 preferences
The signing algorithms were already ranked following the order of
preference used by the v4 signing scheme, so there's no functional
change. Documentation is added to make this connection explicit and a
functions for selecting the best signed is factored out.

Test: libapkverify.test
Bug: 234564414
Change-Id: I28e25ce744cbc5854d1cb2b73fee9f966d2f8eb6
2022-06-01 14:35:34 +00:00
Treehugger Robot 6ab47362a0 Merge "idsig: Migrate from ring to the openssl crate" 2022-05-25 03:33:05 +00:00
Andrew Scull 462569de42 idsig: Migrate from ring to the openssl crate
Bug: 232676161
Test: atest libidsig.test
Change-Id: Icdda672a802e24f13ca071312d40bc1b44665155
2022-05-24 10:31:09 +00:00
Andrew Scull 1c32ed1788 apkverify: Make the library available for host tools
Don't mark the tests as host supported as they will otherwise fail when
the server tries to run them as the dependencies don't get bundled
properly.

Test: presbumit
Change-Id: I8ce5a21e5a27e15df1df84ea7d682c24cd8c4d67
2022-05-24 07:39:24 +00:00
Treehugger Robot 5877e1b2c0 Merge "Revert "apkverify: Make the library available for host tools"" 2022-05-23 12:51:41 +00:00
Andrew Scull 199fbcf5e3 Revert "apkverify: Make the library available for host tools"
This reverts commit 228b71fc20.

Reason for revert: b/233588380 caused by b/204562227

Change-Id: Ia62d407fa48470569b0f89b4e880019eb599e79e
2022-05-23 12:00:27 +00:00
Treehugger Robot b26544942f Merge "apkverify: Migrate from ring to openssl crate" 2022-05-23 10:19:42 +00:00
Andrew Scull 36f326404f Merge "apkverify: Make the library available for host tools" 2022-05-23 10:09:28 +00:00
Andrew Scull c208eb4f66 apkverify: Migrate from ring to openssl crate
Switch to using the certified implementation of cryptographic
algorithms, boringssl, that's available through the openssl crate.

Add an ECDSA signed APK to the test suite to give that algorithm some
coverage.

Bug: 232676161
Test: atest libapkverify.test
Test: atest libapkverify.integration_test
Change-Id: I5f86b40e110d8aaeb22109757253950bd7824833
2022-05-23 08:24:34 +00:00
Andrew Scull 228b71fc20 apkverify: Make the library available for host tools
Test: presubmit
Change-Id: Id0f0dff9d249396f06b2eb6975c9eacd348189f9
2022-05-23 07:35:56 +00:00
Andrew Scull f3fd4c63f7 apkverify: Re-export functions rather than wrap them
The library exposes two functions that are just wrappers around the v3
implementation. Make that more clear by simply re-exporting the v3
functions. The TODO for adding v2 support remains.

The documentation is consolidated so the same information remains.

Test: atest libapkverify.test
Change-Id: Id497486dd054474516a664be1539b41732085b79
2022-05-22 15:55:31 +00:00
Andrew Scull 11638791c0 Move APEX handling to a library
Make a library for APEX handling using the microdroid_manager logic as
the basis. Other components are going to need to be able to extract the
keys from APEXs so make the logic reusable and available to host tools.

Test: atest microdroid_manager_test
Test: atest libapexutil_rust.test
Change-Id: I36abf21b59b67046b1464bf47f7be40186926410
2022-04-29 12:15:29 +00:00
Andrew Scull 8e92a6eff6 Make avb_bindgen host supported
libavb is host supported so make the bindings be the same.

Change-Id: I542d42ad076bcff43f1a53e73ed2cd869cc5fee8
2022-04-11 17:09:41 +00:00
Jiyong Park dcf1741a18 Specify virtual platform version and enforce it
VM config can now specify the requirement on the virtual platform
version. At runtime, the requirement is matched against the actual
virtual platform version that crosvm implements. If they don't match,
the VM can't be created. The version format follows SemVer, allowing us
to express backwards compatible and incompatible changes in the future.

Bug: 193504487
Test: atest VirtualizationTestCases
Change-Id: I23d370081e10399502178b9cfe8a46b05addf186
2022-02-25 16:21:22 +09:00
Jooyung Han 5f0f668e47 Move libs into libs/
Bug: N/A
Test: m
Change-Id: I50ade90dab13fa0ee83b79f17a8ec3cc012fe497
2022-02-19 00:12:32 +09:00
Jooyung Han c8deb47923 Store/Pass root digests of APEX payload
Root digests of APEX payload are now collected by microdroid_manager and
stored in instance.img and passed to apexd.

Bug: 199371341
Test: MicrodroidHostTestCases
Change-Id: I940347068400822f7d8140c3daf68036f553b087
2021-09-13 18:32:21 +09:00