Commit Graph

1090 Commits

Author SHA1 Message Date
Karuna Wadhera
550caafbfd Merge "Amend tests on GSI that rely on RKP-only props" into main 2024-07-17 14:28:45 +00:00
Karuna Wadhera
0c5b6503ed Amend tests on GSI that rely on RKP-only props
GSI replaces the values for remote_prov_prop properties (since they’re
system_internal_prop properties), so on GSI the properties are not
reliable indicators of whether StrongBox/TEE are RKP-only or not.

Also included is the removal of the helper skipAttestKeyTestIfNeeded()
so the skipping can happen in the tests directly.

Bug: 348159232
Test: VtsAidlKeyMintTargetTest
Change-Id: I2075e1f76ddd0f87620a212e1aa389803139a117
2024-07-17 12:41:51 +00:00
Akhilesh Sanikop
aae715f927 Updated fuzz_config in Android.bp file
Added fuzz_config and its fields like - cc, componentid,
hotlists, description, vector, service_privilege,
users & fuzzed_code_usage.

Bug: 306435930
Test: Build the updated fuzz targets

Change-Id: Ib537f4c4c98860de431e33dedbd106930cf8e45a
2024-07-16 16:17:20 +05:30
Akhilesh Sanikop
ee2196d155 Added keymint_rkpsupport_fuzzer
exec/s: 30
Test: ./keymint_rkpsupport_fuzzer
Bug: 337985606

Change-Id: Ib6955d188351ce3fc598a0f27ad626f718d542b8
2024-07-03 15:07:54 +05:30
Akhilesh Sanikop
ddbaa66bbc Added keymint_remote_prov_fuzzer
exec/s: 12
Test: ./keymint_remote_prov_fuzzer
Bug: 337985606

Change-Id: Ifaa5c32616904c1aa5b6d8a21c566a014ed882cf
2024-07-03 15:07:33 +05:30
Treehugger Robot
6435b744d7 Merge "Add NID_secp384r1 support on parsing UDS public key" into main 2024-07-02 03:01:51 +00:00
Tommy Chiu
10ee304f01 Add NID_secp384r1 support on parsing UDS public key
It used to be hard coded to secp256.

Bug: 330791928
Test rkp_factory_extraction_tool64

Change-Id: I759d94a7112bb9fb50906b8e0d45b851f82c898f
2024-07-02 02:01:29 +00:00
Treehugger Robot
af7df71799 Merge "Fix invalid access on nullptr" into main 2024-07-01 21:29:05 +00:00
Tommy Chiu
2165de0046 Fix invalid access on nullptr
Should return when there's no content be parsed.

Bug: 330791928
Test: rkp_factory_extraction_tool64
Change-Id: I45302ec20a0a931d2f44a7e36f613858c10fe21e
2024-07-01 06:43:30 +00:00
Shikha Panwar
578eae1d52 Merge "Vts: New dice_policy_builder api with TargetEntry." into main am: adad97cb79
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3127995

Change-Id: If79596e0661aad7485ce3dee42f7f5067d94c83b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-14 08:59:55 +00:00
Shikha Panwar
adad97cb79 Merge "Vts: New dice_policy_builder api with TargetEntry." into main 2024-06-14 08:54:39 +00:00
Shikha Panwar
d530f7e39b Vts: New dice_policy_builder api with TargetEntry.
The policy building library changes in aosp/3125493, accordingly change
the function call. This does not change the behaviour or test coverage
of VTS.

Test: atest VtsSecretkeeperTargetTest
Bug: 291245237
Change-Id: I21a7b0abe5bf186893ec9a68bb080b41778d3313
2024-06-13 14:55:51 +00:00
David Drysdale
e10b12929c Merge "KeyMint: version gate attestation of IMEI2" into main am: 54db6b2214
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3125954

Change-Id: I0f73da5fbf1274e8555f493d3b408f9b29fbb963
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-06-12 10:19:30 +00:00
David Drysdale
e9dcae53e4 KeyMint: version gate attestation of IMEI2
aosp/3106417 added extra tests with for device ID attestation, but
didn't include a version gate for attesting to the second IMEI value,
which is only present in KeyMint v3+.

Test: VtsAidlKeyMintTargetTest
Change-Id: I95f47942058781709efe96d38442e0518e39705d
2024-06-11 15:43:12 +01:00
David Drysdale
acb80cfdf2 KeyMint: add VTS test with all IDs am: ef1123b24e
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3106417

Change-Id: Icfc31847731c3ca48492234751033d4be8ada033
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-31 12:19:59 +00:00
David Drysdale
ef1123b24e KeyMint: add VTS test with all IDs
Add a test that includes all of the device IDs for attestation, which
helps to check whether the emitted extension is including everything in
the correct order.

(This is already tested in CTS since aosp/2650044)

Also fix test of first API level to use `get_vsr_api_level` helper.

Test: VtsAidlKeyMintTargetTest
Test: with/without KeyMint hacked to emit tags in wrong order
Change-Id: Ic6e489aa99c773d794ad8cbddbe5153b1a145ea5
2024-05-31 12:05:04 +01:00
Treehugger Robot
14ae5a614b Merge "Added keymint_authSet_fuzzer" into main am: 7884619140
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3066744

