Commit graph

647 commits

Author SHA1 Message Date
Max Bires
1589c401e0 Merge "Fix overly relaxed Device ID Test." 2022-11-28 20:15:13 +00:00
Treehugger Robot
4ad2bb150e Merge "Document changes and clean up spec" 2022-11-22 21:15:18 +00:00
Max Bires
a97ec69e4b Fix overly relaxed Device ID Test.
Previous versions of VTS had to allow a Device ID attestation failure
to return INVALID_TAG even though this is inconsistent with the KeyMint
spec. This was due to previous KM implementations returning this before
the test was added to validate the precise error code being returned
from Device ID attestation.

For VSR-14 and newer devices, the test will now enforce that only
CANNOT_ATTEST_IDS is returned from a failed device ID attestation call.

Test: atest VtsAidlKeyMintTargetTest
Change-Id: I6acff3fd32f3f251f946e3603283535f36d99a5d
2022-11-22 12:33:50 -08:00
Max Bires
8d046265b8 Document changes and clean up spec
This change clarifies some more items that have changed between v2 and
v3 of the IRPC spec, along with fixing and clarifying some more
messaging in the .aidl documentation.

Test: Someone else can intelligibly read what was written
Change-Id: Ia9fa1595a72c818f93ce6fb31ea38c97d997488b
2022-11-22 10:45:55 -08:00
Seth Moore
9d52a3579e Merge "Allow rkpd mainline module to link rkp aidl bits" 2022-11-22 16:54:13 +00:00
Seth Moore
557a1dbd03 Allow rkpd mainline module to link rkp aidl bits
Test: Build
Change-Id: Ide8b4ec4b8994368d035f79054818542aba306e5
2022-11-21 17:15:37 -08:00
Eran Messeri
b9d71d3e09 ID attestation: update docs for a second IMEI
Update the comment describing the attestation record:
* KeyMint version bump to V3
* Inclusion of the 2nd IMEI.

Bug: 244732345
Test: That it builds
Change-Id: I19f89bc9936b747647dc690d4702c60d2bbe92c5
2022-11-21 15:53:37 +00:00
Tri Vo
2ac5066335 Merge "Add an implementation defined limit on number of keys in CSR" 2022-11-16 03:44:22 +00:00
Tri Vo
9cab73c8bd Add an implementation defined limit on number of keys in CSR
Rationale here is that many IRPC implementations are memory constrained.
We add a way for implementations to report the maximum number of
supported keys. This way we can guarantee consistent behavior across
different devices.

For implementation of IRPC version 3 and later we define the lowest
number of keys supported to be 20. This specific value was chosen
because the current implementation of RemoteProvisioner already combines
keys into batches of exactly 20.

Bug: 254137722
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: Ib6fb6d6ec7c74004524a5505a37aa82c9e44ef91
2022-11-15 14:19:55 -08:00
Andrew Scull
5eeb73beb7 Merge changes from topic "rkp-csrv3-updates"
* changes:
  Update the VTS test for CSRv3 updates
  Adjust CSRv3 CDDL after implementation experience
2022-11-14 22:01:53 +00:00
Tommy Chiu
7d22f60924 KeyMint VTS: Police key validity from v2 HAL
The key validity can be ignored when generatKey on Android-12 (S).

Bug: 257445538
Test: Pass on S builds
Change-Id: Iafd8d080f324c7d8d6affbb9d28d4f265f13e2ab
2022-11-14 21:03:44 +08:00
Andrew Scull
fb49ad2f3c Update the VTS test for CSRv3 updates
Conform to the latest CDDL changes. Organize parsing to observe the
AuthenticatedRequest structure.

Return the deserialized CSR payload rather than the DICE chain keys
because it simplified the return types.  The return value is only used
by one VTS test that checks sequential CSRs consist of the same request.
The test was incomplete before and it now only looks as the CSR payload
whereas it previously only look at the DICE chain keys.

Bug: 250910137
Test: atest libkeymint_remote_prov_support_test librkp_factory_extraction_test
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I1ba2e0cec22e25312fb890923a4c93043e9046cd
2022-11-11 15:24:38 +00:00
Andrew Scull
9aa150cee7 Adjust CSRv3 CDDL after implementation experience
Rename from AuthenticatedMessage to AuthenticatedRequest in order to
make the direction of the message clear.

Move the challenge out of the endpoint-specific message and up into the
common authentication wrapper as it is uesd in the authentication
protocol.

