Commit graph

769 commits

Author SHA1 Message Date
Eran Messeri
506089a8e9 Merge "Extending AttestKeyTest#EcdsaAttestationID test to use IMEI as attestation id." 2023-01-24 16:48:26 +00:00
David Drysdale
9c99dc9a39 Add missing endquote and newline
Test: tsAidlKeyMintTargetTest --gtest_filter="*KeyBlobUpgradeTest*After*default"  --keyblob_dir /data/local/tmp/keymint-blobs
Change-Id: I6f1d2778637cf4603e1ab896d63df936fbf82a38
2023-01-24 12:21:21 +00:00
Rajesh Nyamagoud
eb644cfcbe Extending AttestKeyTest#EcdsaAttestationID test to use IMEI as
attestation id.

Get IMEI value from Telephony Service and use it as attestation id.

Bug: 261847629
Test: atest VtsAidlKeyMintTargetTest
Change-Id: I0212def48d761a45f514161e5576a954bf388c56
2023-01-20 20:32:05 +00:00
Treehugger Robot
2524ba06a2 Merge "Adjust for library rename" 2023-01-18 21:54:46 +00:00
subrahmanyaman
a7a6f70e62 Updated the digest to SHA_2_256 in key upgrade tests.
Updated the digest to SHA_2_256 in manaul key upgrade tests
so that these tests works for StrongBox as well.

Test: VtsAidlKeyMintTargetTest
Change-Id: I971f6e13272450d39537cc44c59f8ed8dbd19bf0
2023-01-18 18:13:27 +00:00
Treehugger Robot
8e8f82502b Merge "Use libcert_request_validator to check DICE chain" 2023-01-18 00:03:04 +00:00
Eran Messeri
a720d56824 Merge "2nd IMEI attestation: Clarify tag usage." 2023-01-17 11:39:42 +00:00
Andrew Scull
c54f43300d Adjust for library rename
libcert_request_validator is now called libhwtrust so update the
references to match.

Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I3c73e2749996ef684da4567a3c86daf8b9c0fd09
2023-01-15 21:51:44 +00:00
Andrew Scull
9a8c945682 Use libcert_request_validator to check DICE chain
Remove one of the DICE chain validation implementations and replace it
with a call to the libcert_request_validator library which has the most
complete validation and is planned to be the only implementation we
support.

VTS will now check both degenerate and proper DICE chain more completely
and will be consistent with other tools like `bcc_validator`. P-384 will
become a supported key type in the DICE chain.

The whole static library is included so that clients that statically
link remote_prov_utils don't need to be aware of the dependency.

Bug: 254510672
Bug: 265455904
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I067f7e8710e379a4b404ef9d2c04fe6410f73dc4
2023-01-15 21:51:41 +00:00
Eran Messeri
36594490fd 2nd IMEI attestation: Clarify tag usage.
Clarify that the tag for the 2nd IMEI must denote an IMEI different to
the tag used for the first IMEI, and may be used independently of it.

Bug: 264979486
Test: N/A
Change-Id: I45a46d1052e45a965c8be391d11157cc4481545b
2023-01-15 10:39:22 +00:00
Daniel Angell
1f5ab0d6f8 Make libkeymint_remote_prov_support a static dep
This made it easier to run libkeymint_remote_prov_support_test.

Bug: 264302050
Test: atest libkeymint_remote_prov_support_test
Change-Id: Ided4e9bb442274ea7711d283bc947c35f34ebc35
2023-01-13 18:30:40 +00:00
Daniel Angell
eacb1c16f1 Add ro.serialno sysprop to JSON output
To help with error reporting on the RKP servers in the future it
will be helpful to be able to address CSRs by serial number when
possible.

Bug: 264302050
Test: libkeymint_remote_prov_support_test and sent JSON to server
Change-Id: I2808441c200d0679e618580abc464cd3c71c220e
2023-01-13 18:30:38 +00:00
David Drysdale
3d2ba0a137 Add check_feature helper
Test: VtsAidlKeyMintTargetTest
Change-Id: I4a5b2a41172c15ae29efb5b177eb86cea5527b4e
2023-01-11 13:27:30 +00:00
Seth Moore
bbee0080d9 Fix test assumption for KeyMint+RKP integration
It's not enough to verify that the system is running KeyMint 2+. We
also need to verify that the vendor partition has RKP support.

