Commit graph

322 commits

Author SHA1 Message Date
David Drysdale
17393cbb40 Merge "KeyMint: new version number in attestation" 2021-12-16 09:37:15 +00:00
David Drysdale
7dff4fc9b7 KeyMint: new version number in attestation
For the time being, allow the version number in the attestation record
to be 100 even if the AIDL version is 2, so that implementations don't
have to update both versions simultaneously.

Bug: 194358913
Test: TreeHugger, VtsAidlKeyMintTargetTest
Change-Id: I9aae69327a62014e286ce30ca2a4d91c4c280714
2021-12-15 14:31:19 +00:00
David Drysdale
a67b0441fe Merge "KeyMint VTS: ATTEST_KEY has no other purpose" 2021-12-15 06:25:35 +00:00
Seth Moore
0834ba697f Merge "Revert^2 "KeyMint HAL: add curve 25519, bump version"" 2021-12-14 18:49:58 +00:00
Steven Moreland
ffb03995e6 CHECK -> CHECK_EQ copy pasta
Hey did I start this? We can take a little bit better errors. :)

Bug: N/A
Test: N/A
Change-Id: I0e96f7f49dae9968904333da9b8269694058c11c
2021-12-14 01:45:47 +00:00
Seth Moore
d79a0ec9ed Revert^2 "KeyMint HAL: add curve 25519, bump version"
e76045d7b0

Change-Id: Ia167fd45b6e590e34523810ee10118c5c141f538
2021-12-13 20:03:33 +00:00
David Drysdale
391a772300 Merge "Revert "KeyMint HAL: add curve 25519, bump version"" 2021-12-13 16:14:16 +00:00
David Drysdale
e76045d7b0 Revert "KeyMint HAL: add curve 25519, bump version"
Revert "Bump keystore2 AIDL API version 1->2"

Revert "Advertise support of KeyMint V2"

Revert submission 1900930-version-bump

Reason for revert: Broken build on sc-qpr1-dev-plus-aosp, b/210450339
Reverted Changes:
I42a9b854f:keystore2: cope with new curve25519 enum
I167d568d6:Bump keystore2 AIDL API version 1->2
I3a16d072e:Advertise support of KeyMint V2
Ibf2325329:KeyMint HAL: add curve 25519, bump version

Change-Id: I78d4b07c41aa6bfeb367b56a58deeac6adb6ec46
2021-12-13 16:01:21 +00:00
Eran Messeri
924613950c Merge "Keymint: Test that corrupting the signature for HMAC verification fails" 2021-12-13 15:51:33 +00:00
David Drysdale
f21e1a5c4a Merge "KeyMint HAL: add curve 25519, bump version" 2021-12-13 14:25:22 +00:00
David Drysdale
c069a75302 KeyMint HAL: add curve 25519, bump version
Marked as required for TRUSTED_ENVIRONMENT impls but not STRONGBOX.

Bump keymint HAL version 1->2 in defaults and in current compatibility
matrix.

Bug: 194358913
Test: build
Change-Id: Ibf2325329f0656a2d1fc416c2f9a74d505d0bf20
2021-12-09 14:07:51 -08:00
Prashant Patil
dec9fdc81d Keymint: Test that corrupting the signature for HMAC verification fails
A VTS test case to verify HMAC signature verification fails if data or
signature is currupted.

Bug: 209452930
Test: run vts -m VtsAidlKeyMintTargetTest
Change-Id: I2177fd99cfab4ef4a347d50461db0d2e3ad8c612
2021-12-09 13:41:30 +00:00
Brian J Murray
aa8a75840f Avoid SIGSEGV if attest key generation fails.
Add an explicit check that `attested_key_cert_chain.size() > 0`.

Bug: 209672758
Test: atest 'PerInstance/AttestKeyTest#AllEcCurves/1_android_hardware_security_keymint_IKeyMintDevice_strongbox'

Signed-off-by: Brian J Murray <brianjmurray@google.com>
Change-Id: I4f7cb4fb1a30f26e6ef15c54714699f6ae91ba36
2021-12-08 10:59:22 -08:00
David Drysdale
8aeb7ef2b4 Merge "KeyMint VTS: option to skip BOOT_PATCHLEVEL check" 2021-12-02 17:44:15 +00:00
David Drysdale
ddf63247e9 Merge "Use defaults to reference current keymint version" 2021-12-02 07:55:03 +00:00
David Drysdale
dbbbe2ea6d KeyMint VTS: option to skip BOOT_PATCHLEVEL check
The KeyMint spec requires that all generated keys include the
BOOT_PATCHLEVEL for the device.

However, the VTS test sometimes gets run in an environment where this
is not possible; specifically the Trusty QEMU tests don't have the
bootloader -> KeyMint communication that is needed to populate this
information.

Add a command line flag that disables checks for BOOT_PATCHLEVEL to
cope with these scenarios, making sure that it defaults to having the
checks enabled.

