Commit Graph

1076 Commits

Author SHA1 Message Date
Cody Schuffelen
1e3f885162 Merge "C++ AIDL on-device GateKeeper / SharedSecret impl" into main am: e23e450487 am: e6273eff1d
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3023986

Change-Id: I6bda0795988c354187e4b4903be553cc42a780d3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-14 22:44:43 +00:00
A. Cody Schuffelen
097e625335 C++ AIDL on-device GateKeeper / SharedSecret impl
Because Keystore2 always requires valid auth tokens for user keys, this
copies and extends the existing in-guest GateKeeper implementation to
negotiate a shared secret key with Keymint in order to generate a
session key for signing auth tokens.

This implementation also uses AIDL rather than HIDL to interact with the
framework. It's also packaged in an APEX.

The files are cobbled together from a few sources:

- SoftGateKeeper.h is based on hardware/interfaces/gatekeeper/1.0/software/SoftGateKeeper.h
- GateKeeper.{cpp,h} are based on device/google/cuttlefish/guest/hals/gatekeeper/remote/remote_gatekeeper.{cpp,h}
- SharedSecret.{cpp,h} are based on device/google/cuttlefish/guest/hals/keymint/remote/remote_shared_secret.{cpp,h}
- Apex files are based on device/google/cuttlefish/guest/hals/keymint/rust/

Keymint modifications to use BOOT_TIME are lifted from

https://android-review.git.corp.google.com/c/platform/hardware/interfaces/+/2856649/6..8/security/keymint/aidl/default/ta/clock.rs#38

Bug: 332376454
Change-Id: I81845d5e6370bdddb1a24d67437964e03a5fb243
Test: Run with rust-nonsecure keymint on Cuttlefish
2024-04-11 13:53:32 -07:00
Seth Moore
923e2a6183 Merge "Allow RKP-only devices to pass keymint VTS" into main am: fae563acb0 am: dc2d3dfbdb
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3029929

Change-Id: Iec1433c892be25669adf00a75a7c86ccffbd32d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-09 16:14:35 +00:00
Seth Moore
fae563acb0 Merge "Allow RKP-only devices to pass keymint VTS" into main 2024-04-09 15:31:26 +00:00
David Drysdale
589f7ac4d5 Merge "Make batch attestation keys/certs optional" into main am: 61c9ab4d87 am: 9985cdb9e1
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3002898

Change-Id: I91627fad20c36b111714ac20739b3dec8ad540f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-09 09:34:00 +00:00
David Drysdale
61c9ab4d87 Merge "Make batch attestation keys/certs optional" into main 2024-04-09 09:11:54 +00:00
Nikolay Elenkov
ea595e8e4f Merge "Enable Java backend for ISecretKeeper" into main am: 6e71b471a9 am: 7243db7045
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3007148

Change-Id: I27e6da54bed1b5fec01ef6f5a7582aedba4e01a9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-09 02:20:53 +00:00
Nikolay Elenkov
6e71b471a9 Merge "Enable Java backend for ISecretKeeper" into main 2024-04-09 01:59:35 +00:00
Seth Moore
c5c52ce1d3 Allow RKP-only devices to pass keymint VTS
Add test paths for HALs that are RKP-only so that they may pass tests.

Fix up a few tests that were just being skipped for RKP-only HALs.

Test: ran VTS against cuttlefish with no factory key
Bug: 329409739
Change-Id: I5400874dd2f9885c061970a30ea44985353d23ed
2024-04-08 12:38:20 -07:00
David Drysdale
fe5f33a61e Make batch attestation keys/certs optional
Test: VtsKeyMintTargetTest
Bug: 329399923
Bug: 329269183
Change-Id: I4ef49fcbda7a69ea5623c084e276eb64d34c5813
2024-04-05 16:54:31 +00:00
Charisee Chiw
00557198eb Merge "Update needed for Rust v1.77.1" into main am: 0c2179c224 am: 7dfc18cd09
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3026125

Change-Id: Iad1047e9613c55cce51e294b2582c7c3fdfe89b2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-04-04 18:35:16 +00:00
Charisee
5fc736d96d Update needed for Rust v1.77.1
error: field `0` is never read
  --> hardware/interfaces/security/keymint/aidl/default/main.rs:38:24
   |