Simplify the versioning by having the CSR version continue sequentially,
making the current version 3. Have the AuthenticatedMessage version
start from 1 as it's value isn't used to distinguish v2 and v3 CSRs
anyway and it will avoid confusion with the CSR version which has
already moved beyond this value.

Bug: 250910137
Test: n/a -- comments only
Change-Id: I13836e90fa76b1b22cb6627f3d987828ffeb0adc
2022-11-10 21:50:55 +00:00
Tri Vo
85ee679e2e Merge "Add VtsAidlKeyMintTargetTest to presubmit" 2022-11-10 20:41:55 +00:00
Seth Moore
75dd6a15d2 Merge changes from topic "cherry-pick-rkp-hal-split"
* changes:
  Update the RKP aidl dependency
  Update README and CHANGELOG for RKP
  Split rkp from keymint
2022-11-10 19:32:31 +00:00
Seth Moore
20b3262727 Merge changes from topic "cherry-pick-rkp-hal-split"
* changes:
  Add missing dependency on RKP HAL
  ID attestation: Define tag for a second IMEI
2022-11-10 19:32:31 +00:00
Treehugger Robot
9d99ac49a1 Merge "Fix a couple of regular expressions." 2022-11-10 07:12:12 +00:00
Treehugger Robot
a30c39330f Merge "benchmark: updated benchmark tests for strongbox" 2022-11-10 05:32:17 +00:00
Seth Moore
41e97f0bbf Update the RKP aidl dependency
Bug: 254112961
Test: vts_treble_vintf_vendor_test
Merged-In: I86f864003e38224936375930891abb38f7d55d3d
Change-Id: I86f864003e38224936375930891abb38f7d55d3d
2022-11-10 01:57:10 +00:00
Seth Moore
f479b4b902 Update README and CHANGELOG for RKP
Bug: 254112961
Test: vts_treble_vintf_vendor_test
Merged-In: Ib66fcbdbaadda3f32cd8423f61bd31d5f43dc44b
Change-Id: Ib66fcbdbaadda3f32cd8423f61bd31d5f43dc44b
2022-11-10 01:56:49 +00:00
Seth Moore
3a810627e0 Split rkp from keymint
Bug: 254112961
Test: vts_treble_vintf_vendor_test
Merged-In: I3734bd7647cbb7b33ef654ba2fb40fe8a648689e
Change-Id: I3734bd7647cbb7b33ef654ba2fb40fe8a648689e
2022-11-10 01:56:41 +00:00
Seth Moore
5937f07a69 Add missing dependency on RKP HAL
Bug: 258288484
Test: libkeymint_remote_prov_support_test
Merged-In: I032d30e5f46aa3fc0dd7b95373180b9653ccbf23
Change-Id: I032d30e5f46aa3fc0dd7b95373180b9653ccbf23
2022-11-10 01:56:25 +00:00
Eran Messeri
210d3ea87b ID attestation: Define tag for a second IMEI
Define a KeyMint tag for a second IMEI to be included in the attestation
record.

Also clarify that the IMEI tag is meant to include one, and only one,
IMEI.

Bug: 244732345
Test: android.keystore.cts.DeviceOwnerKeyManagementTest
Merged-In: I70ecbb0245ba2e517e5d0db0cfdce4525846f3e5
Change-Id: I70ecbb0245ba2e517e5d0db0cfdce4525846f3e5
2022-11-10 01:54:21 +00:00
Elliott Hughes
be36da4c2b Fix a couple of regular expressions.
Our old NetBSD regex implementation didn't care, but the current NetBSD
implementation rejects unquoted `{` and `}`s that aren't actually part
of a repetition. glibc shares this behavior.

Interestingly, the new NetBSD code was itself an sync with FreeBSD, so
although macOS right now allows this (as Android did), they may well
switch too.

Anyway, this way of writing the regular expressions is strictly correct,
so regardless of whether or not we can actually land this change to the
regex implementation without causing app compat chaos, we should fix
this test.

Bug: http://b/258469149
Test: treehugger
Change-Id: I85bf5d8f557a4fe5ac5ebeea565892d36da30b55
2022-11-09 22:07:11 +00:00
Treehugger Robot
080af0a493 Merge "Fix typo in property name" 2022-11-08 20:23:28 +00:00
Tri Vo
799e4353c2 Fix typo in property name
Test: VtsAidlKeyMintTargetTest
Change-Id: I9c42f14a468ae907d4c47df8af4e3b9b16cd5d96
2022-11-07 17:23:53 -08:00
Tri Vo
6529ceff1b Add VtsAidlKeyMintTargetTest to presubmit
Bug: 224515306
Test: presubmit
Change-Id: Ia90761c5109b217ad0628f621f5952a1c4e07471
2022-11-07 15:53:33 -08:00
Devin Moore
7556e51ce8 Mark keymint as unfrozen to manage keystore2's imports
We are now checking the imports of frozen versions of interfaces and
need mark keystore2 as `frozen: false` so the aidl_interfaces that
import it will import the latest unfrozen version.

