Commit graph

450 commits

Author SHA1 Message Date
Shawn Willden
0f89bc1270 Provide alternate SE RoT provisioning path.
On some devices it is infeasible to provision the KeyMint RoT bits in
the Android Bootloader.  This provides an alternate path to provision
them from the TEE during early boot.

Bug: 219076736
Test: VtsAidlKeyMintTargetTest
Change-Id: Ibae9050b9a102dad3710f9495d3dfa43fa1d1b3f
Merged-In: Ibae9050b9a102dad3710f9495d3dfa43fa1d1b3f
2022-02-22 23:51:15 -07:00
David Drysdale
74f763961a Include correct authorization_set.h header
Bug: 206470603
Test: TreeHugger
Change-Id: I748660d45a539c9e2c2e13605d1d4f61b1b2fb5e
2022-02-23 06:27:16 +00:00
Tri Vo
ccc11f4969 trusty: Convert Trusty driver tests to python_test
Original tests are implemented as shell scripts here:
https://android.googlesource.com/trusty/vendor/google/aosp/+/refs/heads/master/scripts/test-map#100

Bug: 219992178
Test: trusty_driver_test
Change-Id: I8a55cb660bb0cb27bb4ef32aaa0658d0c17c36e3
2022-02-22 17:40:29 -08:00
Max Bires
b6179f25be Bumping the HAL client version.
This CL bumps the reported version for Trusty's
IRemotelyProvisionedComponent HAL interface for KeyMint. It also adds
the uniqueId field added to the RpcHardwareInfo in version 2.

Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I336ec7cd12ca2ea3b836601ebe0ca400524b8ca4
2022-02-15 02:24:04 +00:00
Stephen Crane
d160497c59 storageproxyd: Sync parent dir when creating a file
Switches to syncing the parent directory immediately when creating a new
file rather than lazily waiting for a sync request. Because we only
create a new file when the userdata partition is cleared, this operation
doesn't need to be fast in the normal case. This avoids needing to track
the parent directory for each file for lazy syncing later, since storage
backing files may be in a subdirectory of the root.

Test: m storageproxyd, boot using new service binary
Bug: None
Change-Id: Ibcafae7da493864515c099bd81d48c95b0e5d8c3
2022-01-21 14:42:01 -08:00
Stephen Crane
6f890b474b storageproxyd: Use alternate data path if in DSU state
Adds a check for a DSU mode boot in storageproxyd. Changes path handling
so that storageproxyd will not allow opening a file in the root data
path in DSU mode. Instead, storageproxyd creates an "alternate/"
directory in the data directory and the TA must use this directory to
store its backing file.

Re-landing reverted change: Iad68872dc6915f64eaf26cd3c92c04d9071ef169

Test: Boot into DSU and inspect logs for "Cannot open root data file"
Test: Test that TD writes in DSU mode don't corrupt host image storage
when using a compatible storage TA that supports alternate data mode.
Bug: 203719297

Change-Id: I1d07e7c3d15dc1beba2d340181d1b11a7988f869
2022-01-21 14:41:17 -08:00
David Li
0a4e111bc6 Merge "Revert "storageproxyd: Use alternate data path if in DSU state"" 2022-01-21 07:59:42 +00:00
Stephen Crane
97b8c1d697 Revert "storageproxyd: Use alternate data path if in DSU state"
This reverts commit 7c5658b5fd.

Reason for revert: selinux test errors in some branches

Bug: 215630608
Change-Id: I2a9c9d914b6c1d1248b4f11bd69484ae6b0ba8d1
2022-01-21 06:54:43 +00:00
Treehugger Robot
3ecaae4fdf Merge "storageproxyd: Use alternate data path if in DSU state" 2022-01-20 19:10:40 +00:00
David Drysdale
37514bb907 Report Trusty KeyMint as KmVersion::KEYMINT_2
Bug: 194358913
Test: TreeHugger, VtsAidlKeyMintTargetTest
Change-Id: Ic5e321c739a66a384907539a339511e5418e9c6a
2021-12-15 12:02:06 +00:00
Stephen Crane
7c5658b5fd storageproxyd: Use alternate data path if in DSU state
Adds a check for a DSU mode boot in storageproxyd. Changes path handling
so that storageproxyd will not allow opening a file in the root data
path in DSU mode. Instead, storageproxyd creates an "alternate/"
directory in the data directory and the TA must use this directory to
store its backing file.

Test: Boot into DSU and inspect logs for "Cannot open root data file"
Test: Test that TD writes in DSU mode don't corrupt host image storage
when using a compatible storage TA that supports alternate data mode.

Bug: 203719297
Change-Id: Iad68872dc6915f64eaf26cd3c92c04d9071ef169
2021-12-14 15:24:40 -08:00
David Drysdale
c5b7d179c2 Depend on KeyMint HAL via default
This allows for easier bumping of the KeyMint version level.

At the moment this change should have no effect: the same dependency
is used, just reached via a default rather than explicitly.

However, when the KeyMint version increases in the near future, using
this default should mean that no change is needed here: the default
definition will change to -V2 and this will be referenced here.

Test: TreeHugger
Change-Id: Ic250e5b91ee2b48cd7a05783ce21af16ae330ed1
2021-12-02 08:16:25 +00:00
Armelle Laine
904cae37ce Merge "trusty: update default_applicable_licenses "Android-Apache-2.0"" 2021-11-30 23:41:46 +00:00
Armelle Laine
c2cc120d60 trusty: update default_applicable_licenses "Android-Apache-2.0"
rpmb_dev is a rpmb device stub used in emulation
as well as platform early bringup so we don't expect
any open source developer to be impacted by the migration
from MIT to Apache 2.0.
Note that with such a migration to Apache 2.0, recipients
won't receive lesser permissions, they just have updated
requirements for which license text to share along with the code.

Bug: 191508826
Test: None
Signed-off-by: Armelle Laine <armellel@google.com>
Change-Id: I0ae2bc66901344f8f9227e929a98946e52c50355
2021-11-29 19:53:54 +00:00
Treehugger Robot
1d02ce9ad4 Merge "Configure Trusty KeyMint devices to use attest_keys." 2021-11-22 18:21:09 +00:00
Shawn Willden
b440e0c077 Configure Trusty KeyMint devices to use attest_keys.
Change-Id: If86133e7648b601a4a61ea5614e6971a2bb8d264
Bug: 197096139
Test: Manual
2021-11-22 16:52:30 +00:00
David Drysdale
fcf3fc08e4 KeyMint: don't mix Binder and std shared pointers
Bug: 203871378
Test: VtsAidlKeyMintTargetTest, TreeHugger
Change-Id: I8671342939af2bbdef643be9ce81b0bb9e7ae1a9
2021-10-28 15:39:34 +01:00
Marco Nelissen
3e923cd527 Fix 32-bit build
Bug: None
Test: build
Change-Id: Id1a9c2bd4526750eca9b85896d0e90eed58b8f51
2021-10-20 10:11:52 -07:00
Marco Nelissen
08fec49a3b Log if keymaster IPC takes too long
Bug: None
Test: run with very low timeout and verify it logs
Change-Id: I2818683f65c2191518373609c6171c056de55a9a
2021-10-20 07:51:05 -07:00
Thurston Dang
7e8dab775b storageproxyd: discard writes when checkpointing, if necessary
If a checkpointing operation is in progress, discard any write operations
that are flagged as STORAGE_MSG_FLAG_PRE_COMMIT_CHECKPOINT. In tandem
with trusty-side changes that set the flag appropriately, this avoids
the awkward case where the checkpoint is rolled back, which potentially
leads to inconsistency between the data and the superblock.

Based on Stephen's CL/1845477 "Add helper to check checkpoint state of
mounts".

Test: m storageproxyd
Bug: 194313068
Change-Id: Ib6a432db1bc1b034f803b743b0d7322e3f31d814
2021-10-12 03:47:24 +00:00
Armelle Laine
a3359bb3c9 Merge "storageproxyd: Retry RPMB request on UNIT ATTENTION" 2021-10-04 17:32:51 +00:00
Max Bires
9eb326c9c0 Merge "Make RemoteProvisioner required for KeyMint cc_bin" 2021-09-29 19:26:40 +00:00
Stephen Crane
a9085181af storageproxyd: Retry RPMB request on UNIT ATTENTION
Attempts a retry of the intial write or read when an RPMB command
triggers a UNIT ATTENTION condition. This causes the UA status to be
reset and hopefully result in a successful command. This runs the risk
of retrying a successful write, but we wouldn't have been able to get
the RPMB response after that write anyway due to the UA condition.

Test: m storageproxyd
Bug: 200037389
Change-Id: Ib970e779365bb396756c114684c7f6e56a737ab1
2021-09-29 10:28:43 -07:00
Marco Nelissen
0aae5be54f tipc_test: allow connecting to arbitrary services
Add an option to specify a service name. Currently only the "connect"
test supports this, and will try to connect to the named service
instead of the echo and datasink services.
Also fix the built-in help text, as it was missing the "burst" option,
and didn't mention that the "connect" test connects to both the echo
and datasink services.