38 | struct HalServiceError(String);
   |        --------------- ^^^^^^
   |        |
   |        field in this struct
   |
   = note: `HalServiceError` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis
   = note: `-D dead-code` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(dead_code)]`
help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field
   |
38 | struct HalServiceError(());
   |                        ~~

error: aborting due to 1 previous err


Bug: http://b/330185853
Test: ./test_compiler.py --prebuilt-path dist/rust-dev.tar.xz  --target aosp_cf_x86_64_phone --image
Change-Id: I57f3bd1d702c97929f5fd34f909aa72aa2f2ba02
2024-04-03 20:05:19 +00:00
Treehugger Robot
95f6cc8bd2 Merge "Package the rust_nonsecure keymint default HAL in an APEX" into main am: d741ab8a51 am: 780804059f
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3017012

Change-Id: Iee3e2172174926dd6d494416d86408dfe8934cd1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-30 10:45:33 +00:00
Treehugger Robot
d741ab8a51 Merge "Package the rust_nonsecure keymint default HAL in an APEX" into main 2024-03-30 10:06:52 +00:00
Treehugger Robot
b68cf21914 Merge "Remove unnecessary "_external" suffix from libcppbor" into main am: 86d8bf593a am: 3e3c194ec3
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3019944

Change-Id: I6e94b39523a0ad54d9c31cad6172c26bca6d936d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-29 21:46:08 +00:00
Treehugger Robot
86d8bf593a Merge "Remove unnecessary "_external" suffix from libcppbor" into main 2024-03-29 21:18:28 +00:00
A. Cody Schuffelen
895ba8bdfa Package the rust_nonsecure keymint default HAL in an APEX
This will make it easier to swap in and out with the Cuttlefish remote
implementation.

Bug: 331474817
Test: m com.android.hardware.keymint.rust_nonsecure
Change-Id: I0e9a350b62a90ef6126db109195e19b4181d0cf8
2024-03-29 11:48:31 -07:00
Treehugger Robot
d1c156be22 Merge "Remove reference to factory reset of K" into main am: c523f76846 am: 938d7e68e0
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2502335

Change-Id: I66527c4afa7d69f76131caf1d446a59b2109580d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-29 03:39:09 +00:00
Shawn Willden
98125926c1 Remove unnecessary "_external" suffix from libcppbor
Test: Build
Change-Id: Ied163d1f40c3b86d7b85cae1700310f5cb674e2d
2024-03-28 20:42:34 -06:00
Shawn Willden
deaa5dd808 Remove reference to factory reset of K
The ISharedSecret.aidl description of the pre-shared secret K
mentioned that K was set up during factory reset.  While that could be
done, it is almost never done; most OEMs inject K in the factory.
Removed the reference to setup in factory reset to reduce confusion.

Test: N/A, comment-only change
Change-Id: Idbbd5a8d64197ef4713a75075a9730d06162ad05
2024-03-29 01:22:06 +00:00
Treehugger Robot
7f788a7bb0 Merge "Update needed for Rust v1.77.0" into main am: f814c97702 am: 1a67e24cb7
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3017016

Change-Id: Ib28f40dd6b807fef8d137d48035f2066eefe553d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-28 07:01:18 +00:00
Charisee
c3a74935a1 Update needed for Rust v1.77.0
error: field `0` is never read
  --> hardware/interfaces/security/authgraph/default/src/main.rs:34:24
   |
34 | struct HalServiceError(String);
   |        --------------- ^^^^^^
   |        |
   |        field in this struct
   |
   = note: `HalServiceError` has derived impls for the traits `Clone` and `Debug`, but these are intenti
onally ignored during dead code analysis
   = note: `-D dead-code` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(dead_code)]`
help: consider changing the field to be of unit type to suppress this warning while preserving the field
 numbering, or remove the field
   |
34 | struct HalServiceError(());
   |                        ~~

error: aborting due to 1 previous error


Test: ./build.py --lto thin

bug: http://b/330185853
Change-Id: I08b79176fb5edea9e24990e4884e521c24660d68
2024-03-27 22:58:56 +00:00
David Drysdale
1140c9623d Merge "Secretkeeper: more VTS tests" into main am: c8b02ff6e7 am: 27d3d27cc4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3000947

Change-Id: Ib3650363b229dafdc47ac509526d622cde04bdeb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-27 12:51:29 +00:00
David Drysdale
c8b02ff6e7 Merge "Secretkeeper: more VTS tests" into main 2024-03-27 12:22:06 +00:00
A. Cody Schuffelen
7550cc0225 Fix .rc file for keymint-service.nonsecure am: ddc6a8dbdf am: 34781e1bbb
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3015573

Change-Id: Idad6e8a9cc8493b00a0eadad053b2e08557940e8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-27 09:40:21 +00:00
Nikolay Elenkov
03cf716392 Enable Java backend for ISecretKeeper
Bug: 324321147
Test: Manual -- trigger factory reset, confirm ISecretKeeper.deleteAll()
is being called in Trusty logs.

Change-Id: I0f033b53e83ff549f80271ba4a6ebeabac3db922
2024-03-27 06:51:05 +00:00
A. Cody Schuffelen
ddc6a8dbdf Fix .rc file for keymint-service.nonsecure
This target was using the same `.rc` as the keymint-service target,
though it had a different name.