Test: hal_implementation_test
Bug: 257338648
Change-Id: Ibcb151abd2fc13e3f7dfbcf515d0f62839d1caf9
2022-11-04 15:31:23 +00:00
avinashhedage
8d8d788cff benchmark: updated benchmark tests for strongbox
Execute only relevant benchmark tests for StrongBox.

Bug: b/229819550
Test: run VtsAidlKeyMintBenchmarkTest in the adb shell

Change-Id: I3bf95dc5d4bcd1da027e09b1bbde7e6173749481
2022-11-03 05:28:46 +00:00
Tri Vo
73cb8af65e Merge "Add TEST_MAPPING config" 2022-10-28 19:03:57 +00:00
Tri Vo
269057bd78 Add TEST_MAPPING config
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: Ia190f6c91a4312cc06a525fcbe0e2c5ba6975013
2022-10-27 15:10:17 -07:00
Tommy Chiu
4fdcccc7c0 KeyMint VTS: Use a strongbox must support DIGEST for importKey
"ImportWrappedKeyTest.WrongDigest" tried to wrap a keyBlob by one digest
type and unwrap it by another digest type.

It's been OK for KeyMint implementations to allow unsupported
parameters/characteristics at key generation time, and only police their
use, at begin() time. However if an implementation wants to secure it at
the key generation/importing time the first digest type must be
supported by all implementation.

Bug: 249276913
Test: VtsAidlKeyMintTargetTest
Change-Id: I6bc000026e9e4aec0aa82078a98c75e2d7c56847
2022-10-25 21:22:57 +08:00
Tri Vo
5ae39a28c2 Merge changes from topic "rkp_v3"
* changes:
  Update VtsHalRemotelyProvisionedComponentTargetTest to v3
  Bump Identity and KM AIDL API versions
2022-10-20 02:43:12 +00:00
David Drysdale
e1185fa1fd Merge "Coalesce OWNERS and add component" 2022-10-19 05:25:08 +00:00
Tri Vo
0d6204e2b7 Update VtsHalRemotelyProvisionedComponentTargetTest to v3
Bug: 235265072
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I01e387a0784c3548a4661a73d7bd3d5bec9fb42e
2022-10-17 17:04:19 -07:00
Tri Vo
f48a2a7bbf Bump Identity and KM AIDL API versions
Imported interfaces are versioned, i.e. bumping an interface version
necessiates bumping the version of importing interfaces.

Keystore and Identity import KM. We are uprevving KM, so all three need
to be bumped at the same time.

Test: m
Change-Id: I46b253e72f2f245bd628ed2ae1f2f4e0572827e7
2022-10-17 15:04:59 -07:00
David Drysdale
02abced109 Coalesce OWNERS and add component
Test: TreeHugger
Bug: 237676243
Change-Id: I04f79cfcf3a4a4dd132e17e93b53c2807818d60d
2022-10-13 09:25:48 +01:00
Tri Vo
dd12c487d2 IRPC test: use version from RpcHardwareInfo
Check against version of the interface reported by the HAL rather than
the one from generated code.

AIDL interface are meant to be backwards compatible. Having the HAL
report its version dynamically makes it easier to maintain legacy
behavior while evolving the interface, e.g. we bump IRPC to v3
across our codebase, but devices that already shipped may still behave
as v1/2 devices.

Bug: 235265072
Test: VtsHalRemotelyProvisionedComponentTargetTest

Change-Id: I49e3a09723590ac1a7c432b11450c1438563c787
2022-10-12 22:41:33 +00:00
Treehugger Robot
ff8f1d6edd Merge "Generalize RKP CDDL schema beyond CSRs" 2022-10-07 18:21:25 +00:00
David Drysdale
0192979809 Merge "RKP HAL: fix typos" 2022-10-06 05:57:28 +00:00
Andrew Scull
bff2cae4f8 Generalize RKP CDDL schema beyond CSRs
The certificate signing request (CSR) CDDL schema comprises and
authentication wrapper and an inner payload containing details of the
request. Seperate these two parts more clearly in the schema with a view
to reusing the authentication wrapper for other messages.