Bug: 200034376
Test: run

Change-Id: I3903f94c16320f8e07ac4bfb69e3bb45329138c0
2021-09-24 20:14:24 +00:00
Tri Vo
6aaac7cad9 Merge "storageproxyd: Fix inverted conditional in error checking" 2021-09-24 19:05:05 +00:00
Stephen Crane
bdb2eba4a4 storageproxyd: Fix inverted conditional in error checking
check_scci_sense (now renamed unexpected_scsi_sense) was supposed to
return false iff the sense data was valid and did not contain an error.
This return value was inverted. Invert the return values and rename the
function to clarify its role.

Test: m storageproxyd
Bug: 195544379
Change-Id: I3b84188aabe58345a83d2fd57bb8103e730cf365
2021-09-24 10:20:58 -07:00
Marco Nelissen
92cd8891ff trusty_apploader: log to stderr
Print an error message to stderr on connection failure, so that the
command doesn't exit silently in case of the common user error of
forgetting to run it as root.

Bug: None
Test: Run as regular user, see "permission denied" message.
Change-Id: Ia213dedccab27e6152b5eb969fbee06d82d3d4ff
2021-09-21 15:51:58 -07:00
Marco Nelissen
7637d25ae0 re-tab and clang-format tipc_test
tipc_test.c used a mix of tabs and spaces for indentation and other
things that clang-format doesn't like, so retab and format it.

Bug: None
Test: build
Change-Id: I9b3a64bae54697d43e7fb39fe7d6e1dabe0be380
2021-09-20 17:10:05 -07:00
Stephen Crane
38003165b2 [storageproxyd] Dump binary buffers to log instead of stderr
Rewrites the buffer logging to print to the Android log instead of
stderr. The storageproxyd service is started by init and stderr is not
logged anywhere. Because we want to log sense data errors under normal
operation, we need to log to logcat instead of stderr.

Test: Define RPMB_DEBUG, build for qemu-trusty, run, inspect logcat
Bug: 195544379
Change-Id: Iecc0d4680420bb92c94be628789093888a2f1941
2021-09-15 14:17:38 -07:00
Tri Vo
11ffd99154 Merge "Revert^2 "Activate KeyMint."" 2021-09-13 23:31:49 +00:00
Shawn Willden
9863dd3c10 Revert^2 "Activate KeyMint."
81cdd3f3da

Bug: 177729159
Test: VtsAidlKeyMintTargetTest & CtsKeystoreTestCases
Change-Id: I85d9e57fe83627992ddaa705946893a4b9890001
Merged-In: I85d9e57fe83627992ddaa705946893a4b9890001
2021-09-09 14:27:41 -07:00
Treehugger Robot
4fd0ff9756 Merge changes I928ddebc,Iade322a2
* changes:
  storageproxyd: Add logging of failed RPMB transactions
  storageproxyd: Add file handle param to debug buffer print
2021-09-08 20:01:31 +00:00
Stephen Crane
310d805d96 storageproxyd: Add logging of failed RPMB transactions
Adds parsing and logging of SCSI errors from SG_IO calls for RPMB. Does
not alter behavior of the RPMB proxy in response to these errors.

Test: m storageproxyd
Bug: 195544379
Change-Id: I928ddebcb65aa6c305d3dcab7c64bd19d11a50fa
2021-09-07 19:54:16 -07:00
Stephen Crane
dd3f7b867d storageproxyd: Add file handle param to debug buffer print
Adds a file handle parameter to the debug print_buf function to allow
printing to either stdout or stderr.

Test: m storageproxyd
Bug: 195544379
Change-Id: Iade322a21312a676b3599bddafdfc43b599617ea
2021-09-07 19:53:04 -07:00
Max Bires
b688b38666 Make RemoteProvisioner required for KeyMint cc_bin
This change adds the RPK apk back into the image for Trusty Keymint
devices, though the functionality will still be disabled by the
server check-in for now.

Ignore-AOSP-First: Will be CP'ed to AOSP
Bug: 194509629
Test: atest RemoteProvisionerUnitTests
Change-Id: Ic20ca119bd9c0614f7559b24ad60718c813a0cca
2021-08-26 00:31:44 -07:00
Janis Danisevskis
5b4b52126e Handle long responses by keymint IPC.
The KeyMint TA may send responses that are longer thant the 8K buffer
that the KeyMint HAL holds. This patch introduces
trusty_keymaster_call_2 which can grow the receive buffer on demand.

Bug: 195622501
Test: VTS and CTS test for regression testing.
Change-Id: Ia06e590e547e649ca81cda9a71851f334970788f
Merged-In: Ia06e590e547e649ca81cda9a71851f334970788f
2021-08-12 19:21:11 +00:00
Tri Vo
2b52180603 Merge "trusty: storage: Allow starting without /data mounted" 2021-08-06 05:29:45 +00:00
Tri Vo
91e475068d trusty: storage: Allow starting without /data mounted
Bug: 187105270
Test: m
Change-Id: I3735e0752a6e502536000bd3102abda30cbd58fe
2021-08-02 15:02:11 -07:00
Jiyong Park
1486987d34 Remove ndk_platform backend. Use the ndk backend.
The ndk_platform backend will soon be deprecated because the ndk backend
can serve the same purpose. This is to eliminate the confusion about
having two variants (ndk and ndk_platform) for the same 'ndk' backend.

Bug: 161456198
Test: m
Change-Id: I7e60ee840fd64f9e36bafa8baea19daab9c15cea
2021-07-27 12:19:00 +09:00
Armelle Laine
d6ddc20d83 Merge "[trusty-base] Update Trusty Keymint properties" 2021-07-23 14:43:12 +00:00
David Drysdale
267adbd4f1 Merge "TrustyKeyMint: support boot, vendor patchlevels" 2021-07-22 06:32:32 +00:00
David Drysdale
e7697d7101 TrustyKeyMint: support boot, vendor patchlevels
- Invoke TrustyKeymaster::ConfigureVendorPatchlevel() from
   remote keymint Initialize(), using vendor patchlevel retrieved
   from property.
 - Add TrustyKeymaster::ConfigureVendorPatchlevel() method to
   send the CONFIGURE_VENDOR_PATCHLEVEL message.
 - Add message type values for
   CONFIGURE_{VENDOR,BOOT}_PATCHLEVEL messages.

Test: pending device availability
Change-Id: Ie42345112b08ef9c669535cef2de60ea77da15b4
2021-07-21 16:26:32 +01:00
Armelle Laine
bd1dbe2bb5 [trusty-base] Update Trusty Keymint properties
Support legacy 3DES algorithm
(property parity with software implementation)

Bug: 193715461
Change-Id: Id2c45b94b2b3375972dd53fa65186007eda35970
Test: atest VtsAidlKeyMintTargetTest
Signed-off-by: Armelle Laine <armellel@google.com>
2021-07-19 16:14:20 +00:00
David Drysdale
a2aba786fe Merge "Splitting out Trusty IPC into a library." 2021-07-19 09:16:47 +00:00
Wenhao Wang
6e0a762290 trusty:storageproxyd: Add wakelock to the UFS commands
We add a wakelock to the sequence of UFS commands so that
the sequence will not be disrrupted when devices get suspended.

Bug: 193456223
Test: Trusty storage tests
Change-Id: Ib90f8b284017cf261d2a2aea940834a42c21de02
2021-07-15 22:34:58 -07:00
Wenhao Wang
09b493b143 trusty:storageproxyd: Fix return paths on errors
The function send_ufs_rpmb_req is missing return paths on errors.
This patch fixes it so that any UFS command failure will return
error code to the function caller.

Bug: 193855098
Test: Trusty storage tests
Change-Id: I391ecff9ed3f892b7c3adae0ceeb18930791326f
2021-07-15 22:24:11 -07:00
Max Bires
a9362a4e60 Splitting out Trusty IPC into a library.
This allows the relevant IPC code to be included in the provisioner tool
easily as it's shuffled over into a non-AOSP component due to
chip specific requirements in provisioning Device IDs.

Bug: 178796950
Test: Stuff builds
Merged-In: I57482e89035e8648544f87291ec14c6aece09bd0
Change-Id: I57482e89035e8648544f87291ec14c6aece09bd0
2021-07-15 16:17:59 +01:00
Seth Moore
8fe5602099 Merge "Client side implementation of Trusty IRPC HAL" 2021-07-14 16:35:37 +00:00
Tri Vo
f9cfeac49e trusty: Increase timeout for ConfirmationUI fuzzer
Bug: 192923547
Test: trusty_confirmationui_msg_fuzzer
Change-Id: I72755b0a35bbc3f2540672ca53acd14b1add38cb
2021-07-12 16:34:01 -07:00
Max Bires
95b5b04872 Client side implementation of Trusty IRPC HAL
This change includes the code necessary to communicate to the
IRemotelyProvisionedComponent backend implementation running in Trusty.
It also makes the relevant changes to the manifest XML file to add the
IRemotelyProvisionedComponent HAL.