Bug: 331474817
Test: LOCAL_KEYMINT_PRODUCT_PACKAGE=android.hardware.security.keymint-service.nonsecure m && launch_cvd --noresume --secure_hals=keymint,oemlock
Change-Id: I0f744b75e451f6780d8f6c9bddbd5ea80c579a20
2024-03-26 15:40:37 -07:00
Andrew Scull
f50a2e1c2d Merge "Require proper DICE if StrongBox is present" into main am: 6cb40f35b6 am: ce5c85e2c3
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3009660

Change-Id: I6966aa039553123f5ce9bc8cc1f665d19f853f9d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-25 21:32:35 +00:00
Andrew Scull
2146152db9 Require proper DICE if StrongBox is present
If a decice provides a StrongBox KeyMint instance then the default IRPC
instance is required to use a proper, non-degenerate DICE chain.

Expose a function to check whether the CSR contains a proper DICE chain
and use that from VTS to implement the test.

Bug: 302204396
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I90cf070bc2279fc52e0a8e7fd0039d3fdb68c1d7
2024-03-25 18:16:24 +00:00
Tri Vo
c49bc4764b Tests for imported wrapped RSA and EC keys am: b02ff886be am: a1e3ba1cbd
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2769758

Change-Id: I05082f74b9c2283b0f84c1951c6d47f4c00b25ad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-14 15:59:37 +00:00
David Drysdale
5f4493d75b Secretkeeper: more VTS tests
Add tests for:
- large number of session creations
  - also use a bigger identity, to better simulate real use
- attempt to retrieve a secret with an incorrect identity

Test: VtsSecretkeeperTargetTest (shiba)
Bug: 327526008
Change-Id: I8dddf643d03a8fb679511564cb03c2248477c116
2024-03-14 15:00:37 +00:00
Tri Vo
b02ff886be Tests for imported wrapped RSA and EC keys
Only applies for devices on VSR API level 35 and above, so that existing
devices which previously passed VTS should not need to pass the new
tests.

Bug: 292534977
Test: VtsAidlKeyMintTargetTest
Change-Id: I8281c3cebf05795e3f9a1ed2b112fc149d8a104c
2024-03-14 13:04:16 +00:00
Seth Moore
a5f0340d01 Update docs to use the correct canonicalization reference am: fcff3dd6c7 am: dc3733e189
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2994271

Change-Id: I557c93de4aab496cb9d8eea282ace3d4961bed1f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-08 19:40:00 +00:00
Seth Moore
fcff3dd6c7 Update docs to use the correct canonicalization reference
Bug: 325906414
Change-Id: I1eb5bc52df4627c713bb2611101e2c3238ac7b9d
2024-03-08 14:10:49 +00:00
David Drysdale
151c372fb9 Merge "Reinstate C++ KeyMint impl as default" into main am: 1e6a078326 am: cde647a820
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2994049

Change-Id: Ie00152dfbed80a0020be3d2276a09f5c44cfb08a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-07 13:59:07 +00:00
David Drysdale
764199f2c9 Reinstate C++ KeyMint impl as default
This is a partial revert of aosp/2856649, changeID
Ia450e9a8f2dc530f79e8d74d7ce65f7d67ea129f, because it turns out
that there are Wear devices that are using the default implementation
(but which are not covered by TreeHugger/presubmit).

It restores the C++ implementation for KeyMint as
android.hardware.security.keymint-service, but preserves the Rust
libraries that were moved here in that CL as a subsequent CL
(aosp/2852598) means that Cuttlefish now uses the libraries here.

Test: VtsAidlKeyMintTargetTest on Cuttlefish
Bug: 328251011
Bug: 314513765
Change-Id: Id6f3491144588e418cd6e18e51262fe839bfdf39
2024-03-07 10:33:22 +00:00
David Drysdale
95ab944796 Merge "KeyMint: add separator for debugging output" into main am: ea20772c42 am: dd243e0d08
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2980595

Change-Id: I44da3e93e17d09871d37a924f5a4db11fe693931
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-05 12:26:05 +00:00
David Drysdale
ea20772c42 Merge "KeyMint: add separator for debugging output" into main 2024-03-05 11:12:38 +00:00
David Drysdale
05b3c24186 Merge "KeyMint: default to Rust reference implementation" into main am: 695f02607b am: 4d7be1ccce
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2856649

Change-Id: Ia41e04f48375566a27fbe2e52a2212a7ee52bbb5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-03-05 08:28:20 +00:00
David Drysdale
30196cf77c KeyMint: default to Rust reference implementation
Copy code that can be re-used from the Cuttlefish KeyMint
implementation, specifically from the following directories
under device/google/cuttlefish:

- HAL-side code from guest/hals/keymint/rust/
- TA-side code from host/commands/secure_env/rust/

