Commit graph

322 commits

Author SHA1 Message Date
Max Bires
d067e790ab Revert "AesInvalidKeySize skip 192 on SB devices"
This reverts commit eb8b0577e8.

Reason for revert: Broke a different TEE implementation

Bug: 196922051
Change-Id: I9f136d237bd06bfe2a1cc29d11bb1fbe0b8ace5e
Merged-In: I9f136d237bd06bfe2a1cc29d11bb1fbe0b8ace5e
2021-08-20 07:30:36 +00:00
David Drysdale
5558b8ab1e KeyMint VTS: add missing purpose/algo am: ff81928532
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1799764

Change-Id: I612c9319f25432cdb66bea6afd0e81acc94246b9
2021-08-19 17:53:31 +00:00
David Drysdale
ff81928532 KeyMint VTS: add missing purpose/algo
Test was producing an invalid set of parameters in a different way than
intended.

Bug: 197222749
Test: VtsAidlKeyMintTargetTest
Change-Id: I07f706fec81d91e8eee9c0561428142559c54f12
2021-08-19 17:07:04 +01:00
Xin Li
e287df40b9 Merge sc-dev-plus-aosp-without-vendor@7634622
Merged-In: Ifa71accba7ecf2ab15980227a4413831cfceb187
Change-Id: I7fb44c6c578a51c8ad36649d20a46233fd9609ca
2021-08-14 06:30:57 +00:00
Max Bires
3828fb2214 Merge "AesInvalidKeySize skip 192 on SB devices" 2021-08-13 21:45:14 +00:00
Treehugger Robot
1758d3a4b6 Merge "Fix KeyDeletionTest.DeleteAllKeys" 2021-08-12 23:54:15 +00:00
Shawn Willden
9a7410e50d Fix KeyDeletionTest.DeleteAllKeys
Test failed to set default key validity, which caused keygen to fail.
Wasn't noticed because this test is typically disarmed.

Note:  This test will destroy all user data on the device (which is
why it is typically disarmed).

Bug: 187105270
Test: VtsAidlKeyMintTargetTest --arm_deleteAllKeys
Change-Id: I67e317fdfca15c95c6420918948d1416e97de482
Merged-In: I67e317fdfca15c95c6420918948d1416e97de482
2021-08-12 22:47:34 +00:00
David Drysdale
4ef503113e Merge "keymint/aidl/OWNERS: add drysdale@" 2021-08-12 13:03:57 +00:00
Max Bires
86edc262af AesInvalidKeySize skip 192 on SB devices
This change clarifies the language to specify that StrongBox devices
must only support key sizes of 128 and 256. Additionally, it changes the
new AesInvalidKeySize test to only enforce against StrongBox instances
on devices that launch on S or later, not previously launched devices.

Ignore-AOSP-First: CP to AOSP
Bug: 191736606
Test: Test passes on a StrongBox enabled device
Change-Id: I1a27a0d61e5247ad90c8f5b1423f2a1567016bac
2021-08-09 23:03:53 -07:00
David Drysdale
9e1c4c1486 Merge "KeyMint VTS: catch empty cert chains" am: 38fe3c5962 am: 675972efc4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1787827

Change-Id: I72b6768cf64237d1b61781429e691698dd8d42c8
2021-08-09 06:13:15 +00:00
David Drysdale
f126c22f29 keymint/aidl/OWNERS: add drysdale@
Test: none
Change-Id: Ib38b3d4e8e8a41f8bbe3a2c2ad6e53ba10ff8dfc
2021-08-06 18:39:39 +01:00
David Drysdale
a038695b21 KeyMint VTS: catch empty cert chains
Explicitly detect empty cert chains returned by GenerateKey rather
than crashing when trying to dereference the first entry.

Bug: 195605180
Test: VtsAidlKeyMintTargetTest
Change-Id: Idad2703b458952ff599c6ccdd04a941aef7aedde
2021-08-05 09:03:20 +01:00
Jiyong Park
48131c0ace Merge "Remove ndk_platform backend. Use the ndk backend." am: 2346a4c6b9 am: 4ef9aa49dc
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1778908

Change-Id: Ib35b7b0ddc0bebd0714d290b1ac2fab8d5a1893e
2021-07-28 12:39:05 +00:00
Jiyong Park
2346a4c6b9 Merge "Remove ndk_platform backend. Use the ndk backend." 2021-07-28 12:10:05 +00:00
Seth Moore
8ba6aebbfc Allow uninstantiated remote provisioning tests am: 8aee4a857c
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15404613