Change-Id: I9e5ef4c4fabd7025f49829dcc6d1982342685920
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-28 08:41:50 +00:00
Treehugger Robot
7884619140 Merge "Added keymint_authSet_fuzzer" into main 2024-05-28 08:24:05 +00:00
Treehugger Robot
6707c6716b Merge "Added keymint_attestation_fuzzer" into main am: 02a086bdaa
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3066743

Change-Id: Id5c46cf92626e9f9ee13c3644b0128306dc09281
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2024-05-28 07:02:14 +00:00
Treehugger Robot
02a086bdaa Merge "Added keymint_attestation_fuzzer" into main 2024-05-28 06:45:29 +00:00
Xin Li
64e598ce2b Merge Android 24Q2 Release (ab/11526283) to aosp-main-future
Bug: 337098550
Merged-In: I53a278f1317f5307441103dc42dc5be6f20d7075
Change-Id: I3a53ebf7339cdb886d3c1b733b8eee1847f8832a
2024-05-24 08:28:04 -07:00
David Drysdale
fd7119ea67 Merge "Delete standard output in VtsAidlKeyMintTargetTest" into main 2024-05-17 05:59:57 +00:00
Alice Wang
46ff286f6d Run VtsHalRemotelyProvisionedComponentTargetTest only on V+ devices
Bug: 340188780
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: Id20a01b23324eb46620d96bd29c30b8cf9acd162
2024-05-15 15:27:26 +00:00
Huang Rui
ca3ea117ef Delete standard output in VtsAidlKeyMintTargetTest
The Done flag of VtsAidlKeyMintTargetTest is false during running
the module with ‘--collect-tests-only’ because it uses standard
output to print logs.

Bug: 340576534
Test: run vts -m VtsAidlKeyMintTargetTest --collect-tests-only

Change-Id: I3d81f7e59b6189fab1b146320263509f2694c11e
Signed-off-by: Huang Rui <rui1.huang@intel.com>
Signed-off-by: Liu Kai <kai1.liu@intel.com>
2024-05-15 11:42:59 +01:00
Akhilesh Sanikop
0e568bc8e5 Added keymint_authSet_fuzzer
exec/s: 490
Test: ./keymint_authSet_fuzzer
Bug: 337985606

Change-Id: I47ee42e6e97b98110bab8f923a94ed7b6e8b992d
2024-05-13 23:47:19 +05:30
Akhilesh Sanikop
007129a7fd Added keymint_attestation_fuzzer
exec/s: 2
Test: ./keymint_attestation_fuzzer
Bug: 337985606

Change-Id: I2c0d56e1af97190a5eb06a34e15bcd93123f39a6
2024-05-13 23:46:36 +05:30
A. Cody Schuffelen
fbc3089310 insecure keymint: in-process initialization ordering
This creates an ordering of

1. In-memory HALs are initialized
2. Secure AIDL HALs are exposed

There are some dependencies on the information, e.g.

Boot info:
https://cs.android.com/android/platform/superproject/main/+/main:system/keymint/ta/src/keys.rs;l=705;drc=72ed18b226a9944330ecd97d776d57ea1b2eb9e8
https://cs.android.com/android/platform/superproject/main/+/main:system/keymint/ta/src/lib.rs;l=356;drc=4f8cad1bf0b3392414e5735b95a7c5d80d64d6e6
https://cs.android.com/android/platform/superproject/main/+/main:system/keymint/ta/src/rkp.rs;l=75;drc=747e5931be387fb600f6865d2308390646243610

HAL info:
https://cs.android.com/android/platform/superproject/main/+/main:system/keymint/ta/src/rkp.rs;l=79;drc=747e5931be387fb600f6865d2308390646243610

Bug: b/339121782
Test: launch_cvd --resume=false --secure_hals=oemlock:guest_insecure_keymint:guest_insecure_gatekeeper
Change-Id: Ifbe8655bf14c248e886725217d261dae5458e15f
2024-05-07 16:56:42 -07:00
Seth Moore
8e57f5e434 Fix formatting around rkp-vm tag
Change-Id: I5d073427204596bc86e11d550e86da4c56745f72
2024-04-29 19:04:20 +00:00
David Drysdale
b2adc861ee Merge "KeyMint: more warnings around non-secure test impl" into main 2024-04-29 07:25:08 +00:00
David Drysdale
33a132f13f KeyMint: more warnings around non-secure test impl
Make it clearer that the default implementation is non-secure in
various ways, most notably because the TA code is running in-process
in the HAL service.

Bug: 314513765
Test: VtsAidlKeyMintTargetTest
Change-Id: I83509110c32a4df8df6c0b288d14659e022442ff
2024-04-29 07:09:34 +01:00
David Drysdale
b4598740de KeyMint: test for unique HMAC results
Bug: 218713582
Test: VtsAidlKeyMintTargetTest
Change-Id: I5babfa67e707dc1bf15dd40b1ee4c8c8b97f44a7
2024-04-25 10:00:05 +01: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
fae563acb0 Merge "Allow RKP-only devices to pass keymint VTS" into main 2024-04-09 15:31:26 +00:00
David Drysdale
61c9ab4d87 Merge "Make batch attestation keys/certs optional" into main 2024-04-09 09:11:54 +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
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
d741ab8a51 Merge "Package the rust_nonsecure keymint default HAL in an APEX" into main 2024-03-30 10:06:52 +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
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
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
c8b02ff6e7 Merge "Secretkeeper: more VTS tests" into main 2024-03-27 12:22:06 +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
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
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