Commit graph

253 commits

Author SHA1 Message Date
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
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
8e8698913a Merge "KeyMint VTS: allow for stricter SharedSecret impls" into sc-dev 2021-06-29 05:49:21 +00: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
56cdfbde56 Merge "KeyMint VTS: allow for stricter SharedSecret impls" am: f854cde530 am: a01b8259e3
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1749644

Change-Id: I840e0d5199e1735d25b52d584ef0187d34346d97
2021-06-28 17:32:53 +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
62272fc2f5 KeyMint VTS: allow for stricter SharedSecret impls
Bug: 192223752
Test: VtsAidlSharedSecretTargetTest
Merged-Ind: Iccf2d0fe2a2d10ad12269dfecf78ea1d831c3ad4
Change-Id: Iccf2d0fe2a2d10ad12269dfecf78ea1d831c3ad4
Ignore-AOSP-First: already merged in aosp/master
2021-06-28 18:02:36 +01:00
David Drysdale
f854cde530 Merge "KeyMint VTS: allow for stricter SharedSecret impls" 2021-06-28 17:01:22 +00:00
David Drysdale
d46d61efec KeyMint VTS: allow for stricter SharedSecret impls
Bug: 192223752
Test: VtsAidlSharedSecretTargetTest
Change-Id: Iccf2d0fe2a2d10ad12269dfecf78ea1d831c3ad4
2021-06-28 14:58:28 +01: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