Create a corresponding pair of libkmr_{hal,ta}_nonsecure libraries here.
The only changes to the copied code are:

- Convert `pub(crate)` to `pub` in `attest.rs`.
- Add some missing doc comments.
- Add comment noting need for SELinux permission to read ro.serialno.
- Add comment noting need for clock to be in sync with Gatekeeper.

(A subsequent CL aosp/2852598 adjusts Cuttlefish so that it uses the
copied modules here, and can remove the original copies.)

In addition to the moved code, the default implementation also needs
a new implementation of a monotonic clock, added here in clock.rs
using `std::time::Instant`.

With the new nonsecure HAL and TA libraries in place, implement the
default KeyMint HAL service using the former, and spin up a single
thread running a nonsecure TA using the latter.  Communicate between
the two via a pair of mpsc::channel()s.

Test: VtsAidlKeyMintTargetTest with normal Cuttlefish (all pass)
Test: VtsAidlKeyMintTargetTest with default/nonsecure impl (auth
      tests fail, but this is expected as Gatekeeper hasn't moved)
Bug: 314513765
Change-Id: Ia450e9a8f2dc530f79e8d74d7ce65f7d67ea129f
2024-03-01 07:20:57 +00:00
Devin Moore
9eec1433fa Merge "Vendor API level 202404 is now frozen" into main 2024-02-29 17:14:40 +00:00
David Drysdale
f3a4bea6df KeyMint: add separator for debugging output
When dumping attestation certificate chains with the --dump_attestations
option, add a separator between distinct chains to make them easier to
analyze.

Bug: 326564087
Test: VtsAidlKeyMintTargetTest
Change-Id: Ife19edfddef6c8cd26de9f9816c3c9bf65cbb929
2024-02-28 11:32:35 +00:00
Shikha Panwar
d840d11317 Merge "Sk VTS: Identity of Secretkeeper is same as in DT" into main am: d7f594dc4d am: 8a06fd4343
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2973515

Change-Id: I6b7d719c854071fa9ef06eb81815f06a9eccb221
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-27 16:03:30 +00:00
Shikha Panwar
d7f594dc4d Merge "Sk VTS: Identity of Secretkeeper is same as in DT" into main 2024-02-27 14:31:59 +00:00
Treehugger Robot
8fcf758544 Merge "Fixed issue converting Asn1 time to posix on 32-bit systems." into main am: 5c7dd08f12 am: 1cd5d233b6
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2977478

Change-Id: Ic0d8e0d1900eea7634cf9b2b0e42a2e8b809d5a2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-27 08:09:51 +00:00
Subrahmanya Manikanta Venkateswarlu Bhamidipati Kameswara Sri
b66a37a8e2 Fixed issue converting Asn1 time to posix on 32-bit systems.
Used ASN1_TIME_to_posix API instead of ASN1_TIME_to_time_t
to avoid integer overflow on 32-bit systems.

Bug: 325853206
Test: vts -m VtsAidlKeyMintTarget
Change-Id: I7a01a521d389482a61ad9974b7e40eaa099c3571
2024-02-26 19:23:44 +00:00
Shikha Panwar
0d286b3867 Sk VTS: Identity of Secretkeeper is same as in DT
Secretkeeper is expected to advertize its public key to Android via
Device tree node at /avf/reference/avf/ Check that the identity used
during AutGraph key exchange protocol with client is indeed this.

Test: #secretkeeper_check_identity on device with Sk/default instance
enabled
Bug: 291213394

Change-Id: I08815d75410fdd0c76d675c7cc9521abe0cda98b
2024-02-22 22:06:20 +00:00
Devin Moore
a8efdb127e Vendor API level 202404 is now frozen
Ignore-AOSP-First: VINTF 202404 Finalization
Bug: 279809333
Test: build
Change-Id: Ie6d38d27a287e258c30516e0030ad8c931d06432
2024-02-20 21:05:23 +00:00
Eric Biggers
b62bdd33be Merge "keymint: document deprecation of UNLOCKED_DEVICE_REQUIRED enforcement" into main am: 8c7558625f am: 1438394ac9
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2966026

Change-Id: I9cb9e8b2cf36fc8c60c0ff78a0a1f591f61ad4a1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-02-20 20:11:19 +00:00
Eric Biggers
df32f52a47 keymint: document deprecation of UNLOCKED_DEVICE_REQUIRED enforcement
KeyMint enforcement of UNLOCKED_DEVICE_REQUIRED is broken, has never
been used, and cannot be fixed.  So, document that it does not need to
be implemented.  Also remove the VTS test for it, which was disabled.

UNLOCKED_DEVICE_REQUIRED remains supported in Keystore.

Bug: 321100166
Test: Build
Change-Id: If4d47ee49c9d4a595820cfceb0f5f3027f99ee9f
2024-02-16 20:28:17 +00:00