Change-Id: I06163220ac87ddca7e851ab17e43cb6945534a5b
2021-07-27 23:33:39 +00:00
Seth Moore
6305e23cd8 Allow uninstantiated remote provisioning tests
Not all devices have an IRemotelyProvisionedComponent HAL, so on those
devices 0 of the tests in VtsRemotelyProvisionedComponentTests will be
run.

Bug: 194770385
Test: Ran tests on two devices: one with and one without the HAL.
Change-Id: I8624096158f29058189dfab7cd876804ae178e60
Merged-In: I8624096158f29058189dfab7cd876804ae178e60
2021-07-27 14:51:10 -07:00
Seth Moore
8aee4a857c Allow uninstantiated remote provisioning tests
Not all devices have an IRemotelyProvisionedComponent HAL, so on those
devices 0 of the tests in VtsRemotelyProvisionedComponentTests will be
run.

Fixes: 194770385
Test: Ran tests on two devices: one with and one without the HAL.
Change-Id: I8624096158f29058189dfab7cd876804ae178e60
2021-07-27 14:20:17 -07:00
Jiyong Park
27f77fefd7 Remove ndk_platform backend. Use the ndk backend.
The ndk_platform backend will soon be deprecated because the ndk backend
can serve the same purpose. This is to eliminate the confusion about
having two variants (ndk and ndk_platform) for the same 'ndk' backend.

Bug: 161456198
Test: m
Change-Id: Ibe8beeaf0d1b33968fb782f1f70c17ae9e9bf871
2021-07-27 14:44:47 +09:00
Seth Moore
b9b87ab1c9 Add VtsRemotelyProvisionedComponentTests config
VtsHalRemotelyProvisionedComponentTargetTest was picking up the same
config file (AndroidTest.xml) as VtsAidlKeyMintTargetTest. When atest or
TF was used to run VtsHalRemotelyProvisionedComponentTargetTest, it
actually ran VtsAidlKeyMintTargetTest.

Add a separate test config file so that we run the correct test binary.

Test: atest VtsAidlKeyMintTargetTest
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Bug: 192824779
Change-Id: I7ba0f8d364690209722f9a06c6c0ce2957781beb
Merged-In: I7ba0f8d364690209722f9a06c6c0ce2957781beb
2021-07-21 09:26:34 -07:00
Seth Moore
a0130911dc Add VtsRemotelyProvisionedComponentTests config am: 643a794172
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15340045

Change-Id: I52c8625b1c9bcf503fa149265957ee509ca8a16a
2021-07-21 00:30:56 +00:00
Seth Moore
643a794172 Add VtsRemotelyProvisionedComponentTests config
VtsHalRemotelyProvisionedComponentTargetTest was picking up the same
config file (AndroidTest.xml) as VtsAidlKeyMintTargetTest. When atest or
TF was used to run VtsHalRemotelyProvisionedComponentTargetTest, it
actually ran VtsAidlKeyMintTargetTest.

Add a separate test config file so that we run the correct test binary.

Test: atest VtsAidlKeyMintTargetTest
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Fixes: 192824779
Change-Id: I7ba0f8d364690209722f9a06c6c0ce2957781beb
2021-07-20 15:47:03 -07:00
Seth Moore
b393b089c1 Don't fail if TAG_ALLOW_WHILE_ON_BODY is missing
The TAG_ALLOW_WHILE_ON_BODY authorization is not required to be
supported, and if it is not supported it's a noop. Don't expect the tag
to fail with UNSUPPORTED_TAG on devices that don't support it.

Test: VtsAidlKeyMintTargetTest
Bug: 192222727
Change-Id: I2e80ca59151e79f595a65cae94ac966b4ba7020d
Merged-In: I2e80ca59151e79f595a65cae94ac966b4ba7020d
2021-07-13 11:18:36 -07:00
TreeHugger Robot
d00211cd3e Merge "Don't fail if TAG_ALLOW_WHILE_ON_BODY is missing" into sc-dev am: eca569897a
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15263335

Change-Id: I3eed0c51d932524b9d374af5ae786cddf184b8a4
2021-07-13 17:49:45 +00:00
TreeHugger Robot
eca569897a Merge "Don't fail if TAG_ALLOW_WHILE_ON_BODY is missing" into sc-dev 2021-07-13 17:35:10 +00:00
TreeHugger Robot
f58618f851 Merge "KeyMint: Fix device-unique attestation chain specification" into sc-dev 2021-07-13 15:24:53 +00:00
Seth Moore
3dbdaa9717 Don't fail if TAG_ALLOW_WHILE_ON_BODY is missing
The TAG_ALLOW_WHILE_ON_BODY authorization is not required to be
supported, and if it is not supported it's a noop. Don't expect the tag
to fail with UNSUPPORTED_TAG on devices that don't support it.