Since VSR 13+ requires KeyMint 2+, change the test assumption so that
we don't run the test against systems that may have shipped with an
older VSR chipset (which won't support RKP).

Bug: 263844771
Test: VtsAidlKeyMintTargetTest (on old and new device)
Change-Id: Iac15f69db1152851f5a92d3929cb258b1b1a6b02
2023-01-03 14:19:16 -08:00
David Drysdale
3d40abfec8 Merge "KeyMint manual key upgrade tests" 2023-01-03 14:19:04 +00:00
David Drysdale
9f5c0c5734 KeyMint manual key upgrade tests
Test: VtsAidlKeyMintTargetTest
Change-Id: I95d74cec80e94da316dab02b7a88b855742c877c
2022-12-19 15:52:52 +00:00
Prashant Patil
8d779bf29e Keystore: Attestation fix in AOSP builds
Alternet device properties used for attestation on AOSP and GSI builds.
Attestation ids were different in AOSP/GSI builds than provisioned ids
in keymint. Hence additional properties used to make these ids identical
to provisioned ids.

Bug: 110779648
Bug: 259376922
Test: atest VtsAidlKeyMintTargetTest:PerInstance/NewKeyGenerationTest#EcdsaAttestationIdTags/0_android_hardware_security_keymint_IKeyMintDevice_default
Test: atest VtsAidlKeyMintTargetTest:PerInstance/NewKeyGenerationTest#EcdsaAttestationIdTags/1_android_hardware_security_keymint_IKeyMintDevice_strongbox
Test: atest CtsKeystoreTestCases:android.keystore.cts.KeyAttestationTest CtsKeystoreTestCases:DeviceOwnerKeyManagementTest

Change-Id: I4bb2e2ebba617972e29ad86ea477eb9b6f35d21a
2022-12-15 15:32:06 +00:00
Eran Messeri
b9346f5146 Enforce KeyMint v3 for VSR level 14
Enforce that devices shipped with VSR-14 chipsets have KeyMint 3.

Bug: 251242992
Bug: 251510880
Test: atest VtsAidlKeyMintTargetTest
Change-Id: I21716ce02772266ce414c213a199c838cb2ef28a
2022-12-15 14:59:52 +00:00
Seth Moore
7dc1fda7a4 Enable RKP+KeyMint integration test
This integration was technically a requirement on keymint v2, but we
weren't enforcing it with a test. So realistically we are only able
to start enforcing the test with keymint v3.

Test: atest VtsAidlKeyMintTargetTest
Change-Id: Ia4feb8ce4b7fd1e47a5c6c9b06ddb12276a9c5ee
2022-12-13 13:25:32 -08:00
Seth Moore
8f810b1303 Move remotely provisioned component tests to rkp directory
Now that the RKP HAL AIDL has been moved to it's own directory, we
should keep the tests with the AIDL.

Test: atest VtsAidlKeyMintTargetTest
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: Ia87d3ea0a1b9e6704f0dea8f98b0bbaa049472fe
2022-12-13 11:03:59 -08:00
Eran Messeri
b0f54da729 Update the KeyMint feature version to 300
As we've updated the KeyMint version to 3, update the default feature
version to 300. That allows external developers to tell which KeyMint
version is running on the device.

Bug: 244732345
Test: atest android.keystore.cts.DeviceOwnerKeyManagementTest
Change-Id: I9b333eeb77a62a79e8e664d40b5564767643aa3d
2022-12-07 13:06:17 +00:00
Shaquille Johnson
a8ceb15747 Merge "Update keymint latest aidl for cpp version code" 2022-12-06 17:46:46 +00:00
Shaquille Johnson
b692c60e2a Update keymint latest aidl for cpp version code
This add a cpp default so that the latest cpp code can be
used across the codebase. When this is changed we dont
need to bump versions across multiple files and can just
change it in this one file.

Test: Run and tested using `atest keystore2_test` for Rust test and CTS test with `atest CtsKeystoreTestCases`
Bug: 244730020
Change-Id: Ifae1c5f2403210c2dec1bc337553fbbde73ed4c8
2022-12-01 17:49:04 +00:00
Tri Vo
b0b8acc849 Make IRPC v3 optionally backwards compatible
Specifically, we want IRPC v3 to be able to serve old v2 clients. This
way we can ship parts IRPC v3 stack incrementally.

To that end, allow IRPC v3 to implement v2 behavior of
generateCertificateRequest and testMode.

Bug: 260920864
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I9e47697bd948c8fd6b82147165d0c67bdef9fbd3
2022-11-30 16:30:31 -08:00
Max Bires
1589c401e0 Merge "Fix overly relaxed Device ID Test." 2022-11-28 20:15:13 +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
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
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
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
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
David Drysdale
7ea97a310a KeyMint HAL: reinstate tags in extension schema
Commit 93c72cef92 ("KeyMint: sync all attestation tags",
http://aosp/1719302) removed various tags from the attestation that are
only applicable to symmetric keys, on the assumption that these are
irrelevant for the attestation extension that is generated for the
certificate holding asymmetric public keys.

However, that change did not take into account the fact that the
AuthorizationList ASN.1 schema is re-used elsewhere in the KeyMint API,
specifically as a way of describing the characteristics associated with
a key that is being securely imported via
IKeyMintDevice::importWrappedKey.

That import process may be used for symmetrics keys, and so the tags
that are specific to symmetric keys still need to be included in
AuthorizationList.

Similarly, USER_SECURE_ID values are never included in attestation
extensions because they have no meaning off-device, but they may be
needed as part of the import of a wrapped key.

Test: TreeHugger, comment change only
Bug: 244693617
Change-Id: Iaa941e120e3641a6e6c369b7c6a51f10b44df78a
2022-09-02 17:08:04 +01:00
David Drysdale
4683a5383f KeyMint HAL: clarify obsolete tags
The tag enum names can't be removed due to AIDL back-compatibility
requirements, and also it's useful to have the values present to avoid
inadvertent reuse.

Update the tag comment text to indicate that these tags are obsolete.

Bug: 191738660
Test: TreeHugger, comment change only
Change-Id: Icbd4c9cd0313f93bc491b49eb9077766d0f44e34
2022-09-02 17:07:41 +01:00
Xin Li
28cde8fd22 Merge "DO NOT MERGE - Merge Android 13" 2022-08-16 19:11:03 +00:00
David Drysdale
b97121d8a5 KeyMint VTS: use SCOPED_TRACE on all loops
Also add a couple of nullptr checks

Test: VtsAidlKeyMintTargetTest
Change-Id: Ic95b16fc6307f3b97cc54dbf08f5726641a761d9
2022-08-12 11:54:46 +01:00
David Drysdale
e76000e09b Merge "Docs: return EARLY_BOOT_ENDED instead of INVALID_KEY_BLOB." am: 6796c8b5aa
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2160639

Change-Id: I038bf7c4590425e88e4611dd36f4f6f3a0e35c4f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 05:11:57 +00:00
David Drysdale
6796c8b5aa Merge "Docs: return EARLY_BOOT_ENDED instead of INVALID_KEY_BLOB." 2022-07-21 04:52:46 +00:00
Subrahmanyaman
0b9c196214 Docs: return EARLY_BOOT_ENDED instead of INVALID_KEY_BLOB.
All attempts to use an EARLY_BOOT_ONLY key after earlyBootEnded()
is called must fail with Error::EARLY_BOOT_ENDED.

Test: run vts -m VtsAidlKeyMintTarget
Change-Id: Ic3d028ceb7f71e6e266993ec4e877770cd8e5c4a
2022-07-20 17:26:12 +00:00
David Drysdale
ac42d60136 Merge "KeyMint HAL: clarify leaf cert requirements" am: 824c5d8f60
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2154073

Change-Id: Iaf833a5d576accb0fa104ce0e235e1c96b33c398
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-15 14:01:23 +00:00
David Drysdale
824c5d8f60 Merge "KeyMint HAL: clarify leaf cert requirements" 2022-07-15 13:37:19 +00:00
David Drysdale
26fd684e20 Merge "KeyMint: Test size requirements for ciphers" am: 96ed41b2e2
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2147675

Change-Id: I029f366281a868e0f92173a6f71afe8fe846adf9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-15 12:28:23 +00:00
David Drysdale
96ed41b2e2 Merge "KeyMint: Test size requirements for ciphers" 2022-07-15 12:10:10 +00:00
David Drysdale
9daf7c70a8 KeyMint HAL: clarify leaf cert requirements
Bug: 237624131
Bug: 238037309
Test: None, comment change
Change-Id: I7426deda8b0735f1ca34a22fc21ec0121a0fcca8
2022-07-14 17:39:42 +01:00
Prashant Patil
dd5f7f0e8d KeyMint: Test size requirements for ciphers
Test size requirements for symmetric (Stream and Block) ciphers.
These tests are similar to CTS tests of symmetric ciphers.
For reference CTS test BlockCipherTestBase#testKatEncryptOneByteAtATime
for all its derived classes eg. AES128CBCNoPaddingCipherTest,
AES128CBCPKCS7PaddingCipherTest etc.

Bug: 226899425
Test: run vts -m VtsAidlKeyMintTargetTest

Change-Id: I78408071fbf5a360d89c5bbae479faffd7c6d935
2022-07-13 12:36:22 +00:00
David Drysdale
0fdf10c4de Merge "KeyMint VTS: test default MGF_DIGEST behaviour" am: 5d88e95b36
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1888675

Change-Id: I3463a8111ccf186734cc325b7589fe688fb3b269
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-07 07:23:37 +00:00
David Drysdale
ae3727bf45 KeyMint VTS: test default MGF_DIGEST behaviour
KeyMint supports the specification of a separate MGF digest when
performing RSA-OAEP decryption, with a default value of SHA-1.

Test the expected behaviour here:
 - SHA-1 is used if nothing specified in key characteristics.
 - If something is specified in key characteristics, the operation
   parameter value has to be one of those values.

Bug: 203688354
Test: VtsAidlKeyMintTargetTest
Change-Id: Ic2dd3641be732a273724faa20cf4edf8a1752506
2022-07-06 12:26:37 +01:00
Xin Li
30f27895e3 Merge tm-dev-plus-aosp-without-vendor@8763363
Bug: 236760014
Merged-In: I2bddc0d13a4de6a5766de85fdf432fd05d84a581
Change-Id: I3f77dda59ac4ff05d0d59de68c7f0f96f5b61712
2022-06-28 21:23:27 +00:00
Treehugger Robot
a5468b5127 Merge "Verify that imported keys have the correct characteristics." 2022-06-27 20:58:16 +00:00
David Drysdale
46f99f4e9a Merge "KeyMint HALs: clarifications" 2022-06-27 12:01:14 +00:00
Seth Moore
2f2db81f7d Merge "Add an IRPC changelog." 2022-06-24 22:49:32 +00:00
Max Bires
9dce048421 Add an IRPC changelog.
This document is meant to provide a clear summation for vendors looking
for a reference of what has changed from release to release, as well as
documentation for those working on developing the
IRemotelyProvisionedComponent interface.

Bug: 227266513
Test: The document is readable.
Change-Id: I909e22a31a88856af911a80a52ec7eda263693db
2022-06-24 20:54:11 +00:00
David Drysdale
df427391cd Merge "KeyMint VTS: cope with ATTEST_KEY +/- SIGN" into tm-dev 2022-06-20 06:29:11 +00:00
David Drysdale
e9e12405f5 Merge "KeyMint VTS: cope with ATTEST_KEY +/- SIGN" am: 11cb564913 am: cbaede3f72
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2123433

Change-Id: I0b032b1072607db7fb1092d972c8c8b77bcc1a9b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-20 02:12:14 +00:00
Shawn Willden
fbb4cf383a Read VSR level from correct property. am: 35db349596 am: 4e97ec021e
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2128833

Change-Id: Ibd849ae5d7e2e40072f68e1f49446fe558fdf6a9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-20 02:12:05 +00:00
Jooyung Han
c3f8861bb8 Merge "Remove AIDL-libs from VNDK" 2022-06-20 01:15:09 +00:00
David Drysdale
8d925aee2d KeyMint HALs: clarifications
- Remove KeyPurpose comments that refer to public key operations.
 - Clarify/fix description of RSA_OAEP_MGF_DIGEST.
 - Describe HMAC key requirements.
 - Clarify RSA_PSS key length requirement
 - Clarify when shared secret should change (on restart)
 - Padding::NONE is not deprecated
 - Fix typos

Test: none, just comment changes
Change-Id: If58e8d8644aac926a990e50f7a873dca74cd4896
2022-06-17 09:25:32 +01:00
David Drysdale
11cb564913 Merge "KeyMint VTS: cope with ATTEST_KEY +/- SIGN" 2022-06-17 06:05:13 +00:00
Shawn Willden
e5364d7617 Read VSR level from correct property.
Bug: 235424890
Test: VtsHalKeymasterV4_0TargetTest & VtsAidlKeyMintTargetTest
Ignore-AOSP-First: Cherry-pick of aosp/2128833
Change-Id: I39109c097d129124097a303c3f108d015cb367e3
Merged-In: I39109c097d129124097a303c3f108d015cb367e3
2022-06-17 10:49:46 +09:00
Shawn Willden
35db349596 Read VSR level from correct property.
Bug: 235424890
Test: VtsHalKeymasterV4_0TargetTest & VtsAidlKeyMintTargetTest
Change-Id: I39109c097d129124097a303c3f108d015cb367e3
2022-06-17 10:49:29 +09:00
Treehugger Robot
ddc1e4c82d Merge "Add a README for Remote Key Provisioning." 2022-06-15 13:32:46 +00:00
Max Bires
82ed7a42c0 Add a README for Remote Key Provisioning.
This document goes a little more in depth on the motivating factors and
background mechanisms that occur with RKP, that are not appropriate for
direct inclusion in the HAL docs in the .aidl files.

Fixes: 234159998
Test: Readable
Merged-In: I141fb098c536a5468b1113af64dcf6185ea7ae9f
Change-Id: I141fb098c536a5468b1113af64dcf6185ea7ae9f
2022-06-15 05:29:22 -07:00
Jooyung Han
d81d6a12be Remove AIDL-libs from VNDK
Some are still in VNDK because they are used in other VNDK libs.

Bug: 234181591
Test: m
Merged-In: If999df9c78a20df931177da11742b1c5de19bc08
Change-Id: If999df9c78a20df931177da11742b1c5de19bc08
2022-06-14 16:42:42 +09:00
Jooyung Han
c0b24f4f13 Remove AIDL-libs from VNDK
Some are still in VNDK because they are used in other VNDK libs.

Ignore-AOSP-First: some libs are still in internal master only.

Bug: 234181591
Test: m
Merged-In: If999df9c78a20df931177da11742b1c5de19bc08
Change-Id: If999df9c78a20df931177da11742b1c5de19bc08
(cherry picked from commit 5527adfd7f)
2022-06-14 14:08:59 +09:00
David Drysdale
cdfb961585 KeyMint VTS: cope with ATTEST_KEY +/- SIGN
This change syncs aosp/master with the change in http://aosp/2117528,
allowing devices that launched with the (incorrect) version of
ATTEST_KEY VTS tests in Android S to continue to pass the test.

Bug: 197096139
Bug: 230074335
Test: VtsAidlKeyMintTargetTest
Change-Id: If88642e238e64ca9ec80303a4a72f7171c63464f
Merged-In: If88642e238e64ca9ec80303a4a72f7171c63464f
2022-06-13 12:06:41 +01:00
David Drysdale
4348927562 KeyMint VTS: cope with ATTEST_KEY +/- SIGN
This change syncs aosp/master with the change in http://aosp/2117528,
allowing devices that launched with the (incorrect) version of
ATTEST_KEY VTS tests in Android S to continue to pass the test.

Bug: 197096139
Bug: 230074335
Test: VtsAidlKeyMintTargetTest
Change-Id: If88642e238e64ca9ec80303a4a72f7171c63464f
2022-06-13 10:12:12 +01:00
TreeHugger Robot
668241010a Merge "Add a README for Remote Key Provisioning." into tm-dev am: 8c1586bc4f
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/18635577

Change-Id: Ic9d4911f335bc1e37651ec73bd1b231c7f180979
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-10 14:36:10 +00:00
TreeHugger Robot
8c1586bc4f Merge "Add a README for Remote Key Provisioning." into tm-dev 2022-06-10 13:29:11 +00:00
Max Bires
c08e808a78 Add a README for Remote Key Provisioning.
This document goes a little more in depth on the motivating factors and
background mechanisms that occur with RKP, that are not appropriate for
direct inclusion in the HAL docs in the .aidl files.

Bug: 234159998
Test: Readable
Change-Id: I141fb098c536a5468b1113af64dcf6185ea7ae9f
2022-06-10 04:52:27 -07:00
David Drysdale
87d139a9c0 Merge "KeyMint VTS: check chain size before dereferencing" am: 543eb71cb6 am: abe4c2ec93
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2119365

Change-Id: Ieab3232fa446187eb02832125a8900d2893ceab2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-09 06:06:03 +00:00
David Drysdale
a8a888ecf7 KeyMint VTS: check chain size before dereferencing
Test: VtsAidlKeyMintTargetTest
Change-Id: Id5ded31e1120e501dc5eb90b78cad1190a4c3042
2022-06-08 12:44:42 +01:00
TreeHugger Robot
d782e21332 Merge "Implement KeyMint2 test for VSR13" into tm-dev 2022-06-06 20:56:36 +00:00
Shawn Willden
cc6112be2b Implement KeyMint2 test for VSR13 am: 22fb9c16fc am: 8329536c7c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2115214

Change-Id: Iebc5b136b1710498009111e0d0b654b3dffca565
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-06 18:42:30 +00:00
Shawn Willden
8292bc9292 Implement KeyMint2 test for VSR13
Test: VtsAidlKeyMintTargetTest & VtsHalKeymasterV4_0TargetTest
Bug: 235099905
Ignore-AOSP-First: Cherry pick from aosp/2115214
Change-Id: Ie10b705bb06990a2a2c6223fcce28f5fde6bf3f3
Merged-In: Ie10b705bb06990a2a2c6223fcce28f5fde6bf3f3
2022-06-06 17:13:01 +00:00
Shawn Willden
22fb9c16fc Implement KeyMint2 test for VSR13
Test: VtsAidlKeyMintTargetTest & VtsHalKeymasterV4_0TargetTest
Change-Id: Ie10b705bb06990a2a2c6223fcce28f5fde6bf3f3
2022-06-06 09:10:17 -06:00
Shawn Willden
0ae6bb0656 Implement alternate SE RoT provisioning
Bug: 219076736
Test: VtsAidlKeyMintTargetTest
Change-Id: Ia696d7765f316d35eba1b4e65acae6c1072987b1
2022-06-02 07:44:23 -06:00
Treehugger Robot
fe0771581a Merge "Implement alternate SE RoT provisioning" am: f1a7cc01ea am: 9b3075bff9
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2032527

Change-Id: I4ac967ea61ddd019549755ef09fe82bc2ea67d61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-01 09:32:35 +00:00
Treehugger Robot
f1a7cc01ea Merge "Implement alternate SE RoT provisioning" 2022-06-01 08:47:51 +00:00
Shawn Willden
4315e135c6 Implement alternate SE RoT provisioning
Bug: 219076736
Test: VtsAidlKeyMintTargetTest
Change-Id: Ia696d7765f316d35eba1b4e65acae6c1072987b1
2022-05-31 14:14:54 -06:00
Tommy Chiu
ee70569078 Add EncryptionOperationsTest.AesCbcZeroInputSuccess
Check if the zero input data with AES-CBC-[NONE|PKCS7] padding mode
generates correct output data and length.

Bug: 200553873
Test: VtsHalKeymasterV4_0TargetTest, VtsAidlKeyMintTargetTest
Merged-In: I729c2bad65e9d8b194422032346e5ee3c4b0dce5
Change-Id: I729c2bad65e9d8b194422032346e5ee3c4b0dce5
2022-05-31 13:37:55 +01:00
David Drysdale
cb822166e7 KeyMint VTS: abandon tests when Begin fails am: 7fc26b99d3 am: 1eacf174b9
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2106464

Change-Id: I9383f156e0071a204ef7156dd40010b4ff39722a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-26 06:29:29 +00:00
David Drysdale
7fc26b99d3 KeyMint VTS: abandon tests when Begin fails
Test: VtsAidlKeyMintTargetTest
Change-Id: Id8bb29b3e2c3771d6033fe85c58c9cbd34e024fb
2022-05-25 15:34:05 +01:00
Seth Moore
97f58ffff5 Clean up description of IRemotelyProvisionedComponent uniqueId
The identifier is to be used in telemetry to identify problematic
implementations. Thus, it needs to be globally consistent, at least
within a given device type.

Test: None -- doc only changes
Bug: 231495834
Change-Id: Ia55db336fa099d8e1196f6bfe2bafb6fa5ead329
Merged-In: Ia55db336fa099d8e1196f6bfe2bafb6fa5ead329
2022-05-16 15:59:37 -07:00
Seth Moore
64dc27818d Clean up description of IRemotelyProvisionedComponent uniqueId am: 9b7f79cbf6
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/18360248

Change-Id: I8292a40b795dc2e4a62cc6f0f3199c82432661f6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-13 15:34:01 +00:00
Treehugger Robot
523741dded Merge "KeyMint: Test Ecdsa key generation without curve" am: cff8c9fb9e am: 75905a5f94
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2047463

Change-Id: Ib2d789288735c7e1b7a01b507d4515c44400ae1d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-13 10:58:49 +00:00
Treehugger Robot
cff8c9fb9e Merge "KeyMint: Test Ecdsa key generation without curve" 2022-05-13 09:56:16 +00:00
Seth Moore
9b7f79cbf6 Clean up description of IRemotelyProvisionedComponent uniqueId
The identifier is to be used in telemetry to identify problematic
implementations. Thus, it needs to be globally consistent, at least
within a given device type.

Test: None -- doc only changes
Bug: 231495834
Change-Id: Ia55db336fa099d8e1196f6bfe2bafb6fa5ead329
Merged-In: Ia55db336fa099d8e1196f6bfe2bafb6fa5ead329
2022-05-12 15:29:22 -07:00
Treehugger Robot
ebfaa65a1c Merge "Specify EcCurve when generating keys" am: a172a2309c am: 97a9abddd8
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2092349

Change-Id: I17f1c4017cd6d84944614c515fd60e68b133617f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-12 00:54:26 +00:00
Treehugger Robot
a172a2309c Merge "Specify EcCurve when generating keys" 2022-05-11 09:08:22 +00:00
David Drysdale
d30cd1cc6f Merge "KeyMint VTS: x25519 pubkey as SubjectPublicKeyInfo" am: 53cf63d1fd am: 0b4d491139
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2092269

Change-Id: Ia4c69e47ddf2f062672961c7a3bebb2185bd3cfd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-10 21:00:17 +00:00
David Drysdale
53cf63d1fd Merge "KeyMint VTS: x25519 pubkey as SubjectPublicKeyInfo" 2022-05-10 10:19:56 +00:00
Tommy Chiu
ec83644fab Specify EcCurve when generating keys
EC_CURVE is a mandatory tag which is specified in the keymint HAL when
generating EC keys.

Bug: 232056693
Change-Id: Ibe2b85744d7e555b7c7b48aa9e57ce45bb19ef89
2022-05-10 16:31:22 +08:00
Subrahmanyaman
812a9d10f9 Verify that imported keys have the correct characteristics.
Test: run vts -m VtsAidlKeyMintTarget
Change-Id: If7ab741bd05b41ffee422f98969b3bdff311f13c
2022-05-10 04:04:39 +00:00
Treehugger Robot
da91112339 Merge "Updated the description on Root of Trust Binding." am: 0ba8531279 am: f6c6fc7830
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2080599

Change-Id: Id7e9ffe8861b54363fc75afe3d86a4748fa4efad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-09 18:47:19 +00:00
Treehugger Robot
5d78414015 Merge "Update ProtectedData DKCertChain to use X.509" am: e003ed061b am: 2c2972a157
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2089226

Change-Id: Ia95b757401d196c49e8048039fbfc0152289f112
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-09 18:47:00 +00:00
David Drysdale
857158ba12 KeyMint VTS: x25519 pubkey as SubjectPublicKeyInfo
The data for a key agreement operation should always send in the
SubjectPublicKeyInfo structure, not a raw key for X25519.

Test: VtsAidlKeyMintTargetTest
Bug: 231959070
Change-Id: Ib5157da6a986d957162fab60dbe927017cfdd703
Merged-In: Ib5157da6a986d957162fab60dbe927017cfdd703
2022-05-09 17:47:11 +01:00
David Drysdale
a410b770e9 KeyMint VTS: x25519 pubkey as SubjectPublicKeyInfo
The data for a key agreement operation should always send in the
SubjectPublicKeyInfo structure, not a raw key for X25519.

Test: VtsAidlKeyMintTargetTest
Bug: 231959070
Change-Id: Ib5157da6a986d957162fab60dbe927017cfdd703
2022-05-09 17:38:35 +01:00
Treehugger Robot
0ba8531279 Merge "Updated the description on Root of Trust Binding." 2022-05-09 16:36:54 +00:00
David Drysdale
955b77be57 Merge "KeyMint VTS: skip device ID checks on GSI" into tm-dev 2022-05-09 05:15:34 +00:00
Seth Moore
2c6790fe53 Update ProtectedData DKCertChain to use X.509
This matches against what we're shipping in tm-dev.

Bug: 227350250
Test: N/A -- doc changes only
Change-Id: I3771c0fd45999e4204ba3964ed421641f02d6e7c
2022-05-06 10:04:15 -07:00
Seth Moore
1e8fc75bc0 Merge "Clean up keymint ProtectedData documentation" into tm-dev 2022-05-06 14:58:50 +00:00
David Drysdale
7288bce38b Merge "KeyMint VTS: skip device ID checks on GSI" am: 072c0b3ab6 am: d043e8b231
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2086983

Change-Id: I9ecbd80c5a1612ebe27fc47a08407871778d2fd1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-05 06:05:00 +00:00
David Drysdale
32a7bece10 KeyMint VTS: skip device ID checks on GSI
Bug: 229356841
Test: VtsAidlKeyMintTargetTest
Change-Id: I3182bad5584c35df7b1eeb476dabb39d19fdf12c
(cherry picked from commit 555ba00c0f)
Merged-In: I3182bad5584c35df7b1eeb476dabb39d19fdf12c
2022-05-05 05:34:59 +00:00
David Drysdale
072c0b3ab6 Merge "KeyMint VTS: skip device ID checks on GSI" 2022-05-05 05:27:34 +00:00
Seth Moore
b8f9efc5e7 Clean up keymint ProtectedData documentation
- Fix up some minor CDDL formatting issues.
- Add more definition around the BCC, hopefully clearing up partner
  confusion around how to implement it.
- Explain when BccPayload entries may be omitted in the case of a
  "Degenerate BCC"
- Add a bit more description to the DKSignature format

Bug: 227350250
Test: N/A -- doc changes only
Change-Id: I28337a80e2b49661cc37876400d7ac3b8759ba01
Merged-In: I28337a80e2b49661cc37876400d7ac3b8759ba01
2022-05-04 14:43:40 -07:00
David Drysdale
bebd9520db Merge "Run SecureElementProvision tests for KeyMint version >= 2." am: d347852bcc
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2051222

Bug: 230803681
Change-Id: I42b63bdea5fa0fb6c3a79e457f8bd63c6b346111
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
(cherry picked from commit 009d595c0f)
2022-05-04 17:04:38 +00:00
David Drysdale
c7588303b0 Merge "Run SecureElementProvision tests for KeyMint version >= 2." am: d347852bcc am: 009d595c0f
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2051222

Change-Id: I29a40ba3147873bc02a437478d257a5aa21b7699
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-04 10:24:39 +00:00
David Drysdale
d347852bcc Merge "Run SecureElementProvision tests for KeyMint version >= 2." 2022-05-04 09:48:48 +00:00
David Drysdale
b6e1609da1 Merge "Updated the description for APPLICATION_ID and APPLICATION_DATA" am: 6cd7c6295b am: de59134032
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2075380

Change-Id: Id72c336939ce5528d9438ba5b5b81ff9e9774b11
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-04 07:08:56 +00:00
David Drysdale
6cd7c6295b Merge "Updated the description for APPLICATION_ID and APPLICATION_DATA" 2022-05-04 06:03:50 +00:00
David Drysdale
555ba00c0f KeyMint VTS: skip device ID checks on GSI
Bug: 229356841
Test: VtsAidlKeyMintTargetTest
Change-Id: I3182bad5584c35df7b1eeb476dabb39d19fdf12c
2022-05-03 18:50:58 +01:00
Subrahmanyaman
5083a85141 Updated the description for APPLICATION_ID and APPLICATION_DATA
As the signature of the getKeyCharacteristics() does not
use Tag Mechanism for app_id and app_data, there is no way
to distinguish between appId / appData  values that are
absent, vs values that are present but of zero length. Due to
this limitation a key with a zero-length app_id / app_data
cannot have its key characteristics retrieved using
getKeyCharacteristics()

Test: VtsAidlKeyMintTarget
Change-Id: I145dcba878171c174d48ad42fadeb49e045b5c55
2022-05-02 23:28:12 +00:00
Seth Moore
76626c0bda Clean up keymint ProtectedData documentation am: 1d389acec8 am: 19eff513d4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2075940

Change-Id: Ic9334c1ab5fa1faadec1f399a70b86933d41ddd8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-29 19:20:00 +00:00
Subrahmanyaman
0f5953556c Updated the description on Root of Trust Binding.
The root of trust consists of a bitstring that must be derived
from the public key used by Verified Boot, from the lock state
and from the Verified Boot state of the device.

Test: VtsAidlKeyMintTarget

Change-Id: Ib20bf17066f087c6fc050a498cc7ed4a4cb08ae6
2022-04-29 02:39:11 +00:00
Seth Moore
1d389acec8 Clean up keymint ProtectedData documentation
- Fix up some minor CDDL formatting issues.
- Add more definition around the BCC, hopefully clearing up partner
  confusion around how to implement it.
- Explain when BccPayload entries may be omitted in the case of a
  "Degenerate BCC"
- Add a bit more description to the DKSignature format

Bug: 227350250
Test: N/A -- doc changes only
Change-Id: I28337a80e2b49661cc37876400d7ac3b8759ba01
2022-04-28 12:41:18 -07:00
Subrahmanyaman
4418984ab6 Run SecureElementProvision tests for KeyMint version >= 2.
Test: run vts -m VtsAidlKeyMintTarget
Change-Id: Icd2565170a473b539a1959042bbfa93e66947a69
2022-04-25 22:40:14 +00:00
Max Bires
d354a98041 Merge "Increase challenge size in tests." am: dcaa803893 am: a24527be86 am: 14bae2b195
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2066892

Change-Id: Iab5729979eef4a7e3d318f8c3fa816276442e5be
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-21 09:39:01 +00:00
Max Bires
89c7488370 Increase challenge size in tests.
VTS tests were currently passing a challenge size of 32 in all cases.
However, the server currently sends a challenge of length 40, which may
or may not change in the future. A 64 byte upper limit provides a
standard size along with flexibility in case the challenge format
changes in the future.

Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I678bb915f139e4c23354180870a66ce33a9cfd8c
2022-04-20 12:23:19 +00:00
David Drysdale
2c19304e56 Merge "Fix AES corrupt padding test" am: b474607b7c am: b661792d06 am: 2e449950d6
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2059787

Change-Id: I1a4bf228d73452cbc718ab126165bf09e0cdf833
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-11 13:16:23 +00:00
David Drysdale
b809329dc7 Fix AES corrupt padding test
The AesEcbPkcs7PaddingCorrupted test has been incorrect since it was
originally introduced -- it was feeding the original message as input to
the decryption operation, rather than the corrupted ciphertext.  As a
result, the expected error code was also wrong -- INVALID_INPUT_LENGTH
is appropriate for a too-short cipher text (length 1 in this case),
whereas a corrupt-but-correct-length cipher text should give
INVALID_ARGUMENT.

Fix the test, and add a separate test to cover what was inadvertently
being tested before. Add a sentence to the HAL spec to describe what
expected and tested by CTS/VTS.

Bug: 194126736
Test: VtsAidlKeyMintTargetTest, VtsHalKeymasterV4_0TargetTest
Change-Id: Iaa5e42768814197f373797831093cf344d342b77
2022-04-11 08:35:11 +01:00
Jiyong Park
7faedf81a0 Merge changes from topic "aidl_freeze_tm" into tm-dev
* changes:
  Implement getInterfaceHash/Version for SoundTrigger
  Add -Wno-missing-permission-annotation for soundtrigger3
  V3 is the latest version of keymaster HAL interface
  Freeze AIDL APIs for TM
2022-04-02 00:15:20 +00:00
Eran Messeri
f9b12ac72a Merge "KeyMint: Device IDs attestation based on verion." am: 1b7abc43b6 am: d8fdf0b804 am: 8adaed5f62
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2028224

Change-Id: I2937358195e0218cf7337b989686f649b7e82d22
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-03-31 14:53:49 +00:00
Prashant Patil
60f8d4d5b2 KeyMint: Test Ecdsa key generation without curve
Added new VTS EcdsaMissingCurve to test if EC_CURVE not specified while
generating new EC Key, keyGeneration should fail.

Bug: 225135360
Test: run vts -m VtsAidlKeyMintTargetTest
Change-Id: I32bbba05ed5203690292f7150d14f9644c4be6df
2022-03-31 10:26:51 +00:00
Jiyong Park
703e97920e Freeze AIDL APIs for TM
Bug: 225941299
Test: m
Change-Id: Ie41cc0797710f813f92c65c387f247c7806d8394
2022-03-31 12:01:39 +09:00
Prashant Patil
88ad189036 KeyMint: Device IDs attestation based on verion.
Updated VTS testcases where Device IDs Attestation expected as optional
and made it mandatory if KeyMint version >= 2 or device first shipped
with api_level 33.

Bug: 221190197
Test: run vts -m VtsAidlKeyMintTargetTest
Change-Id: I8870a9301d36abdc4fa6585b9f8d62cc1cfd3d96
2022-03-25 12:16:11 +00:00
Treehugger Robot
d31d3b8554 Merge "Updated the vts attestation tests for strongbox implementations which do not support factory attestation." am: 950b7b8026 am: cc399cf7b0 am: af1490f3f7
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2027803

Change-Id: I07f19f0c03955d3931842688d8a2ee31dbf174cf
2022-03-24 17:59:41 +00:00
Treehugger Robot
950b7b8026 Merge "Updated the vts attestation tests for strongbox implementations which do not support factory attestation." 2022-03-24 16:35:47 +00:00
subrahmanyaman
7d9bc46f6f Updated the vts attestation tests for strongbox implementations which
do not support factory attestation.

Bug: b/219962281
Test: Run vts tests.
Change-Id: Ie3f3f33f773227d879e11f11e2ef0eaee33db648
2022-03-23 22:27:05 +00:00
Treehugger Robot
0286ec5699 Merge "Fix CDDL for signatures." am: 1edd38d6ee am: 3303e97603 am: 08835aaa3d
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2036743

Change-Id: Iaf829618dc93488ac3db71e6c7bab37830295ea7
2022-03-22 17:41:54 +00:00
Treehugger Robot
1edd38d6ee Merge "Fix CDDL for signatures." 2022-03-22 16:50:39 +00:00
Alan Stokes
ba9f55ee69 Fix CDDL for signatures.
The signature is not CBOR-encoded, it's the raw bytes of the signature
encoded as specified for the specific algorithm.

I've made the references to PureEd25519() / ECDSA() into comments,
since I believe they're not actually legal CDDL but are aimed at
humans. And I've made the two occurrences consistent with each other.

Test: N/A
Change-Id: Ia42362ff3d0ce5458322663256cbd34d258afe76
2022-03-22 15:23:13 +00:00
David Drysdale
895ae687e6 Merge "KeyMint VTS: strict test only for v2+" am: d057fc0cb6 am: 1f0d75f1f8 am: 3056221f7c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2033925

Change-Id: I2783a11812212640bbca13a8fd0faadba57e7103
2022-03-22 10:25:29 +00:00
David Drysdale
f371c5eac7 Merge "KeyMint HAL: clarify ATTEST_KEY is like SIGN" am: afa73442b7 am: bbbc278300 am: be65672ee4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2033928

Change-Id: I49d1939007b771ad90fed66b475d3034272ff291
2022-03-22 10:25:12 +00:00
David Drysdale
d057fc0cb6 Merge "KeyMint VTS: strict test only for v2+" 2022-03-22 09:28:52 +00:00
David Drysdale
afa73442b7 Merge "KeyMint HAL: clarify ATTEST_KEY is like SIGN" 2022-03-22 09:26:41 +00:00
Max Bires
c8d296af83 Merge "More canonicalization checks and canonicalize before signing" am: cf02e97946 am: 8daddefc18 am: 59624afdce
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2029343

Change-Id: Ia1ceaa34fdbcf2d20690e1cc447321bdf3b40856
2022-03-21 17:35:21 +00:00
David Drysdale
bcb2f73475 KeyMint HAL: clarify ATTEST_KEY is like SIGN
Bug: 221280929
Test: None, comment change only (already assumed by VTS tests)
Change-Id: Ifc077c6ce1a89164b0d7c70c6e3353d941eee670
2022-03-21 17:14:59 +00:00
Max Bires
cf02e97946 Merge "More canonicalization checks and canonicalize before signing" 2022-03-21 16:33:20 +00:00
David Drysdale
50a66b8f79 KeyMint VTS: strict test only for v2+
Bug: 223537775
Bug: 197096139
Test: VtsAidlKeyMintTargetTest
Change-Id: Ib77d52e4a91233c936b3a44f5eac71f53b2af450
2022-03-21 15:29:00 +00:00
Max Bires
e74f0bc950 More canonicalization checks and canonicalize before signing
This change makes sure the DeviceInfo CBOR map is canonicalized before
the signature check instead of just separately checking the
canonicalization in a separate call. Additionally, some ASSERTs have
been changed to EXPECTs in validation of the DeviceInfo map more
generally, where it makes sense to avoid failing immediately.

Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I69806c887656772ea6b5e2e3f0af50957e6b05e3
2022-03-21 05:19:15 +00:00
Tri Vo
06d5f095be Merge "KeyMint VTS: Expect empty key if boot state unverfied" am: a26f8cb316 am: 39f920bae3 am: c18ed24712
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2014678

Change-Id: I877572dcb311c4c83f4effb4e0dbdec38ebee5bc
2022-03-18 18:56:57 +00:00
Tri Vo
a26f8cb316 Merge "KeyMint VTS: Expect empty key if boot state unverfied" 2022-03-18 18:14:31 +00:00
David Drysdale
c2387a1d5a Merge "Revert "KeyMint VTS: add TEST_MAPPING"" am: 83e3bffe66 am: 0918368cf8 am: 85b06d9590
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2028363

Change-Id: Ife7fefb8c11e694a0a36340ddab12851e34ce09d
2022-03-16 12:54:23 +00:00
David Drysdale
83e3bffe66 Merge "Revert "KeyMint VTS: add TEST_MAPPING"" 2022-03-16 11:43:55 +00:00
David Drysdale
6288f4bbb9 Revert "KeyMint VTS: add TEST_MAPPING"
This reverts commit 7e71fcf852.

Reason for revert: failing tests on git_master on aosp_x86_64-userdebug

Bug: 224951152
Bug: 224951969
Bug: 224950581
Change-Id: I86ae5e8d73cefd6d9d923138384cf98ec80a42df
2022-03-16 11:34:44 +00:00
David Drysdale
c477499208 Merge "KeyMint VTS: add TEST_MAPPING" am: 7f366ab5dd am: 4c1b6dfb23 am: 36f58e6c98
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1879916

Change-Id: Ic2d9051445575fce6e451d9919d07a4fd42d3211
2022-03-16 08:06:38 +00:00
David Drysdale
7f366ab5dd Merge "KeyMint VTS: add TEST_MAPPING" 2022-03-16 06:49:19 +00:00
David Drysdale
836e79fb72 Merge "Prevent test crashes if device sets invalid curve" am: ceedbb0d1a am: cd2af34d63 am: 590665c1b9
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2020155

Change-Id: I21eff3e3f3af55b2041b739dc7e0d8342df25599
2022-03-15 08:53:59 +00:00
David Drysdale
ceedbb0d1a Merge "Prevent test crashes if device sets invalid curve" 2022-03-15 07:35:02 +00:00
David Drysdale
79972e7645 Merge "Key{Mint,Master} VTS: fix incremental AES tags" am: e5c2bf01fc am: 523b300da7 am: a219992eef
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2020421

Change-Id: I771b72b5f4f439c8b6eea264010b90f0efa876a8
2022-03-14 17:02:36 +00:00
David Drysdale
e5c2bf01fc Merge "Key{Mint,Master} VTS: fix incremental AES tags" 2022-03-14 15:45:28 +00:00
David Drysdale
1a637199e4 Key{Mint,Master} VTS: fix incremental AES tags
Change Id62fdce65131ee00c88e5849955a937f1c171748 split up the AES
incremental encryption tests into individual tests for each encryption
mode.  This meant that each generated key is only valid for a single
mode, which in turn means that for non-GCM mode keys it is not valid
to specify MIN_MAC_LENGTH.

Bug: 223934835
Test: VtsAidlKeyMintTargetTest
Change-Id: I38f34f60116bde3d23f203365d62e5b25d7b254b
2022-03-14 09:23:29 +00:00
Treehugger Robot
0b549805f9 Merge "remote_prov_utils: Add instance name in the JSON output" am: 3192a09b11 am: a91e17ed66 am: 6cc8d07a64
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2017795

Change-Id: I3d2764f804934140791824c2a747aced9b0199f8
2022-03-11 14:23:18 +00:00
Treehugger Robot
3192a09b11 Merge "remote_prov_utils: Add instance name in the JSON output" 2022-03-11 12:48:19 +00:00
Eran Messeri
059a030d48 Merge "Update the default KeyMint version" am: 7fc756ee1a am: e3e82c9d53 am: d6ef5852b5
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2020439

Change-Id: I667fba98f44d4f2b6d8e7d7487c83fd83e78e2a9
2022-03-11 00:26:17 +00:00
Eran Messeri
bf89c797d0 Update the default KeyMint version
As the current KeyMint version is 2 (200), reflect that in the default
XML.

Devices that ship with older KeyMint/KeyMaster version should override
the default android.hardware.hardware_keystore.xml file with the
version they support.

Test: android.keystore.cts.KeyAttestationTest#testAttestationKmVersionMatchesFeatureVersion
Bug: 222406513
Bug: 216543583
Change-Id: I6f2229019929cff747cec3907fc2a9b8ebebdcf4
2022-03-10 19:16:39 +00:00
David Drysdale
08696a7543 Prevent test crashes if device sets invalid curve
Test: VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: Ib623b3dcdd5a496b34314c1e0d1a310c8beeb18d
2022-03-10 10:54:37 +00:00
Tommy Chiu
cb7d3d0759 remote_prov_utils: Add instance name in the JSON output
Bug: 223509807
Test: libkeymint_remote_prov_support_test
Change-Id: I45d2ee46f6fe3c8a7da55c7cc0b04fc007ddea43
2022-03-10 12:17:39 +08:00
David Drysdale
824f48e621 KeyMint VTS: check for relevant devices am: 1585fdceb5 am: 4e3b4590c9 am: b96f3a4099
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2013077

Change-Id: I593e54aff83abc22b3749075b114595363af8e4d
2022-03-09 11:24:52 +00:00
Tri Vo
af2914162f KeyMint VTS: Expect empty key if boot state unverfied
Bug: 221128605
Test: VtsAidlKeyMintTargetTest
Change-Id: Icbf0ccf57245b2eef559a119087e15cd883239f5
2022-03-08 10:06:06 -08:00
David Drysdale
1585fdceb5 KeyMint VTS: check for relevant devices
Don't run tests if the appropriate KeyMint device is not available (e.g.
on something that only has Keymaster).  Move to use GTEST_SKIP
consistently.

Bug: 221909227
Test: VtsAidlKeyMintTargetTest
Change-Id: I5dab238519e57e6752b795f3a983681cf4337bdd
2022-03-08 08:07:02 +00:00
Treehugger Robot
04fc0c4fb2 Merge "Split AESincremental VTS test into 4 Tests(For blockmodes-ECB,CBC,GCM,CTR)" am: 90019d46c2 am: bfdd991c76 am: 8be10ddce6
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2007030

Change-Id: Iffe169fcff0a11478672bf8f5895a93fcdcc9003
2022-03-04 18:50:47 +00:00
anil.hiranniah
19a4ca17ea Split AESincremental VTS test into 4 Tests(For blockmodes-ECB,CBC,GCM,CTR)
Change mentioned above is done in VTS for Keymaster4.0
and Keymint

Test: VTS tests with tradefed
Change-Id: Id62fdce65131ee00c88e5849955a937f1c171748
2022-03-03 18:02:04 +05:30
Treehugger Robot
4553efd422 Merge "Support for P256 curve in RKP for Strongbox Test: Run Rkp Vts tests." am: 55419fd935 am: 3b6c35b95e am: df05e41148
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1969799

Change-Id: I7a8bc93b7f4d8a391c86c1b9cc6f4bd88a9ee759
2022-03-02 12:53:20 +00:00
Treehugger Robot
55419fd935 Merge "Support for P256 curve in RKP for Strongbox Test: Run Rkp Vts tests." 2022-03-02 11:45:05 +00:00
David Drysdale
92ffa6384e KeyMint VTS: fix fixture setup name am: 795f758780 am: 85ce9e2530 am: 77a0eb6d63
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2003891

Change-Id: I10373d673da1d3d2e24cff7d28551b9f60eb0605
2022-03-01 17:05:16 +00:00