Test: VtsAidlKeyMintTargetTest
Change-Id: I215c8a18afbd68af199d49f74b977ad7cac6b805
2021-12-02 07:52:33 +00:00
Treehugger Robot
bb0ab83af8 Merge "KeyMint: Test invalid AES key sizes" 2021-12-01 13:48:57 +00:00
David Drysdale
a33f46bc2a Merge "Fix flaky corrupted padding tests" 2021-11-30 06:44:30 +00:00
David Drysdale
4c1f6ac496 Fix flaky corrupted padding tests
Transfer the fix in http://aosp/1745035 from the KeyMint VTS test back
into the keymaster VTS test.

Bug: 189261752
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I5f0a69255cfe980dd6e71fa29ff06a84cb668f6d
2021-11-29 16:17:11 +00:00
David Drysdale
49255346b4 Use defaults to reference current keymint version
The KeyMint HAL will soon be updated for a new version. To make this
process easier, add a cc_defaults and rust_defaults that references
the "current" version, and use this elsewhere. This should hopefully
mean that a future version bump only needs to happen in the defaults.

Test: TreeHugger
Change-Id: If7dd0c5778acb92177e16fd4fb4a04dcb837ad06
2021-11-22 16:13:08 +00:00
David Drysdale
4f51da1c9e Merge "KeyMint VTS: don't combine ATTEST_KEY with SIGN" 2021-11-19 07:53:34 +00:00
Prashant Patil
d72b35175f KeyMint: Test invalid AES key sizes
Added invalid AES key sizes to be tested for Default and TEE based
Keymint implementations.

Bug: 205679497
Test: run vts -m VtsAidlKeyMintTargetTest
Change-Id: Id9044cdc0324258c15f1daa81487c7819a780fe8
2021-11-16 15:58:09 +00:00
David Drysdale
13f2a40e44 KeyMint VTS: extra unique ID test
Test that specifying RESET_SINCE_ID_ROTATION results in a different
unique ID value.

Test: VtsAidlKeyMintTargetTest
Bug: 202487002
Change-Id: I2aed96514bf9e4802f0ef756f880cac79fa09554
2021-11-10 06:26:31 +00:00
David Drysdale
e60248c8e7 KeyMint VTS: ATTEST_KEY has no other purpose
The KeyMint spec has always required that keys with the ATTEST_KEY
purpose "must not have any other purpose".

Add explicit tests for combined-purpose keys to be rejected.

Also expand the spec text to require a specific error code, and to
explain the rationale for single-purpose ATTEST_KEY keys.

Bug: 197096139
Test: VtsAidlKeyMintTargetTest
Change-Id: I2a2014f0ddc497128ba51bb3f43671f759789912
2021-11-03 09:58:05 +00:00
David Drysdale
b3b121493d KeyMint VTS: don't combine ATTEST_KEY with SIGN
Update the VTS tests so that attestation keys are not created with
another purpose.

Bug: 197096139
Test: VtsAidlKeyMintTargetTest
Change-Id: Ib6e4ad98cbe5c3015138854679b11fa0e683ade9
2021-11-01 17:15:51 +00:00
David Drysdale
fa36259cb2 Consolidate OWNERS files
Have a single OWNERS file for everything under
hardware/interfaces/security

Test: TreeHugger
Change-Id: I1f15296edefda447916e9a3e8211e88ed8854f90
2021-11-01 08:42:42 +00:00
David Drysdale
1e3d97de43 Merge "KeyMint VTS: check INCLUDE_UNIQUE_ID works" 2021-10-29 13:49:07 +00:00
David Drysdale
565ccc70ed KeyMint VTS: check INCLUDE_UNIQUE_ID works
Bug: 202487002
Test: atest VtsAidlKeyMintTargetTest (on CF, O6)
Change-Id: I8bc674b47549aa1133f816c510289774db752e04
2021-10-29 14:39:12 +01:00
David Drysdale
153bbc9cc5 Merge "Specify KeyMint EC keys by curve not size" 2021-10-29 05:54:57 +00:00
Tommy Chiu
abcf89dd53 libkeymint_support: Make it vendor accessiable
This support function is supposed to be useable by vendor in treble.
Add "vendor_available" to reflect that.

Bug: 203481954
Test: Link by vendor successfully
Change-Id: I9709ac0ab79405c336ed8a1bc44b2ef643dd5b2d
2021-10-26 23:25:42 +08:00
David Drysdale
915ce253a8 Specify KeyMint EC keys by curve not size
Future addition of extra curves means that key size is not enough to
identify the particular EC curve required. Use the EcCurve enum instead.

Test: VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: Ia6b7d86a387cfc06db05e4ba6ff8f331e9c6345f
2021-10-14 15:38:38 +01:00
David Drysdale
f46b2d5402 Merge "KeyMint VTS: improve ATTESTATION_ID_ tests" 2021-10-14 13:33:41 +00:00
David Drysdale
c53b7d9da8 KeyMint VTS: improve ATTESTATION_ID_ tests
Existing comment is incorrect: the ATTESTATION_ID_* values that the test
provided are rejected because they do not match the device values, not
because the tags are specific to device-unique attestation.

Fix the test comment (and make the values more obviously wrong), and
add a separate test that includes correct values of ATTESTATION_ID_*
values.