Test: VtsAidlKeyMintTargetTest
Bug: 192222727
Change-Id: I2e80ca59151e79f595a65cae94ac966b4ba7020d
2021-07-12 15:10:40 -07:00
Seth Moore
19acbe9f66 Update KeyMint VTS tests with prod GEEK
Now that we have the production Google Endpoint Encryption Key, we can
update the tests to use the correct GEEK cert chain where applicable.

Test: VtsHalRemotelyProvisionedComponentTargetTest
Test: VtsAidlKeyMintTargetTest
Bug: 191301285
Change-Id: I84b557c6bad34741ffe6671fc941d9e266b73241
Merged-In: I84b557c6bad34741ffe6671fc941d9e266b73241
2021-07-09 13:17:24 -07:00
Seth Moore
aad945fce4 Update KeyMint VTS tests with prod GEEK am: 87eb1dd928
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15080864

Change-Id: Id79cf3bd491f66f22adfb34dfaee5881659197c6
2021-07-09 17:20:25 +00:00
Seth Moore
87eb1dd928 Update KeyMint VTS tests with prod GEEK
Now that we have the production Google Endpoint Encryption Key, we can
update the tests to use the correct GEEK cert chain where applicable.

Ignore-AOSP-First: No merge path to aosp, will manually merge
Test: VtsHalRemotelyProvisionedComponentTargetTest
Test: VtsAidlKeyMintTargetTest
Bug: 191301285
Change-Id: I84b557c6bad34741ffe6671fc941d9e266b73241
2021-07-09 08:47:54 -07:00
Eran Messeri
3e6c2ef9c8 KeyMint: Fix device-unique attestation chain specification
Fix the device-unique attestation chain specification: The chain should
have two or three certificates.
In case of two certificates, the device-unique key should be used for
the self-signed root.
In case of three certificates, the device-unique key should be certified
by another key (ideally shared by all StrongBox instances from the same
manufacturer, to ease validation).

Adjust the device-unique attestation tests to accept two or three
certificates in the chain.

Additionally, the current StrongBox KeyMint implementation can not yet
generate fully-valid chains (with matching subjects and issuers), so
relax that check.

Bug: 191361618
Test: m VtsAidlKeyMintTargetTest
Merged-In: I6e6bca33ebb4af67cac8e41a39e9c305d0f1345f
Change-Id: Iebefafe72148c919d10308eff7a19fc1bc40c619
2021-07-09 09:08:17 +01:00
Seth Moore
a62785d479 Merge "Add Attestation IDs State to DeviceInfo" into sc-dev am: e35b1427e6
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15098340

Change-Id: I1fa8d138ad6b9aa93d3b908e8b842aecc68b0b44
2021-07-08 23:19:05 +00:00
Seth Moore
6a1223f227 Add Attestation IDs State to DeviceInfo
We will use the 'Attestation IDs State' field in DeviceInfo to
determine whether a device is still provisionable or not. Once a
production device has left the factory, certain attestated device ids
should be fixed, and 'Attestation IDs State' should reflect this
by reporting "locked".

Remove stale, duplicated DeviceInfo description from ProtectedData.aidl

Test: None, just a doc change
Bug: 192017485
Change-Id: I4e0a840a8f415b3b410801805a158c46be30ec6a
Merged-In: I4e0a840a8f415b3b410801805a158c46be30ec6a
2021-07-08 16:05:41 -07:00
Seth Moore
e35b1427e6 Merge "Add Attestation IDs State to DeviceInfo" into sc-dev 2021-07-08 23:04:37 +00:00
Seth Moore
f594fce5dd Add Attestation IDs State to DeviceInfo
We will use the 'Attestation IDs State' field in DeviceInfo to
determine whether a device is still provisionable or not. Once a
production device has left the factory, certain attestated device ids
should be fixed, and 'Attestation IDs State' should reflect this
by reporting "locked".

Remove stale, duplicated DeviceInfo description from ProtectedData.aidl

Test: None, just a doc change
Bug: 192017485
Change-Id: I4e0a840a8f415b3b410801805a158c46be30ec6a
2021-07-08 12:47:42 -07:00
TreeHugger Robot
1e3ab5940f Merge "Add test ensuring that BCC keys not unique ids" into sc-dev 2021-07-08 17:15:27 +00:00
Seth Moore
17587b0183 Add test ensuring that BCC keys not unique ids
Get two test BCCs, then ensure that no repeated keys are found.