Bug: 192228022
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I32c30ce2dc44e95ff91574ce405f10e3b5dc9699
Merged-In: I32c30ce2dc44e95ff91574ce405f10e3b5dc9699
2021-07-08 03:00:51 +00:00
Janis Danisevskis
b24f12226a Forward HAT and ConfirmationToken to TA on finish.
The Trusty KeyMint HAL did not forward auth tokens and confirmation
tokens to the TA. This broke all per-op-bound key operations.

Test: CtsVerifier biometrics tests.
Bug: 192201272
Merged-In: Ifb2b08514acab78ff3d4fec4bc928260820d4ce0
Change-Id: Ifb2b08514acab78ff3d4fec4bc928260820d4ce0
2021-07-01 15:17:32 -07:00
Treehugger Robot
d669e6291c Merge "trusty: Increase maximum number of coverage counters" 2021-06-25 18:50:30 +00:00
Tri Vo
8ad386576f trusty: Increase maximum number of coverage counters
Confirmation UI TA has 52585 counters.

Bug: 171750250
Test: trusty_confirmationui_tipc_fuzzer
Change-Id: Iecb7c88c41c67ce4ab22c56b9e34ad5370b4018d
2021-06-24 22:23:21 -07:00
Shawn Willden
fed81d8e41 Add TrustyKeyMintDevice
Bug: 177729159
Test: Not testable until more CLs land
Merged-In: Iea4e70bb5b4ce051492f2e42d2e0d219d088388e
Change-Id: Iea4e70bb5b4ce051492f2e42d2e0d219d088388e
2021-06-18 07:11:36 -06:00
Andrei Homescu
4b5afea93b trusty: apploader: Handle invalid version error
Bug: 115426059
Test: m
Change-Id: Ia7a850cceb1f60e77959cff9726e348d8356c26b
2021-05-10 22:19:08 -07:00
Tri Vo
e23e85bee5 Merge "trusty: Helper library for metrics" 2021-05-04 14:17:05 +00:00
Tri Vo
a8919a2e82 trusty: Helper library for metrics
Bug: 182489121
Test: libtrusty_metrics_test
Change-Id: I7fc45ea3319185a8ac55889e56bd484d4774e928
2021-05-03 17:15:30 -07:00
Stephen Crane
e54e8d4ebf Trusty: Move tipc fuzzer connection to end of iteration
We detect a TA crash by not being able to reconnect to its channel. We
were previously connecting to the TA at the beginning of each fuzz
iteration, but this results in only detecting a crash on the following
iteration. By moving this connection to the end of the fuzz iteration,
we can detect a crash corresponding to the correct fuzz iteration and
libFuzzer will produce the correct crashing input.

Test: /data/fuzz/arm64/trusty_keymaster_fuzzer/trusty_keymaster_fuzzer
Bug: 185407818
Change-Id: I6808c72611fcabab5b314218f8b588dd7d944188
2021-04-15 01:02:50 +00:00
Treehugger Robot
817f8971ac Merge "trusty: apploader: Log errors to logcat" 2021-04-01 05:30:25 +00:00
Tri Vo
413ab28953 trusty: apploader: Log errors to logcat
Otherwise, these error logs don't end up in bugreports, making it very
difficult to debug.

When using locally, users will have to check logcat instead of stderr.

Bug: 183919392
Bug: 115420908
Test: m
Change-Id: I3b829347971d05968b851e11ce784829d12ef098
2021-03-31 13:27:57 -07:00
Hridya Valsaraju
b3ebe7cd10 Add legacy-align parameter to DmabufHeapAlloc()
The parameter is intended to make the API backwards compatible with
legacy ION devices. It will be ignored for devices that support DMA-BUF
heaps.