Test: VtsAidlKeyMintTargetTest
Change-Id: I5c5f5ef6a228990c9e46f90727e0f135dfc2c528
2021-10-14 14:32:04 +01:00
David Drysdale
513bf12932 KeyMint VTS: use GTEST_SKIP for optional fn
When a KeyMint VTS exercises optional functionality, where possible
use GTEST_SKIP() when that functionality is absent, so the test
summary includes information about what is present and what isn't.

This should not affect the overall test result.

Test: VtsAidlKeyMintTargetTest
Change-Id: I62d244d2e4ecc67737906009575e64b50450d4c4
2021-10-12 07:22:28 +01:00
David Drysdale
4e9cab823d Merge "KeyMint VTS: don't crash on invalid patchlevel" am: e1152b6390
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1844900

Change-Id: I76b505672b7c78b03a9c79df6473212ea5c65072
2021-10-05 14:09:00 +00:00
David Drysdale
e1152b6390 Merge "KeyMint VTS: don't crash on invalid patchlevel" 2021-10-05 13:54:09 +00:00
David Drysdale
22a5ccd132 Merge "KeyMint VTS: enable patchlevel checks" am: 8fb4a1c82e
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1840175

Change-Id: I8b58efc55b884da16fe1312d571f42852ce642ff
2021-10-05 10:08:25 +00:00
David Drysdale
168228a933 KeyMint VTS: don't crash on invalid patchlevel
If vendor/boot patchlevel is shorter than the expected YYYYMMDD format,
fail properly rather than crashing the VTS test process.

Bug: 201946955
Test: VtsAidlKeyMintTargetTest
Change-Id: Icf3541e1b76675871672edec8590ec1821770acf
2021-10-05 08:56:39 +01:00
David Drysdale
f5bfa00996 KeyMint VTS: enable patchlevel checks
Believe that all KeyMint implementations are now in compliance with
the HAL specification and so we can enable the checks that all
generated keys include vendor and boot patchlevel.

Test: VtsAidlKeyMintTargetTest
Change-Id: I99741af308023fe12268e9875e252470fbaaaf9e
2021-09-27 17:30:41 +01:00
Treehugger Robot
77adb256eb Merge "Add logging to KeyCharacteristicsBasicallyValid" am: bd7df07b2a
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1818914

Change-Id: Iabd387ec94991d29e59cc739ea390a7ac67a1370
2021-09-21 05:47:22 +00:00
Treehugger Robot
bd7df07b2a Merge "Add logging to KeyCharacteristicsBasicallyValid" 2021-09-21 05:32:28 +00:00
David Drysdale
6715fad7d1 Disable KeyMint -> IRemotelyProvisionedComponent test am: 0fce69d05c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1673210

Change-Id: I85e4bb88f2204d4b9c5c4ad53c03a7f9d4f692b8
2021-09-08 19:55:38 +00:00
David Drysdale
0fce69d05c Disable KeyMint -> IRemotelyProvisionedComponent test
Not required yet.

Test: VtsAidlKeyMintTargetTest
Change-Id: Ie8fecc4ea4795d7fa4fd6bcf0e6d8013c15f50e5
Bug: 186586864
2021-09-08 17:36:17 +00:00
Seth Moore
2a9a00e385 Add logging to KeyCharacteristicsBasicallyValid
There are multiple ways this predicate can fail, so add some logging
statements when errors occur so that tests are easier to debug.

Test: VtsAidlKeyMintTargetTest
Change-Id: I49ec12271bdebeab3aa6b9c7ae5d491075b3b649
2021-09-03 10:09:20 -07:00
Max Bires
54ce425deb Change the language for SB AES key sizes am: b04c67a938
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1817585

Change-Id: I8c19f2a29486baee1723b57fb0d313199a978646
2021-09-03 07:31:26 +00:00
Max Bires
b04c67a938 Change the language for SB AES key sizes
This alters the HAL documentation to specify that StrongBox must ONLY
support AES 128 and 256 keys.

Bug: 191736606
Test: Read the documentation and confirm that it is clear.
Change-Id: I484d51700df28eb073b7928b6dc7a3b52c59caee
2021-09-01 23:24:01 -07:00
Max Bires
7db2454972 Merge "Revert "AesInvalidKeySize skip 192 on SB devices"" am: f970abe674
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1803229

Change-Id: Iba41af9658e056e59331fbf5799f21365d13723b
2021-09-01 08:34:29 +00:00
Max Bires
f970abe674 Merge "Revert "AesInvalidKeySize skip 192 on SB devices"" 2021-09-01 08:24:01 +00:00
Steven Moreland
4263d16fc6 keymint: use versions for imports am: f4562215b4
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/1814144

Change-Id: Ic63b7434cab87aae3768cc698dd1460019c6e89b
2021-08-31 17:09:34 +00:00
Steven Moreland
f4562215b4 keymint: use versions for imports
This makes sure that when developers add a new version of an interface,
or when interfaces are being frozen, the runtime/buildtime situation of
clients depending on those interfaces remains the same. This is required
for AIDL to continue working at scale.

Bug: 188871598
Test: build
Change-Id: I358c19c91e8b20d47967aa3b26a8aa5dd6a97ab6
2021-08-30 17:54:19 -07:00