Ignore-AOSP-First: No merge path to AOSP, will manually port.
Bug: 192687735
Test: VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I48f86e7dfa9ab4bc6303a8d1b64ac7ca6ac76bbf
2021-07-08 15:54:52 +00:00
TreeHugger Robot
acce5d3c68 Merge "Use TagType constants" into sc-dev 2021-07-08 15:32:25 +00:00
Eran Messeri
befeda6b00 Use TagType constants
Now that the aidl compiler supports it, use constants from TagType to
indicate the type of each tag, rather than duplicating the values of
the constants.

Test: atest VtsAidlKeyMintTargetTest
Bug: 183737811
Merged-In: Ie8af1f00d04fa05c59cfc72692caecbcf2fae483
Change-Id: Ie62b6ee8a8ced05a870711073bb3be16931f3d4d
2021-07-08 10:45:10 +01:00
Eran Messeri
12ee28322d Annotate some TODOs
There are two tags that cannot be currently removed but should be
removed in KeyMint V2. Mark them as deprecated and point to the bug
for deletion.

Bug: 183737811
Test: That it compiles.
Change-Id: I98b96cc8c49eb339a998d0abed9216aa57f6b19f
Merged-In: I80ccaedeb777fdb249a8cb021db6628da32d6029
2021-07-08 10:42:13 +01:00
Eran Messeri
7050121408 Merge "KeyMint: Fix device-unique attestation chain specification" am: 9c3bd29cab am: e52c1bb007
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1757172

Change-Id: I39a7f8fea450bb6d3ba9020d9955de52e6c8ca45
2021-07-06 16:13:34 +00:00
Eran Messeri
9c3bd29cab Merge "KeyMint: Fix device-unique attestation chain specification" 2021-07-06 15:38:16 +00:00
Eran Messeri
3c8c7cdfa2 Merge "Annotate some TODOs" am: 302d29eb9b am: 0185ac7270
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1749641

Change-Id: Iec657494ec02a6eb8f9697161798e0fde206100e
2021-07-06 14:08:59 +00:00
Eran Messeri
302d29eb9b Merge "Annotate some TODOs" 2021-07-06 13:40:53 +00:00
Eran Messeri
03d7a1a4f3 KeyMint: Fix device-unique attestation chain specification
Fix the device-unique attestation chain specification: The chain should
have two or three certificates.
In case of two certificates, the device-unique key should be used for
the self-signed root.
In case of three certificates, the device-unique key should be certified
by another key (ideally shared by all StrongBox instances from the same
manufacturer, to ease validation).

Adjust the device-unique attestation tests to accept two or three
certificates in the chain.

Additionally, the current StrongBox KeyMint implementation can not yet
generate fully-valid chains (with matching subjects and issuers), so
relax that check.

Bug: 191361618
Test: m VtsAidlKeyMintTargetTest
Change-Id: I6e6bca33ebb4af67cac8e41a39e9c305d0f1345f
2021-07-06 14:32:16 +01:00
Eran Messeri
7c046786b8 Annotate some TODOs
There are two tags that cannot be currently removed but should be
removed in KeyMint V2. Mark them as deprecated and point to the bug
for deletion.

Bug: 183737811
Test: That it compiles.
Change-Id: I80ccaedeb777fdb249a8cb021db6628da32d6029
2021-07-06 10:46:57 +01:00
Seth Moore
9c59da828b Add ensuring that test BCC keys not unique ids am: 42c1133fed am: ea113e83c9
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1755320

Change-Id: I4965a2f30f3bbe4a86089808965c49fd443b8a5c
2021-07-06 07:04:58 +00:00
Seth Moore
42c1133fed Add ensuring that test BCC keys not unique ids
Get two test BCCs, then ensure that no repeated keys are found.

Bug: 192687735
Test: VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I48f86e7dfa9ab4bc6303a8d1b64ac7ca6ac76bbf
Merged-In: I48f86e7dfa9ab4bc6303a8d1b64ac7ca6ac76bbf
2021-07-02 15:58:26 -07:00
Seth Moore
8b78dc5031 Correct the description for getKeyCharacteristics
The description should note that keystore-enforced tags are not to be
returned. This is done so that the keymint implementation doesn't have
to bother keeping track of tags it's not repsonsible for dealing with.