Test: build
Bug: 154310076
Change-Id: Ic5b49269283caa7d05d9468f8ed7f02e1b3c1f1e
Merged-In: Ic5b49269283caa7d05d9468f8ed7f02e1b3c1f1e
2021-03-23 16:51:40 -07:00
Bob Badour
576104304d [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  libstats/pull_lazy/Android.bp
  libstats/socket_lazy/Android.bp
  trusty/utils/acvp/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I33005150521238b61d1a8c923749b17d36bba693
2021-03-17 12:59:19 -07:00
Wenhao Wang
b0f77dfe3b Merge "Trusty: Add BoringSSL modulewrapper for ACVP" 2021-03-17 18:54:36 +00:00
Tri Vo
9905ad2cad trusty: fuzz: Poke the port of lazy-loaded TAs to load them.
We need to do this to make sure that target TA is connected to coverage
service.

Bug: 171750250
Test: trusty_test_fuzzer
Change-Id: I207b8c674a0c5630dd6baf966d3dfb243a855be0
2021-03-15 23:31:00 -07:00
Kris Alder
5e8ee3102e enable fuzzing trusty targets automatically
The non-test fuzz targets should run automatically in Haiku.

None of these should be built for Host, and all but the
trusty_test_fuzzer should be built for Target.

Test: built locally (make haiku) and checked that non-test trusty fuzz
targets are included as expected.

Change-Id: Ic67b1e1ddea8ed61b83deef66acdeb0891489195
2021-03-11 15:07:01 +00:00
Tri Vo
5ff073e832 trusty: Fuzzer for ConfirmationUI messages
ConfirmationUI messages are a higher-level abstraction than TIPC
messages (which is what TIPC fuzzer fuzzes).

Bug: 174402999
Test: trusty_confirmationui_msg_fuzzer
Change-Id: I1e1e2c7070b87b78d6236993330df65202840ce6
2021-03-02 12:21:49 -08:00
Tri Vo
fcfa3cd9b5 trusty: Use a simple TIPC fuzzer for ConfirmationUI
Bug: 174402999
Test: trusty_confirmationui_tipc_fuzzer
Change-Id: I9c86a12cba75a2b5ae78621373aa39f299abfe0a
2021-03-02 12:20:10 -08:00
Tri Vo
5c1d2e1dff trusty: Apploader fuzzer
Bug: 181630912
Test: trusty_apploader_tipc_fuzzer
Test: trusty_apploader_app_fuzzer
Change-Id: I1cc2329ca2a4e983f6ded45810d4c34e1433c5b0
2021-03-01 23:29:03 -08:00
Tri Vo
123c038e1a trusty: Fuzz keymaster TA using generic TIPC fuzzer
Bug: 171750250
Test: trusty_keymaster_fuzzer
Change-Id: I94a1cc28276d198f698906212a8a5d15ac07ae1e
2021-02-27 14:09:06 -08:00
Tri Vo
e4a80fe066 trusty: Fuzz gatekeeper TA using generic TIPC fuzzer
Bug: 171750250
Test: trusty_gatekeeper_fuzzer
Change-Id: Ib3f40e7d2c01cdd2ca8df35f4b84234ddf7dbe50
2021-02-26 20:24:58 -08:00
Tri Vo
f41fee5879 trusty: Generic parameterizable TIPC fuzzer
Bug: 171750250
Test: trusty_test_fuzzer
Change-Id: I57c4aacc6725689d16dd88db2faa8ead59bcc49a
2021-02-26 19:14:47 -08:00
Tri Vo
3c8a004a8d trusty: coverage: Add UUID helpers
Function to parse string was borrowed from Trusty.

Bug: 171750250
Test: trusty_test_fuzzer
Change-Id: I8430579f142db2c174874aff373bce6bb868de31
2021-02-26 19:14:47 -08:00
Treehugger Robot
1d9764209f Merge "trusty: Export ConfirmationUI helper classes" 2021-02-26 22:31:59 +00:00
Tri Vo
e3cdd2945a Merge "trusty: Add keymaster fuzzer corpus" 2021-02-25 23:18:08 +00:00
Tri Vo
ec1d6caec3 Merge "trusty: Increase maximum number of coverage counters" 2021-02-25 06:22:39 +00:00
Arve Hjønnevåg
06ac3e24fe Merge "trusty: Fix apploader short option" 2021-02-25 04:32:52 +00:00
Stephen Crane
0ecf0530db trusty: Increase maximum number of coverage counters
The keymaster TA has 30841 distinct coverage counters, so 0x4000 counter
slots is not enough to handle this TA. Increase maximum number of
coverage counters to 0x8000.

Test: adb shell trusty_keymaster_fuzzer
Bug: 175918322
Change-Id: I879d18538edb4933a4205c8f73b7939ddbf69e37
2021-02-24 15:37:10 -08:00
Stephen Crane
885295f070 trusty: Add keymaster fuzzer corpus
Add an initial corpus for the keymaster fuzzer derived from running the
keystore2 unittests.

Test: adb shell "cd /data/fuzz/arm64/trusty_keymaster_fuzzer/ && ./trusty_keymaster_fuzzer corpus"
Bug: 175918322
Change-Id: I839bb9bacee1800cf2da25aedbb4ce3eccf16cba
2021-02-24 15:34:35 -08:00
Tri Vo
7280acc996 Merge "trusty: fuzz: Link to libtrusty dynamically" 2021-02-23 20:35:01 +00:00
Tri Vo
abd86f8f98 trusty: Export ConfirmationUI helper classes
And fix namespaces.

Bug: 174402999
Test: m
Change-Id: I54dcc92d8c153d0fa2b10b2679a9a871699de8b1
2021-02-23 11:31:35 -08:00
Tri Vo
cb89889af3 trusty: fuzz: Link to libtrusty dynamically
libtrusty can be depended on by multiple thing in a fuzzer's
dependencies tree. It's no longer convenient to link to statically.

Leave tests statically linked. Test infra doesn't seem to handle shared
test libs correctly.

Bug: 171750250
Test: trusty_test_fuzzer libtrusty_coverage_test
Change-Id: Ic7d003151e43fb5bab63354fd42ea9667332743f
2021-02-23 10:23:37 -08:00
Tri Vo
3e9dbccde6 Merge "Update OWNERS based on Trusty team membership" 2021-02-23 05:56:19 +00:00
Tri Vo
eefaf0bb3a Update OWNERS based on Trusty team membership
Change-Id: I2a940f57b3f5da67e12d4f89f9980036d47be321
2021-02-22 14:51:14 -08:00
Greg Kaiser
3e02a60412 trusty: Remove redundant check
This repeats a check in the lines immediately before it.

Test: TreeHugger
Change-Id: I47ac9f359018b87bc283657eddb75ad3d175244e
2021-02-21 10:31:40 -08:00
Stephen Crane
4778579283 Trusty: Add BoringSSL modulewrapper for ACVP
In order to validate the BoringSSL implementation in Trusty using ACVP,
we need a modulewrapper tool that forwards requests to Trusty and back
to the ACVP tool. Adds this tool, which interfaces with the Trusty ACVP
testing service.

Test: make trusty_acvp_modulewrapper
Test: adb shell "acvptool -wrapper trusty_acvp_modulewrapper -json vectors/ACVP-AES-CBC"
Bug: 173805789
Change-Id: I3028e44c00f8e315dfd94ea34c004bbd25fab788
2021-02-19 17:27:46 -08:00
Bob Badour
d69ad69a93 [LSC] Add LOCAL_LICENSE_KINDS to system/core
Added SPDX-license-identifier-Apache-2.0 to:
  bootstat/Android.bp
  cli-test/Android.bp
  code_coverage/Android.bp
  cpio/Android.bp
  debuggerd/crasher/Android.bp
  debuggerd/proto/Android.bp
  diagnose_usb/Android.bp
  fs_mgr/libdm/Android.bp
  fs_mgr/libfiemap/Android.bp
  fs_mgr/liblp/Android.bp
  fs_mgr/libsnapshot/Android.bp
  fs_mgr/libstorage_literals/Android.bp
  fs_mgr/libvbmeta/Android.bp
  fs_mgr/tests/Android.bp
  fs_mgr/tools/Android.bp
  gatekeeperd/Android.bp
  healthd/Android.bp
  healthd/testdata/Android.bp
  init/Android.bp
  init/Android.mk
  init/sysprop/Android.bp
  init/test_kill_services/Android.bp
  init/test_service/Android.bp
  libappfuse/Android.bp
  libasyncio/Android.bp
  libbinderwrapper/Android.bp
  libcrypto_utils/Android.bp
  libcrypto_utils/tests/Android.bp
  libdiskconfig/Android.bp
  libgrallocusage/Android.bp
  libkeyutils/mini_keyctl/Android.bp
  libmodprobe/Android.bp
  libnetutils/Android.bp
  libpackagelistparser/Android.bp
  libprocessgroup/Android.bp
  libprocessgroup/cgrouprc/Android.bp
  libprocessgroup/cgrouprc_format/Android.bp
  libprocessgroup/profiles/Android.bp
  libprocessgroup/setup/Android.bp
  libqtaguid/Android.bp
  libsparse/Android.bp
  libstats/push_compat/Android.bp
  libsuspend/Android.bp
  libsync/Android.bp
  libsystem/Android.bp
  libsysutils/Android.bp
  libusbhost/Android.bp
  libutils/Android.bp
  libvndksupport/Android.bp
  libvndksupport/tests/Android.bp
  llkd/Android.bp
  llkd/tests/Android.bp
  property_service/libpropertyinfoparser/Android.bp
  property_service/libpropertyinfoserializer/Android.bp
  property_service/property_info_checker/Android.bp
  qemu_pipe/Android.bp
  reboot/Android.bp
  rootdir/Android.bp
  rootdir/Android.mk
  rootdir/avb/Android.bp
  rootdir/avb/Android.mk
  run-as/Android.bp
  sdcard/Android.bp
  set-verity-state/Android.bp
  shell_and_utilities/Android.bp
  storaged/Android.bp
  toolbox/Android.bp
  trusty/apploader/Android.bp
  trusty/confirmationui/Android.bp
  trusty/confirmationui/fuzz/Android.bp
  trusty/coverage/Android.bp
  trusty/fuzz/Android.bp
  trusty/fuzz/test/Android.bp
  trusty/gatekeeper/Android.bp
  trusty/gatekeeper/fuzz/Android.bp
  trusty/keymaster/Android.bp
  trusty/keymaster/fuzz/Android.bp
  trusty/libtrusty/Android.bp
  trusty/libtrusty/tipc-test/Android.bp
  trusty/secure_dpu/Android.bp
  trusty/storage/interface/Android.bp
  trusty/storage/lib/Android.bp
  trusty/storage/proxy/Android.bp
  trusty/storage/tests/Android.bp
  trusty/utils/spiproxyd/Android.bp
  trusty/utils/trusty-ut-ctrl/Android.bp
  usbd/Android.bp
  watchdogd/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  debuggerd/Android.bp
  fastboot/Android.bp
  libkeyutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
    SPDX-license-identifier-MIT
to:
  libcutils/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-MIT
to:
  fs_mgr/Android.bp
  fs_mgr/libfs_avb/Android.bp
  trusty/Android.bp
  trusty/utils/rpmb_dev/Android.bp

Added SPDX-license-identifier-BSD
to:
  fastboot/fuzzy_fastboot/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Id740a7d2884556081fdb68876584b25eb95e1bef
2021-02-19 12:59:05 -08:00
Tri Vo
19b62a5182 trusty: ConfirmationUI HAL<->TA IPC using shared memory
Bug: 148421469
Test: VtsHalConfirmationUIV1_0TargetTest
Change-Id: I686150b64da3d3e95618f29e396990660f2054ba
2021-02-17 11:10:14 -08:00
Tri Vo
83e66f792e Merge changes I9e4cbf11,I41cde13a
* changes:
  trusty: Allow fuzzing without coverage
  trusty: Fix up error messages
2021-02-11 22:39:29 +00:00
Andrei Homescu
909beaeae3 trusty: Fix apploader short option
Fix a typo in one of the short command line options
for the Trusty application loader. The typo caused
the tool to incorrectly accept the -s short option
and ignore it, but not accept the -D option which
is the short version of --dev.

Bug: 115420908
Test: m
Change-Id: I9d03f8dd20adedbd820621ae8f9b4d13137041ed
2021-02-11 12:55:00 -08:00
Tri Vo
19eccb4f51 trusty: Allow fuzzing without coverage
Bug: 171750250
Test: m
Change-Id: I9e4cbf11fd223092f9ad800b35d0502c27f71e8f
2021-02-10 16:46:24 -08:00
Tri Vo
ce812a22ca trusty: Fix up error messages
Bug: 171750250
Test: m
Change-Id: I41cde13a891da36c85df6a451b2d051c18365797
2021-02-10 13:31:24 -08:00
Arve Hjønnevåg
7b204ac4ca Merge "trusty: Android part of dynamic app loader" 2021-02-02 01:39:56 +00:00
Andrei Homescu
08d66c5036 trusty: Android part of dynamic app loader
Implement the Android tool that uploads Trusty application package files
to the Trusty app loader.

Bug: 115420908
Test: trusty_apploader boot-start-srv.app
Change-Id: Ie21b8cad749fd565579483944a8b71e861d3a51a
2021-02-01 14:00:35 -08:00
Marco Nelissen
003bf066b2 Merge "Send DeleteUsers/DeleteAllUsers to Trusty" 2021-01-30 22:55:43 +00:00
Shawn Willden
657f71cd26 Add attestation key to generate/import messages
Bug: 171845787
Test: Build
Change-Id: I59bd25dc8998668f0ea2053f3e647bf6cc58885a
2021-01-28 11:56:14 -07:00
Marco Nelissen
53dc3c99b7 Send DeleteUsers/DeleteAllUsers to Trusty
Actually route the DeleteUsers/DeleteAllUsers calls to Trusty,
instead of immediately returning ERROR_NOT_IMPLEMENTED.

Bug: 160731903
Test: "atest VtsHalGatekeeperV1_0TargetTest"
      manual testing with added instrumentation
Change-Id: I11fdaa0812fdfbc9b926611b15d84513ab13b18e
2021-01-25 17:55:19 -08:00
ichihlu
9ee8a75e6b Secure DPU: add folder for common headers
The header SecureDPU.h is moved out from the device specific folder as
it can be shared for different devices.

Bug: 176508588
Test: Pass TUI VTS test on the emulator.
Change-Id: I7695b49c4f7a247b570ced61145471efef3d0a3d
2021-01-22 06:31:37 +00:00
Matthew Maurer
c4abbe6427 trusty: keymaster-hal: Reconnect on failed VERSION
Trusty Keymaster will currently disconnect the client on an invalid
message. This includes the newly introduced GET_VERSION2 message.

While in the future we could change this behavior, this is a backcompat
path and so we can't assume a changed Trusty. Reconnect on failed
GET_VERSION2 before attempting version negotiation.

Bug: 177843218
Test: Set PIN on device using older Trusty
Change-Id: Ie60e4aaafa43e375797e6288b97834cac42413f4
2021-01-20 13:21:37 -08:00
Tri Vo
8da3ee71a3 trusty: Collect sancov file from confirmationui fuzzer
Bug: 174402999
Test: trusty_confirmationui_fuzzer
Change-Id: I06a7b475c0023cf1530aff636e5ac2295009fd73
2021-01-14 21:25:10 -08:00
Tri Vo
315967e660 trusty: coverage: Append .<pid>.sancov to sancov file names
Bug: 175221942
Test: adb shell ./trusty_gatekeeper_fuzzer -runs=0 corpus
Change-Id: Ic7a30b7531e8a327fb8ebe953fa02946e8539579
2021-01-14 21:25:10 -08:00
Tri Vo
2c56d833c5 trusty: fuzz: Explicit errors instead of asserts
Bug: 171750250
Test: m \
      trusty_test_fuzzer \
      trusty_gatekeeper_fuzzer \
      trusty_keymaster_fuzzer \
      trusty_confirmationui_fuzzer
Change-Id: Ib22cf72b2db7b991e716c0116ca57d3f77459ada
2021-01-14 21:25:07 -08:00
Tri Vo
3c651c278c Merge changes Iad1713e1,Iaee2c74b,I6bd1c8b2,I067dd077
* changes:
  trusty: Add simple fuzzer for keymaster TA
  trusty: Increase limit on coverage counters
  trusty: Write out sancov file when fuzzer exits
  trusty: Switch to dmabuf for coverage shared memory
2021-01-14 21:28:16 +00:00
Stephen Crane
f7b8a597f1 trusty: Add simple fuzzer for keymaster TA
Adds a simple libfuzzer-based coverage guided fuzzer for keymaster.
Current coverage is low, so we'll need to improve this with an initial
corpus or a more sophisticated protocol aware fuzzer.

Bug: 175918322
Test: make trusty_keymaster_fuzzer
Test: adb shell /data/fuzz/arm64/trusty_keymaster_fuzzer/trusty_keymaster_fuzzer
Change-Id: Iad1713e1a73cc5a6a3ec742cc433d1337aca9bc3
2021-01-13 16:21:49 -08:00
Stephen Crane
6735f8475e trusty: Increase limit on coverage counters
Keymaster has more than 4096 counters, so we need to allocate a larger
section for the libfuzzer extra counters. Increases the size of the
extra counters section to 16384.

Bug: 171750250
Test: atest libtrusty_coverage_test
Change-Id: Iaee2c74b6d0c7ae8a2e5a30525759f89f825a091
2021-01-13 16:09:33 -08:00
Stephen Crane
6bd77df8fc trusty: Write out sancov file when fuzzer exits
Add emission of sancov file when CoverageRecord is destroyed. This
will occur when a fuzzer driver exits cleanly, i.e. -runs=0 with an
existing corpus.

Test: make trusty_gatekeeper_fuzzer
Test: adb shell ./trusty_gatekeeper_fuzzer -runs=0 corpus
Bug: 175221942
Change-Id: I6bd1c8b2f2091e894c35f7a4874b54577a91c8fc
2021-01-13 16:09:31 -08:00
Stephen Crane
0d67131dd9 trusty: Switch to dmabuf for coverage shared memory
Trusty shared memory now uses dmabuf instead of memfd. Switch the
coverage buffer allocation to use libdmabufheap.

Test: atest libtrusty_coverage_test
Bug: None
Change-Id: I067dd0774d19b42380ce5cb8ceb3541fa77ef9f0
2021-01-13 15:56:25 -08:00
Wenhao Wang
1ee38ede4c Merge "trusty: Adapt to Confirmationui Corpus Format" 2021-01-13 20:17:31 +00:00
Wenhao Wang
dc45de0553 trusty: Adapt to Confirmationui Corpus Format
The corpus of Confirmationui usually contains multiple data packets
to be transfered from Android side to Trusty side.
Therefore we adjust the Confirmationui fuzzer so that it can send
data to Confirmationui TA several times through a same tipc channel.

Bug: 174402999
Bug: 171750250
Test: /data/fuzz/arm64/trusty_confirmationui_fuzzer/trusty_confirmationui_fuzzer
Change-Id: Ib6ae831e6a19c98eb62a1c75f77eb00f914e2f5c
2021-01-12 12:54:27 -08:00
Matthew Maurer
8ca6ab0161 trusty: tipc-test: Use dma_buf rather than memfd
Test: tipc-test -t send-fd
Bug: 117221195
Change-Id: I595cb4ee5fc24d8cafc9a3e706346139a974d674
2021-01-11 10:23:46 -08:00
Matthew Maurer
b6e795513b trusty: tipc-test: Test multi-page support
Test: tipc-test -t send-fd
Bug: 117221195
Change-Id: Ie8623a70f6935ede6bb5e9dd1a7945a7e356d854
2021-01-11 10:23:30 -08:00
Shawn Willden
e3e5ae9eae Merge "Revert^2 "Revise KeymasterMessage versioning system"" 2021-01-06 22:58:32 +00:00
Shawn Willden
9323f4113b Revert^2 "Revise KeymasterMessage versioning system"
24d46bd512

Change-Id: I4edcfdada8321ff181db70002a2661b821f6b33f
Bug: 176867651
Merged-In: Idefcdd64afa7977f6dc2c4299e69cc5065dcc20d
2021-01-06 19:54:24 +00:00
Treehugger Robot
f24141175a Merge "Revert "Revise KeymasterMessage versioning system"" 2021-01-06 09:24:43 +00:00
Bonian Chen
24d46bd512 Revert "Revise KeymasterMessage versioning system"
Revert "Revise KeymasterMessage versioning system"

Revert "Revise KeymasterMessage versioning system"

Revert "Add new message versioning protocol"

Revert submission 1533821-new_km_versioning

Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_master&target=adt3-userdebug&lkgb=7064747&lkbb=7064769&fkbb=7064769, bug 176867651
Reverted Changes:
I040fe7f62:Revise KeymasterMessage versioning system
Ibea104c39:Revise KeymasterMessage versioning system
Ibea104c39:Revise KeymasterMessage versioning system
I425fb45fc:Add new message versioning protocol

Change-Id: I1569334c59cb62be6aae4a42ce999f40c7a472de
BUG: 176867651
2021-01-06 06:42:21 +00:00
Treehugger Robot
936557b6f0 Merge "Revise KeymasterMessage versioning system" 2021-01-05 22:40:06 +00:00
Shawn Willden
db089205aa Revise KeymasterMessage versioning system
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: Ibea104c39942c6c88523688306a030f40e9b150f
2020-12-22 20:33:13 -07:00
Stephen Crane
c602562bb2 trusty: Add vendor variant of libtrusty_coverage
We want to add coverage statistics to the trusty-ut-ctrl tool, which is
a vendor binary. Thus we need a vendor variant of libtrusty_coverage.
Merges system libtrusty_test and vendor libtrusty into a single
vendor_available library so that we can add vendor_available to
libtrusty_coverage and make it accessible from vendor tools.

Bug: 175221942
Test: make libtrusty_coverage
Change-Id: I68cc8f1c1580bda8591dbe744e9751474811576d
2020-12-22 22:39:40 +00:00
Bernie Innocenti
62ba2b11b1 Add explicit Result::has_value() checks where needed
Test: m checkbuild continuous_instrumentation_tests continuous_instrumentation_tests_api_coverage continuous_native_tests device-tests platform_tests
Change-Id: Ifd5dcda48e370d750e243d427e68a77dce333951
2020-12-19 21:17:16 +09:00
Tri Vo
56bcb02b6e Merge "trusty: Retrieve coverage PCs from coverage record" 2020-12-15 20:15:08 +00:00
Stephen Crane
e962930d19 trusty: Retrieve coverage PCs from coverage record
Adds the ability to retrieve and save program counter information from
the trusty coverage record data. PC information is saved to a .sancov
file, parseable by the LLVM sancov tool. Sancov can then symbolize and
display this coverage information for consumption by humans.

Adds a sancov dump to the libtrusty_coverage_test for testing.

Bug: 175221942
Test: atest libtrusty_coverage_test
Test: Retrieve sancov file and manually symbolize with sancov
Change-Id: I342ea2ca9abb87986b2904ff69415544ee6070fc
2020-12-14 22:06:13 -08:00
Treehugger Robot
00ed8bdddb Merge "Update message versionioning system" 2020-12-15 01:25:12 +00:00
Tri Vo
5a611cb834 Merge "trusty: fuzz: Link libtrusty_test statically" 2020-12-14 20:39:09 +00:00
Shawn Willden
4f45dc3a7e Update message versionioning system
Bug: 171845787
Test: Build
Change-Id: Ie769113070a8a755a268f65e36384fe333c798b6
2020-12-13 10:56:50 -07:00
Tri Vo
cafdd7c335 trusty: fuzz: Link libtrusty_test statically
Simplifies development flow because libtrusty_test.so doesn't need to be
pushed with the fuzzer.

Bug: 171750250
Test: m trusty_gatekeeper_fuzzer && adb sync data && \
adb shell /data/fuzz/arm64/trusty_gatekeeper_fuzzer/trusty_gatekeeper_fuzzer
Change-Id: I7c83b5784ede4881dcd9c2dd33c97bf49fcde6ff

Change-Id: Iba60f03000bfca15b00e484ef3a168604c65554a
2020-12-11 13:19:55 -08:00
Wenhao Wang
bf40c084cc trusty: Add ExtraCounters to Confirmationui Fuzzer
Add ExtraCounters to Confirmationui fuzzer so that the fuzzer can
grab the coverage information of the Confirmationui TA.

Bug: 174402999
Bug: 171750250
Test: /data/fuzz/arm64/trusty_confirmationui_fuzzer/trusty_confirmationui_fuzzer
Change-Id: I2e287281e7c8100f0d48413fbe0ff99d397a74c1
2020-12-11 10:56:40 -08:00
Wenhao Wang
36d45bbfd5 Merge "trusty-ut-ctrl: Make it as binary" 2020-12-02 03:28:58 +00:00
Treehugger Robot
41c2e6286e Merge changes Ie9da525c,I9911f02c,Iad18af1f,I5f432a3d
* changes:
  trusty: provide coverage to gatekeeper fuzzer
  trusty: fuzz: Example TA fuzzer
  trusty: fuzz: Helper lib for libFuzzer extra counters
  trusty: coverage: Coverage client library
2020-12-01 20:20:08 +00:00
Tri Vo
a1008a1edf trusty: provide coverage to gatekeeper fuzzer
Bug: 171750250
Test: /data/fuzz/arm64/trusty_gatekeeper_fuzzer/trusty_gatekeeper_fuzzer
Change-Id: Ie9da525c0dcb6c9c5ed2f50396c0065e3a567d22
2020-11-30 20:09:08 -08:00
Tri Vo
680fc001b8 trusty: fuzz: Example TA fuzzer
Bug: 169776499
Test: /data/fuzz/arm64/trusty_test_fuzzer/trusty_test_fuzzer
Change-Id: I9911f02cb49c39f1c3cd89b4e5582e8dfaa645d1
2020-11-30 20:09:07 -08:00
Tri Vo
a67840f998 trusty: fuzz: Helper lib for libFuzzer extra counters
Bug: 169776499
Test: /data/nativetest64/libtrusty_coverage_test/libtrusty_coverage_test
Change-Id: Iad18af1f0404fc47bef481955c7a4292ef3a24ec
2020-11-30 20:09:02 -08:00
Tri Vo
5b40e89894 trusty: coverage: Coverage client library
Bug: 169776499
Test: /data/nativetest64/libtrusty_coverage_test/libtrusty_coverage_test
Change-Id: I5f432a3df04fe7b0e2940a12f8d28b3d0655791f
2020-11-30 19:39:00 -08:00
Wenhao Wang
0124a59fe4 trusty: Fuzzer for Confirmationui TA
Note: We need to add Confirmationui TA into
TRUSTY_BUILTIN_USER_TASKS to run the fuzzer.

Bug: 174402999
Bug: 171750250
Test: /data/fuzz/arm64/trusty_confirmationui_fuzzer/trusty_confirmationui_fuzzer
Change-Id: I22769782ded05eeedeb111f7537b5ba76e98ce73
2020-11-29 13:03:55 -08:00
Tri Vo
9763f21565 Merge changes Id77b87bb,I56a15c80
* changes:
  trusty: fuzz: make utils lib use libtrusty_test
  trusty: Add libtrusty_test
2020-11-24 20:39:26 +00:00
Tri Vo
90c0e833c9 trusty: fuzz: make utils lib use libtrusty_test
Test: m libtrusty_fuzz_utils
Change-Id: Id77b87bb14f09b29f53c78a4ea89073fbe1c83a1
2020-11-23 12:57:44 -08:00
Sasha Smundak
92500f1d93 The last line should not end with backslash
Bug: 173737347
Test: treehugger
Change-Id: I4cae512e92c228684e9743939e29691e2beabebb
2020-11-19 14:54:24 -08:00
Tri Vo
421de90544 trusty: Add libtrusty_test
Used by tests on the system side of the Treble boundary, e.g. fuzzing

Test: m libtrusty libtrusty_test
Change-Id: I56a15c80eb7c4b9e51f8e59a7cd1abdfc35d8d5a
2020-11-18 12:17:16 -08:00
Tri Vo
27b0b3f770 trusty: wrap syscalls in TEMP_FAILURE_RETRY
Needed to handle EINTR robustly.

Test: m libtrusty
Change-Id: I46a58ae911fd8db3d3528e24edbb6013d807b48c
2020-11-17 19:56:07 -08:00
Tri Vo
b47dbe7eb0 trusty: Reformat libtrusty
Test: m libtrusty
Change-Id: I5eb8413e7581603879de5abcb6de7b1b6d3484c0
2020-11-17 19:55:59 -08:00
Wenhao Wang
450311d91a trusty-ut-ctrl: Make it as binary
Make the trusty-ut-ctrl as binary such that we can put it into
factory image, put it into PRODECT_PACKAGES_DEBUG fro the device.mk

Bug: 152901318
Test: Trusty storage tests
Change-Id: I8229113e7649c25d0a712b2b0964f23c9d41cf26
2020-11-12 16:48:18 -08:00
Stephen Crane
5e3a3ce011 trusty: fuzz: dump trusty kernel logs on crash
Adds an Abort() function to the fuzzer utils library that grabs and
prints the relevant trusty kernel logs before exiting the fuzzer.

Test: /data/fuzz/arm64/trusty_gatekeeper_fuzzer/trusty_gatekeeper_fuzzer
Change-Id: I7741c7e5e0ffdc402e3d3dd9a7e5856e2a640dd2
2020-11-02 10:16:44 -08:00
Stephen Crane
6c0fb906f6 trusty: Add corpus for gatekeeper fuzzer
Test: /data/fuzz/arm64/trusty_gatekeeper_fuzzer/trusty_gatekeeper_fuzzer
Change-Id: I30bb2844972df952d853f0809e2eb8d5b5a1dd9c
2020-11-02 09:58:54 -08:00
Tri Vo
10ffc3417d trusty: Fuzzer for Gatekeeper TA
Test: /data/fuzz/arm64/trusty_gatekeeper_fuzzer/trusty_gatekeeper_fuzzer
Change-Id: If55b93b1a15c5bd9a1148ff54a859635a6e7290c
2020-10-29 18:02:01 -07:00
Tri Vo
e8823ffcb4 trusty: fuzz: Helper library
Test: /data/fuzz/arm64/trusty_gatekeeper_fuzzer/trusty_gatekeeper_fuzzer
Change-Id: Ife058ca25417e6bee4bf593b10a4e7e4000f9f2f
2020-10-29 18:01:59 -07:00
Wenhao Wang
323353413f Merge "rpmb_dev: Switch to RPMB provisioning scheme" 2020-10-10 05:06:56 +00:00
Arve Hjønnevåg
3e7c3504a3 Merge "trusty: keymaster: set_attestation_key: Change wrapped key" 2020-10-06 23:31:38 +00:00
Wenhao Wang
a560b76faa Merge "rpmb_dev: Fix RPMB_REQ_DATA_READ command" 2020-10-03 05:11:27 +00:00
Arve Hjønnevåg
fe090a4686 trusty: keymaster: set_attestation_key: Change wrapped key
Remove WrappedPrivateKey and select wrapped vs plaintext key command
based on format instead.

Bug: 154033394
Test: send wrapped test key. Not yet accepted by trusty
Change-Id: I3b0a29be78f2a8e84ebd990713f66788256d8e3f
2020-10-02 16:55:16 -07:00
Wenhao Wang
62855c3985 rpmb_dev: Switch to RPMB provisioning scheme
Remove the --key option part to disable the initial setting of rpmb key
on the mock rpmb device.
The RPMB provisioning scheme will program the RPMB key into the mock
rpmb device.

Bug: 152901318
Test: Trusty storage tests
Change-Id: I03b9cfbbd10e2e5364405319a57e2ecc4ee0f48e
2020-10-02 12:39:30 -07:00
Wenhao Wang
975491be09 rpmb_dev: Fix RPMB_REQ_DATA_READ command
Add ".check_key_programmed = true." for RPMB_REQ_DATA_READ such that
we can check whether the rpmb key has been programmed before executing
RPMB_REQ_DATA_READ command.

"JEDEC STANDARD Universal Flash Storage (UFS) Version 3.0" specifies
that data access before the key has been programmed should return
“Authentication Key not yet programmed” (0007h)..

Bug: 152901318
Test: Trusty storage tests
Change-Id: I4759fbce5f37234090a22a1d9dc3b38072f6ecaf
2020-10-02 12:32:30 -07:00
Arve Hjønnevåg
0c32a253df trusty: keymaster: Add set_attestation_key
Add tool to provision keymaster attestation keys.

Bug: 154033394
Test: keys from soft_attestation_cert then VtsHalKeymasterV4_0TargetTest

Change-Id: Ic96e9a8676991b3126bbae99118a1f23ee0744a5
2020-09-10 16:43:20 -07:00
Matthew Maurer
0b9a329303 Merge "Add support for tipc_send()" 2020-08-03 19:35:55 +00:00
Matthew Maurer
e251fa32fd Add support for tipc_send()
* Supports sending memfds in addition to data from an iovec
* Also add a basic test called send-fd

Bug: 117221195
Test: Run send-fd with corresponding Trusty application.
Change-Id: I562d2ff744938c868323a016659ca1332f6a576b
2020-08-03 09:30:37 -07:00
Jeff Sharkey
7b21637782 Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Change-Id: Iafcccbdbdf3ff1078e87000e2ce560ff09b43f68
2020-07-31 16:36:06 -06:00
Treehugger Robot
71db317340 Merge "Use more inclusive language for #inclusivefixit" 2020-07-28 12:03:43 +00:00
Hongguang Chen
a41111070c Use more inclusive language for #inclusivefixit
Updating language to comply with Android’s inclusive language guidance.

See https://source.android.com/setup/contribute/respectful-code for reference.

Bug: 161896447
Test: make
Change-Id: I85a9f48fbab79b3b68f00c0af68750c616d815f8
2020-07-27 22:54:22 +00:00
Hongguang Chen
714adb834a Use more inclusive language for #inclusivefixit
Updating language to comply with Android’s inclusive language guidance.

See https://source.android.com/setup/contribute/respectful-code for reference.

Bug: 161896447
Test: make
Change-Id: I6f1668d1f7925393c72db6ae282003a9ecc723b7
2020-07-27 15:52:32 -07:00
Tri Vo
4e94e5bcfa trusty: spi: Add SPI proxy daemon
Bug: 118762930
Test: /data/nativetest64/trusty-ut-ctrl/trusty-ut-ctrl \
-D /dev/trusty-ipc-dev0 com.android.trusty.swspi.test

Change-Id: I6589009b2570f1101fed73197997d31a454887eb
2020-07-22 11:19:02 -07:00
Matthew Maurer
8f62566566 trusty: rpmb_dev: Prevent desync between rpmb_dev and storageproxyd
The mock RPMB can get out of sync with TD storage blocks in the event of
panic or crash. Making this O_SYNC will prevent this from happening.

Bug: 160723681
Test: None
Change-Id: Ia16dfc88ceae56e4e9724a42ac0db492c0e707a4
2020-07-10 22:09:01 +00:00
Wenhao Wang
469e388e47 trusty:storageproxyd: Fix in_cdb.length setting on send_ufs_rpmb_req
The in_cdb.length (ALLOCATION_LENGTH) must be set in order to send
SECURITY PROTOCOL IN command.

Bug: 143636526
Test: Trusty storage tests
Change-Id: Ie4252e9b19c05825c895ec07f8c9684ae456f6c9
2020-06-12 15:30:08 -07:00
Kenny Root
15351dcf60 Use <fqname> to avoid conflicts
The newer way of specifying the interface is using <fqname> and it also
has the handy side-effect of not causing conflicts when we add the
strongbox implementation to devices.

Test: make # check $OUT for the correct manifest
Change-Id: If8333814723261c4f3de375861ee19a6d922d55f
2020-04-14 14:37:24 -07:00
Matthew Maurer
1010727a48 trusty: keymaster: Remove legacy support
Library based HALs have been deprecated for several years now, and
Keymaster 2 based testing is woefully out of date compared to running
VTS against the modern 3.0 and 4.0 implementations.

Purging these modules and their resulting dependencies will make it
easier for the central system/keymaster repository to move forwards.

Test: mm
Bug: 150239636
Change-Id: Ic2ddbe685a50e65f9db25f682ad33105195efa8a
2020-02-26 00:43:23 +00:00
Treehugger Robot
a78d0cb735 Merge "First working version of the confirmationui HAL service" 2020-01-21 16:40:03 +00:00
Janis Danisevskis
8fe0cfb098 First working version of the confirmationui HAL service
This implementation does not provide any security guaranties.
 * The input method (NotSoSecureInput) runs a crypto protocols that is
   sufficiently secure IFF the end point is implemented on a trustworthy
   secure input device. But since the endpoint is currently in the HAL
   service itself this implementation is not secure.
 * This implementation provides most of the functionality, but not the
   secure UI infrastructure required to run Android Protected
   Confirmation.

Bug: 146078942
Test: VtsHalConfirmationUIV1_0TargetTest
Change-Id: I14717b5fa4ef15db960cdd506b8c6fe5369aec8d
2020-01-17 16:34:48 -08:00
Steven Moreland
e40e4270e8 remove deprecated bp 'subdirs'
noticed some, so thought I would remove them everywhere here

Bug: N/A
Test: N/A
Change-Id: I2978673b158d6c253914ea22f7f0129e446a5f91
2020-01-14 12:18:40 -08:00
Wenhao Wang
d363769dcf Merge "trusty:storageproxyd: Add ufs to parse_dev_type" 2020-01-04 00:10:57 +00:00
Wenhao Wang
3bf07c27de trusty:storageproxyd: Add ufs to parse_dev_type
Modify parse_dev_type function to accept new dev_type argument "ufs".

Bug: 143636526
Test: Trusty storage tests
Change-Id: I9524fd4cb9619b5ce1f4f46e87f1890f84f4d2f3
2020-01-03 13:47:57 -08:00
Matthew Maurer
17785fd185 trusty: storageproxyd: Fix rebase of UFS support
The UFS support got rebased on top of the RPMB socket support
improperly. As a result, RPMB socket support was broken due to an
unconditional rmpb_fd = rc which would set the rpmb_fd to be connect()'s
error code in the case of an RPMB socket.

Bug: 146903427
Test: Boot Trusty+Android with the rpmb_dev mock, check for liveness
Change-Id: Ib1220dc49392f1a10369eed7716e44680bd83a66
2019-12-26 15:03:45 -08:00
Wenhao Wang
ce2f1a4761 Add storageproxyd UFS support
This CL enables storageproxyd to run on UFS device.
The proxy prepares and sends SECURITY PROTOCOL IN/OUT commands to UFS
device.

Bug: 143636526
Test: Trusty storage tests
Change-Id: Ibe16578c12b978c9a95deccfb1873081e8d0e994
2019-12-20 15:44:51 -08:00
Matthew Maurer
503ea0e231 Add support for mocked RPMB
When developing, it may be preferable to operate on a device which does
not have a real RPMB storage, or which is unprovisioned. This CL allows
the rpmb_dev program to act as a daemon serving a fixed key, and for
storageproxyd to speak to rpmb_dev's socket rather than an actual rpmb
device or a virtual rpmb device.

Test: Trusty Gatekeeper VTS
Change-Id: I19b2b143fffb8e68e4a028d00eaf5cd1928e12f6
2019-11-27 14:41:16 -08:00
Treehugger Robot
8578a8a8ec Merge "trusty-ut-ctrl: link statically to libtrusty" 2019-10-31 23:03:54 +00:00
Matthew Maurer
d35f685a7c Update OWNERS based on Trusty team membership
Change-Id: Iafad614b6568e53209752b1c45f0f0209c95684b
2019-10-31 13:32:20 -07:00
Tri Vo
8b1e934555 trusty-ut-ctrl: link statically to libtrusty
Removes the need to push libtrusty.so to run trusty-ut-ctrl binary.

Test: m trusty-ut-ctrl
Change-Id: I19c2957d3eb1dc165e13f2ce5560fe31ea9a2469
2019-10-28 14:54:06 -07:00
Matthew Maurer
dfad089dad Merge "Provide VINTF for Trusty Keymaster" 2019-09-10 19:09:04 +00:00
Matthew Maurer
c649ca538d Provide VINTF for Trusty Keymaster
This makes it easier to add or remove the Trusty keymaster service from
a device by providing a manifest fragment to add whenever it is enabled.

Test: Keymaster VTS, Keystore CTS (sans attestation)
Change-Id: Ib0f5fd7c016c0c18d77c9d2623c89f3b35ba7ad7
2019-09-09 23:23:45 +00:00
Matthew Maurer
3d1023e50d Inject auth token into tags
The reference keymaster at system/keymaster still expects to receive its
auth tokens in the tags, rather than as a separate parameter. This
change injects the separate parameter passed to the KM4 HAL as a legacy
tag in the request.

Longer term, system/keymaster should support a separate authToken
parameter, and it should be serialized and sent to Trusty separately.

Test: Keymaster VTS + Keystore CTS (sans attestation)
Change-Id: Ie69cbd358504bb7612f7d55158509043cdad4e4e
2019-09-09 16:00:36 -07:00
Steven Moreland
a4eaf64de8 Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I0bdffced6af52695c0ef98c9dd659348e56f7aa6
2019-09-05 14:17:42 -07:00
Janis Danisevskis
7daa66aa07 Replace legacy trusty gatekeeper HAL with HIDLized version
This patch replaces the legacy libhardware based gatekeeper HAL with a
true HIDL based implementation.

Test: Workes with trusty gatekeeper
Change-Id: I072b0c3fc74523400132aacd34e2f2cac9cf261b
Merged-In: I072b0c3fc74523400132aacd34e2f2cac9cf261b
2019-06-23 11:11:09 -07:00
Matthew Maurer
b321b410ff Trusty Keymaster@4.0
Adds support for proxying V4.0 commands to Trusty and makes 4.0 the
default when including trusty-base.mk.

Bug: 128851722
Test: Keymaster VTS 4.0 + Trusty
Change-Id: I2e2220963996fcb88d6953ee1a58af1b947b857d
2019-05-16 14:19:50 -07:00
Matthew Maurer
b0a8c9520b Enable Trusty Gatekeeper@1.0
Previously we only installed the gatekeeper.trusty.so library, which is
insufficient to actually start Gatekeeper. We now also install the -impl
and -service wrappers.

Bug: 127700127
Test: Gatekeeper 1.0 VTS with Trusty running
Change-Id: Idd8d6a4e1e409c2a712dddfd92d5f9cf6b16b50c
2019-03-19 11:18:38 -07:00
Matthew Maurer
57ba8c58fc Add support for RPMB over VirtIO Serial
In order to test Trusty gatekeeper automatically, the storage proxy
needs to be active inside the emulator. This patch allows storageproxyd
to speak a length-framed RPMB to an external RPMB daemon.

For a concrete example of a daemon speaking this protocol, see rpmb_dev
in the Trusty tree.

Bug: 124277696
Test: Launch storageproxyd with -t virt, use Trusty test infra
Change-Id: I391d4768976f0eb1f3b8df58eefd58fc3a9409cd
2019-03-05 17:25:57 -08:00
Matthew Maurer
30ff1f4177 Clang-format before updating storage proxy
These files were previously not clang-format clean. I am submitting the
clang-format cleanup in its own CL to avoid mixing up the code I'm
adding/adjusting with old code which needed to be reformatted.

Bug: 124277696
Test: m
Change-Id: I8a57ca97925a16bee10b15d2013a5dcf87b0ed15
2019-02-21 15:52:11 -08:00
Treehugger Robot
52ca777e57 Merge "trusty: Avoid unnecessary use of static libtrusty" 2019-01-18 21:54:39 +00:00
Matthew Maurer
178c56a1ba trusty: Avoid unnecessary use of static libtrusty
Test: manual
Change-Id: I9e57118b6cc8c24d9ec7a5c34413c196bbba5b51
2019-01-04 12:04:47 -08:00
Michael Ryleev
129fadf051 trusty: Add trusty unittest control utility
It is designed to connect to user specified port and
implements unittest logging protocol supported by
typical unittest ap running on Trusty side.

Test: manual
Change-Id: I6e37ccee9b9e4dde563ef0e4f531b42091cc2bd8
2019-01-04 11:54:26 -08:00
Chih-Hung Hsieh
747eb149d0 Add noexcept to move constructors and assignment operators.
Bug: 116614593
Test: build with WITH_TIDY=1
Change-Id: I5a7461386946ca623ab509609092aa0ac8418b80
2018-10-05 16:43:47 +00:00
Michael Ryleev
bfccad2474 trusty: keymaster3: Modify TrustyKeymaster3Device::update method
Modify TrustyKeymaster3Device::update method to handle the case when
amount of input data received exceeds a maximum amount supported by
underlying transport. In such case, only send an portion of data that
fits and allow higher levels to take care of the rest.

This is not an ideal fix as it is not very efficient for large sets
of data but at least it should work in more cases.

Test: android.keystore.cts
Change-Id: Id7360d0da3b87493193d480fc0c78c65dc1fc51f
2018-09-18 16:12:24 -07:00
Treehugger Robot
d361839b30 Merge "add the impementation of delete_key, delete_all_key for Legacy HAL" 2018-09-11 22:40:31 +00:00
Roberto Pereira
1b4ab72459 trusty: keymaster: remove unnecessary group from trusty KM3 HAL service
Test: VtsHalKeymasterV3_0TargetTest
Change-Id: Ib943a9aa5a0cab27913173a68932db651e991907
2018-09-10 19:19:44 +00:00
Treehugger Robot
d230bcf4b0 Merge "Fix disagreement of client_id/app_data pointer semantic" 2018-09-04 19:43:03 +00:00
Janis Danisevskis
56c533dfd9 Fix disagreement of client_id/app_data pointer semantic
KM1/KM2 implementations should treat nullptr and KeymasterBlob{nullptr, 0}
equally when passed in as client_id or app_data. However, trusty KM1
treats them differently.

Bug: 113110105
Bug: 113084196
Change-Id: Ie0e2b5d60d808e4f7a8e48aeb4c694268f9bc0a1
2018-09-04 19:42:10 +00:00
Yan, Shaopu
764d62e204 add the impementation of delete_key, delete_all_key for Legacy HAL
the new layer (Keymaster2PassthroughContext) will call the related function
operation, however, currently it’s null so it will have null pointer reference
issue and we need to provide them in the keymater legacy HAL.

Bug: 113084196
Change-Id: Id1b0df47c03d341aedc7a0634cb101966143641c
2018-08-24 21:10:50 +00:00
Roberto Pereira
37996b6c67 trusty_keymaster_ipc: Use ALOGV instead of ALOGE for info/debug message
This message was originally ALOGV but got accidentally changed during a
refactoring in 81ebcb1943

Bug:110153632
Test: VtsHalKeymasterV3_0TargetTest
Change-Id: Ibdfa0ab50cb8544c6f23c15049904f1741769647
2018-08-23 15:56:09 -07:00
Roberto Pereira
b5dfc75a32 Switch from old style KM2 HAL to new KM3 HAL
Bug:110153632
Test: VtsHalKeymasterV3_0TargetTest
Change-Id: I31b6a66a44eb1a6bf89c6eb6a3c632ace83071a9
2018-08-14 10:49:38 -07:00
Roberto Pereira
2426197400 Add Keymaster 3.0 binderized Trusty HAL
Based on AndroidKeymaster3Device

Test: VtsHalKeymasterV3_0TargetTest
Bug:110153632
Change-Id: I682e5c9823ed3d8d8c0cfde0713ee64f96eab78a
2018-08-14 10:49:38 -07:00
Roberto Pereira
81ebcb1943 Move IPC functionality from trusty_keymaster_device to trusty_keymaster_ipc
This allows the IPC functionality to be used by multiple HAL
implementations

Test: trusty_keymaster_tipc & keystore.trusty compile
Bug: 110153632
Change-Id: I78f273db6f59a417319058113e15e422ece73290
2018-08-08 17:31:18 -07:00
Roberto Pereira
22a3b1f733 Update the Trusty Keymaster directory structure
Added three new directories:
  - include: contains ipc and legacy header files
  - ipc: contains common keymaster IPC code that can be shared between HALS
  - legacy: contains the old style HAL implementation

Test: trusty_keymaster_tipc & keystore.trusty compile
Bug:110153632
Change-Id: I2fdaa9d3d0421a0e359c05807ab5f0a12c5d3996
2018-08-08 17:22:24 -07:00
Roberto Pereira
4f9599e4fe Run clang-format on all trusty/keymaster .cpp and .h files
Test: Compiles
Bug: 110153632
Change-Id: Ib6e1df87d3c3dfd8c507768d9018114a1b962d74
2018-08-08 17:22:24 -07:00
Arve Hjønnevåg
c97372e73b Merge "trusty: tipc_test: Read output and test result from ta2ta_ipc_test"
am: 7b7e416649

Change-Id: I17c82528a7e373dd18137c7c976e868d4718bd5f
2018-07-25 17:24:18 -07:00
Arve Hjønnevåg
7b7e416649 Merge "trusty: tipc_test: Read output and test result from ta2ta_ipc_test" 2018-07-26 00:17:54 +00:00
Elliott Hughes
5ae98112eb Merge "trusty: add the trusty folks to the system/core/trusty/ OWNERS."
am: e663c78d92

Change-Id: I293f21462010e8098b226277636f04b4cd4b02a7
2018-07-25 16:59:03 -07:00