The change of Csr to be defined in terms of the AuthenticatedMessage
generic type has no effective change on the schema.

A version field is added to CsrPayload, formerly SignedDataPayload, so
that the AuthenticatedMessage and CsrPayload schemas can evolve
independently.

The cert_type field of DeviceInfo is moved up a level into CsrPayload.
This means DeviceInfo only contains device information and not other
fields related to the CSR.

The payload of AuthenticatedMessage is not self-describing. The expected
schema of the payload will be inferred from context, for example the
server endpoint the message is sent to.

Bug: 250910137
Test: n/a - comments only
Change-Id: I2c981ec8fe63995779ce119168ad3d9b40d5b8c5
2022-10-05 10:00:52 +00:00
David Drysdale
e6fe69b75d Merge "KeyMint HAL: clarify time-based auth behaviour" 2022-10-05 06:09:40 +00:00
Andrew Scull
a4c4a18dc7 Tweak RKP HAL comments
Change the cert_type field from an enum of strings to a tstr type with
the known types documented in comments. The types are part of the
protocol between the HAL implementation and the provisioning server that
is opaque to the Android platform, so there's not need to bump the HAL
version in order to add new certificate types.

Replace the undefined Dcc type/acronym with the term "DICE chain" for
smoother reading.

Make the behaviour of generateCertificateRequest() in the v3 HAL more
explicit by explaining that a ServiceSpecificException should be raised
with the same error code that is currently documented.

Bug: 240312857
Test: n/a - comments only
Change-Id: If5acc388b25fa24d240c936ddefd08943fc6dd8d
2022-10-04 13:12:22 +00:00
David Drysdale
a867bc1eb3 KeyMint HAL: clarify time-based auth behaviour
Changes:
- correct the sign of the timestamp comparison text
- make updateAad() and finish() refer to the auth text in begin()
- describe auth flows for keys with AUTH_TIMEOUT on devices without
  a secure time source

Test: none, comment change only
Change-Id: Ia60a4a949e030a7a96772406e3b0f7b3211a0915
2022-09-29 15:56:25 +01:00
Seth Moore
2fc6f83df6 Move verifyProtectedData into remote_prov_utils
This way, rkp_factory_extraction_tool can reuse the code to perform a
test on the factory line if a partner so chooses.

Test: rkp_factory_extraction_tool --self_test
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Bug: 239839050
Change-Id: I3989ba606750be77f1945a50fe2307a631d19d11
2022-09-16 16:05:29 -07:00
David Drysdale
77f66a3ccc RKP HAL: fix typos
Test: None, comment change only
Change-Id: I74ddad8ccf9f7e2d6ff2237dac32b94957a9161c
2022-09-14 15:39:40 +01:00
Seth Moore
f1f6215c09 Move the device info validation to a helper library
rkp_factory_extraction_tool now reuses the VTS logic for validating the
DeviceInfo. This way, partners doing RKP testing can see locally if they
are getting bad DeviceInfo before they try to upload the data to the
google service.

Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Test: rkp_factory_extraction_tool
Bug: 239838563
Change-Id: I80fba3e624e1f5ab6da7aac889a0168f7cb8dbe4
2022-09-13 12:00:50 -07:00
Max Bires
0068fccb41 Merge "Clarify error message in DeviceInfo check." 2022-09-09 23:40:17 +00:00
Max Bires
757ed42e2c Clarify error message in DeviceInfo check.
This change gives additional context to the device info checks while.
Currently, an unprovisioned device will generate a massive spam of
failures which may be WAI for an early hardware revision device that
was not provisioned with attestation IDs.

Test: atest VtsHalRemotelyProvisionedComponentTest
Change-Id: I16069dba841a90aa55781148d3c268ced635e006
2022-09-08 18:19:26 -07:00
Max Bires
137ffac4c5 Update IRemotelyProvisionedComponent HAL to v3
This change makes all of the changes to the HAL AIDL files, along with
corresponding documentation edits, to facilitate the definition for
version 3 of IRemotelyProvisionedComponent HAL.

The bulk of the changes are described within the RKP_CHANGELOG.md file
and will therefore not be discussed here within the commit message.

Bug: 240312857
Test: It is human readable and also builds.
Change-Id: I920550bdfe5a8f9ba677c4a4f67e975bcd3672ab
2022-09-02 10:20:28 -07:00