Fixes: 192575557
Test: none (it's just a comment change)
Change-Id: I3ff94201c262a5071d271b150dbbf21888d678aa
Merged-In: I3ff94201c262a5071d271b150dbbf21888d678aa
2021-07-01 11:39:13 -07:00
Seth Moore
f4c8ff9bef Add a utility to JSON-format a CSR with build info
We need both the build fingerprint as well as the CSR when uploading
data to the APFE provisioning server. Add a utility function to format
the output as a JSON blob so that it may be easily collected in the
factory in a serialized data format, then later uploaded.

Test: libkeymint_remote_prov_support_test
Test: VtsAidlKeyMintTargetTest
Test: VtsHalRemotelyProvisionedComponentTargetTest
Bug: 191301285
Change-Id: I751c5461876d83251869539f1a395ba13cb5cf84
2021-07-01 10:17:28 -07:00
Treehugger Robot
0ab5ef3ff7 Merge changes from topic "rkp-factory-tool"
* changes:
  Add real GEEK for RKP factory enrollment
  Add a unit test for remote_prov_utils
2021-06-30 20:39:53 +00:00
Seth Moore
0611028bc4 Add a utility to JSON-format a CSR with build info am: 23f624599f
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15115450

Change-Id: I591dc34a4850ca8f40aa13026af1c62e421619ba
2021-06-30 19:29:28 +00:00
Seth Moore
23f624599f Add a utility to JSON-format a CSR with build info
We need both the build fingerprint as well as the CSR when uploading
data to the APFE provisioning server. Add a utility function to format
the output as a JSON blob so that it may be easily collected in the
factory in a serialized data format, then later uploaded.

Test: libkeymint_remote_prov_support_test
Test: VtsAidlKeyMintTargetTest
Test: VtsHalRemotelyProvisionedComponentTargetTest
Bug: 191301285
Change-Id: I751c5461876d83251869539f1a395ba13cb5cf84
2021-06-30 09:32:08 -07:00
David Drysdale
cb02ff3548 Merge "KeyMint HAL: clarify spec text" am: 17a0526b1e am: 575246020d
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1749620

Change-Id: I94c443b5e9cd495ccf1a95867cc19cc996b1307b
2021-06-28 17:33:09 +00:00
David Drysdale
382e34835d KeyMint HAL: clarify spec text
- Make clear that CERTIFICATE_NOT_{BEFORE,AFTER} must be specified for
   generating/importing asymmetric keys.
 - Fix enforcement level of Tag::UNLOCKED_DEVICE_REQUIRED.
 - Fix reference to exportKey() for Tag::STORAGE_KEY to mention
   convertStorageKeyToEphemeral instead.
 - Mark Tag::CONFIRMATION_TOKEN as deprecated.

Test: none, comment change
Bug: 188672564
Merged-In: I68727b024f6b6743403941763aefca64e3eb091a
Change-Id: I68727b024f6b6743403941763aefca64e3eb091a
Ignore-AOSP-First: already merged in aosp/master
2021-06-28 18:15:14 +01:00
David Drysdale
17a0526b1e Merge "KeyMint HAL: clarify spec text" 2021-06-28 17:14:23 +00:00
David Drysdale
5cf4a11c01 KeyMint HAL: clarify spec text
- Make clear that CERTIFICATE_NOT_{BEFORE,AFTER} must be specified for
   generating/importing asymmetric keys.
 - Fix enforcement level of Tag::UNLOCKED_DEVICE_REQUIRED.
 - Fix reference to exportKey() for Tag::STORAGE_KEY to mention
   convertStorageKeyToEphemeral instead.
 - Mark Tag::CONFIRMATION_TOKEN as deprecated.

Test: none, comment change
Bug: 188672564
Change-Id: I68727b024f6b6743403941763aefca64e3eb091a
2021-06-28 12:43:10 +01:00
Seth Moore
50d62b0b15 Add real GEEK for RKP factory enrollment
Include a unit test to verify the GEEK cert chain is valid.

Test: libkeymint_remote_prov_support_test
Bug: 191301285
Change-Id: Icf9cfa165fbccb24b36b03ff3ce729a7e9c44cfd
Merged-In: Icf9cfa165fbccb24b36b03ff3ce729a7e9c44cfd
2021-06-25 10:48:49 -07:00
Seth Moore
42a2f6b6e2 Add a unit test for remote_prov_utils
This functionality will be used for the factory tooling, so we should
test it. Additionally, some new functionality will soon be added, and
it also needs to be tested.

Test: libkeymint_remote_prov_support_test
Bug: 191301285
Change-Id: I6a8798fc4b09fff1e829185a4b9e471921e5d2a9
Merged-In: I6a8798fc4b09fff1e829185a4b9e471921e5d2a9
2021-06-25 10:48:33 -07:00
Seth Moore
6d716dafec Add real GEEK for RKP factory enrollment am: 415f0ce4fe
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15071133

Change-Id: I8e25143efcbf531d2a850df6366f85c81058f0eb
2021-06-25 16:10:11 +00:00
Seth Moore
3a6cb24f82 Add a unit test for remote_prov_utils am: 7a55bb5cf8
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15071132

Change-Id: I3ec55bda354af4cc3dd1deca74c38c734a1801d0
2021-06-25 16:10:10 +00:00
Treehugger Robot
3e00e71055 Merge "Fix flaky corrupted padding tests" am: b54aebc2d8 am: 03a6cfdc15
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1745035

Change-Id: I9e6d25ea0313c650c1c01bcb8254e97545ca5964
2021-06-24 21:36:54 +00:00
Treehugger Robot
b54aebc2d8 Merge "Fix flaky corrupted padding tests" 2021-06-24 21:17:33 +00:00
Seth Moore
7a55ae3ddc Fix flaky corrupted padding tests
It's possible that corrupted ciphertext decrypts just fine. e.g. the
output ends with "0x01".

However, the chances of this happening are relatively low
(roughly 1/256). Corrupt the ciphertext up to 8 times, ensuring that
the likelihood of multiple successful decryptions is so miniscule that
it's effectively impossible.

Test: Ran *PaddingCorrupted tests 50000 times
Change-Id: If40ecd7817819921c020ea9b86ada18c4c77ea55
2021-06-24 12:45:23 -07:00
Seth Moore
415f0ce4fe Add real GEEK for RKP factory enrollment
Include a unit test to verify the GEEK cert chain is valid.

Test: libkeymint_remote_prov_support_test
Ignore-AOSP-First: No merge path to aosp, will manually merge
Bug: 191301285
Change-Id: Icf9cfa165fbccb24b36b03ff3ce729a7e9c44cfd
2021-06-23 13:05:59 -07:00
Seth Moore
798188aba0 Remove ignoreSignature for cose signature checks
This flag is never used anywhere, so just remove it. When used, it would
bypass signature checks. This is something we generally don't want to
do, even in testing. So remove the flag so there's no temptation to use
it.

Bug: 190942528
Test: VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I0433c1eedc08e9a5a5ad71347154867dba61689e
Merged-In: I0433c1eedc08e9a5a5ad71347154867dba61689e
2021-06-22 18:32:56 -07:00
Seth Moore
7a55bb5cf8 Add a unit test for remote_prov_utils
This functionality will be used for the factory tooling, so we should
test it. Additionally, some new functionality will soon be added, and
it also needs to be tested.

Ignore-AOSP-First: No merge path to aosp, will manually merge
Test: libkeymint_remote_prov_support_test
Bug: 191301285
Change-Id: I6a8798fc4b09fff1e829185a4b9e471921e5d2a9
2021-06-22 17:54:34 -07:00
TreeHugger Robot
2105f08415 Merge "Remove ignoreSignature for cose signature checks" into sc-dev am: 1aa95b63d0
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/15016110

Change-Id: I893a697010077fdc99c225a8178665d94e5c0ffb
2021-06-22 17:44:38 +00:00
TreeHugger Robot
1aa95b63d0 Merge "Remove ignoreSignature for cose signature checks" into sc-dev 2021-06-22 17:21:13 +00:00
Alan Stokes
adb7159de8 Merge "Allow CompOS APEX to access Keystore AIDL." am: fd7eeeaa1d am: 2a77df8a86
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1741123

Change-Id: Ic575adc36112cccc34bc3f5d959c401a9513aedf
2021-06-22 08:39:19 +00:00
Alan Stokes
fd7eeeaa1d Merge "Allow CompOS APEX to access Keystore AIDL." 2021-06-22 08:13:11 +00:00
David Drysdale
308916bfaf KeyMint VTS: require curve for ECDSA keys
The KeyMint AIDL spec requires that "Tag::EC_CURVE must be provided to
generate an ECDSA key". Move the VTS tests to always create ECDSA keys
by curve not key size.

Bug: 188672564
Test: VtsAidlKeyMintTargetTest
Merged-In: I33036387c243b21ab0ecd49221b7e7757598913e
Change-Id: I33036387c243b21ab0ecd49221b7e7757598913e
Ignore-AOSP-First: already merged in aosp/master
2021-06-21 07:14:05 +01:00
David Drysdale
924643748b KeyMint VTS: more attestation info tests
Try all tags in attestion extension one by one

Test: VtsAidlKeyMintTargetTest on CF
Bug: 186735514
Merged-In: I63ca8d298d2d16f707f2437ab48aaa69c1d7563d
Change-Id: I63ca8d298d2d16f707f2437ab48aaa69c1d7563d
Ignore-AOSP-First: already merged in aosp/master
2021-06-21 07:13:45 +01:00
David Drysdale
dfff9c74f1 Merge changes I33036387,I63ca8d29 am: aedb92d5af am: 5455f2dc13
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1740893

Change-Id: I64708a3f57a27daa694722d6019419371be22101
2021-06-21 05:53:21 +00:00
David Drysdale
aedb92d5af Merge changes I33036387,I63ca8d29
* changes:
  KeyMint VTS: require curve for ECDSA keys
  KeyMint VTS: more attestation info tests
2021-06-21 05:30:10 +00:00
Max Bires
2f87ec175f Merge "Updating CDDL schemas to match the finalized spec." into sc-dev 2021-06-21 02:11:39 +00:00
Treehugger Robot
82bbebdd13 Merge "Updating CDDL schemas to match the finalized spec." am: 11854c2d82 am: b8cf151c98
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1720450

Change-Id: I45e601192b1f05c794dea2cf61fa2668942a32a5
2021-06-18 14:56:06 +00:00
Treehugger Robot
11854c2d82 Merge "Updating CDDL schemas to match the finalized spec." 2021-06-18 14:32:25 +00:00
Eran Messeri
d26ffeca38 Merge "Remove KeyMint TODOs" am: 45e16a09ca am: 4d2be4b6a5
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1741125

Change-Id: I906ccb9f8d121af9235c4d8398e9170b4e19c581
2021-06-18 13:56:57 +00:00
Eran Messeri
45e16a09ca Merge "Remove KeyMint TODOs" 2021-06-18 13:28:25 +00:00
Eran Messeri
241295940e Merge "KeyMint: Document KeyCharacteristics" am: 30a6b0e7f0 am: cd489e35d3
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1736773

Change-Id: I0cf6aed6e658184e2a6c86a75c7ea96d74c2ef30
2021-06-18 13:04:59 +00:00
David Drysdale
df09e54ef3 KeyMint VTS: require curve for ECDSA keys
The KeyMint AIDL spec requires that "Tag::EC_CURVE must be provided to
generate an ECDSA key". Move the VTS tests to always create ECDSA keys
by curve not key size.

Bug: 188672564
Test: VtsAidlKeyMintTargetTest
Change-Id: I33036387c243b21ab0ecd49221b7e7757598913e
2021-06-18 13:52:47 +01:00
Eran Messeri
30a6b0e7f0 Merge "KeyMint: Document KeyCharacteristics" 2021-06-18 12:41:00 +00:00
Eran Messeri
2950654d44 Remove KeyMint TODOs
Remove TODOs from the KeyMint specification that were not concrete
enough or did not have enough context to act upon.

Bug: 183737811
Test: That it compiles.
Change-Id: I01899be5e65e9943053aa796a2ab23f1a783a1aa
2021-06-18 13:03:30 +01:00
Eran Messeri
58c8e39110 KeyMint: Document KeyCharacteristics
Document the various fields in KeyCharacteristics.

Bug: 183737811
Test: That it compiles.
Change-Id: I629001a3f5ac5d1e61ae6ffaa2702e3d32f56e52
2021-06-18 12:28:09 +01:00
Alan Stokes
e75851712b Allow CompOS APEX to access Keystore AIDL.
Makes the AIDL (and its dependencies) available to allow client code
to build against it.

Fixes: 190995136
Test: Client code (in progress) builds.
Change-Id: I06e7486463bca93ed25377c0dca30484a6bbf656
2021-06-18 10:21:36 +01:00
David Drysdale
37af4b3656 KeyMint VTS: more attestation info tests
Try all tags in attestion extension one by one

Test: VtsAidlKeyMintTargetTest on CF
Bug: 186735514
Change-Id: I63ca8d298d2d16f707f2437ab48aaa69c1d7563d
2021-06-18 07:45:27 +01:00
Seth Moore
474eee3351 Remove ignoreSignature for cose signature checks
This flag is never used anywhere, so just remove it. When used, it would
bypass signature checks. This is something we generally don't want to
do, even in testing. So remove the flag so there's no temptation to use
it.

Ignore-AOSP-First: Will cherry-pick to AOSP
Bug: 190942528
Test: VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I0433c1eedc08e9a5a5ad71347154867dba61689e
2021-06-17 12:41:39 -07:00
David Drysdale
4b8360b45a KeyMint VTS: improve attestation tests am: 03346e175e
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/14964378

Change-Id: I5ab0bd80eab05bbd65d0ed9e6c4b580aaed80d49
2021-06-17 17:36:39 +00:00
David Drysdale
a676c3b4ef KeyMint VTS: improve attestation tests
Check that the various ATTESTATION_ID_* tags are included if they
have the correct value, and that keygen fails if they have an invalid
value.

Also update attestation tags to include vendor/boot patchlevel if
they're available. (They always should be, but fixing that is a
separate task.)

Bug: 190757200
Test: VtsAidlKeyMintTargetTest
Merged-In: Ibaed7364c6d08c0982e2a9fb6cb864ae42cf39fe
Change-Id: Ibaed7364c6d08c0982e2a9fb6cb864ae42cf39fe
2021-06-17 16:43:37 +01:00
David Drysdale
03346e175e KeyMint VTS: improve attestation tests
Check that the various ATTESTATION_ID_* tags are included if they
have the correct value, and that keygen fails if they have an invalid
value.

Also update attestation tags to include vendor/boot patchlevel if
they're available. (They always should be, but fixing that is a
separate task.)

Bug: 190757200
Test: VtsAidlKeyMintTargetTest
Change-Id: Ibaed7364c6d08c0982e2a9fb6cb864ae42cf39fe
2021-06-17 16:33:20 +01:00
Eran Messeri
afe9af040d Merge "Improve unique attestation docs & tests" into sc-dev 2021-06-17 15:00:15 +00:00
Eran Messeri
a9ce01cfed Improve unique attestation docs & tests
Improve the documentation and tests related to device-unique
attestation on StrongBox KeyMint devices:
* Test that the chain produced is exactly of length 2.
* Document how the chain needs to be structured.
* Explain the trust properties of the key used for the
  self-signed root.

Test: atest VtsAidlKeyMintTargetTest
Bug: 187803288
Ignore-AOSP-First: Already merged in AOSP
Merged-In: I09bb16d6938b567c114485d2df00bde9d3e1ccf9
Change-Id: Ib7efdd428ce5a2e14c281077e3a77048c9721702
2021-06-16 14:41:18 +01:00
David Drysdale
f164c06afb KeyMint VTS: extract full vendor patchlevel
The vendor patchlevel is YYYYMMDD not YYYYMM

Bug: 188672564
Bug: 186735514
Test: VtsAidlKeyMintTargetTest
Merged-In: Ia641f8eef84a85aec8f2a0551c192b6874301126
Change-Id: Ia641f8eef84a85aec8f2a0551c192b6874301126
Ignore-AOSP-First: already present in aosp/master
2021-06-16 08:58:54 +01:00
David Drysdale
511d9bcc28 Merge "KeyMint VTS: extract full vendor patchlevel" am: 52ce52fb1e am: 24babae302
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1719301

Change-Id: I336baca3387a2ee1329760b0d22a8912b7373786
2021-06-16 07:49:45 +00:00
David Drysdale
52ce52fb1e Merge "KeyMint VTS: extract full vendor patchlevel" 2021-06-16 07:17:27 +00:00
Eran Messeri
a40b84b49a Merge "Use TagType constants" am: 1e6730acec am: b2178bc9c9
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1737653

Change-Id: I7de0a984ee4f7d8c3a88eaf87fec594afc7902a2
2021-06-15 15:51:51 +00:00
Eran Messeri
a5047720f0 Use TagType constants
Now that the aidl compiler supports it, use constants from TagType to
indicate the type of each tag, rather than duplicating the values of
the constants.

Test: atest VtsAidlKeyMintTargetTest
Bug: 183737811
Change-Id: Ie8af1f00d04fa05c59cfc72692caecbcf2fae483
2021-06-15 14:26:59 +01:00
David Drysdale
9c7fae7e81 KeyMint VTS: extract full vendor patchlevel
The vendor patchlevel is YYYYMMDD not YYYYMM

Bug: 188672564
Bug: 186735514
Test: VtsAidlKeyMintTargetTest
Change-Id: Ia641f8eef84a85aec8f2a0551c192b6874301126
2021-06-15 13:12:07 +01:00
David Drysdale
fd5b1a6da8 KeyMint: sync all attestation tags
Get description of ASN.1 schema in HAL and the keymint support library
in sync with each other.  Change code to always list tags in the same
order (by numeric tag).

Bug: 188672564
Bug: 186735514
Test: VtsAidlKeyMintTargetTest
Merged-In: I620f54ba4a265ea69d174f6f44765a8508bfe803
Change-Id: I620f54ba4a265ea69d174f6f44765a8508bfe803
Ignore-AOSP-First: already merged into aosp/master
2021-06-09 09:10:33 +01:00
David Drysdale
a5af95bff3 Merge "KeyMint: sync all attestation tags" am: ba8e44599c am: 16d7e387a1
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1719302

Change-Id: I75004dbf0512fafea3396a2884f803faa7fd0828
2021-06-09 06:18:30 +00:00