Commit graph

366 commits

Author SHA1 Message Date
Shawn Willden
7b37dc5d9c Merge "Updates to KM4.1" 2020-01-21 21:18:21 +00:00
Shawn Willden
c0125fb930 Update Keymaster support lib OWNERS
Test:  VtsHalKeymasterV4_0TargetTest && VtsHalKeymasterV4_1TargetTest
Change-Id: Ibc719cdc4bd8821d67659eb6a2cf4d0094322322
Merged-In: Ibc719cdc4bd8821d67659eb6a2cf4d0094322322
2020-01-21 10:30:29 -07:00
Shawn Willden
f3d741744a Updates to KM4.1
This CL adds:

- The IDENTITY_CREDENTIAL_KEY tag.  This new tag is not actually used
  by Keymaster at all.  It's used by the new Identity Credential HAL in
  its key attestations, which use the Keymaster format and the Keymaster
  attestation key.

- A VerificationToken argument to deviceLocked, used for StrongBox
  implementations.

- Some error codes, including one to diagnose unprovisioned
  attestation keys/ids.

- Clarifications in the documentation.

Test: VtsHalKeymasterV41TargetTest
Change-Id: Iae7151e2d9b328dd73e5cd78e59687ef29bab4f0
Merged-In: Iae7151e2d9b328dd73e5cd78e59687ef29bab4f0
2020-01-17 15:52:07 -07:00
Wenhao Wang
a4bffdbeb0 Merge "Add TAG_MAC_LENGTH to EncryptionOperationsTest.AesWrongPurpose" 2020-01-06 18:22:49 +00:00
Treehugger Robot
0184f1836d Merge "Remove creation time checks." 2020-01-03 21:09:18 +00:00
Shawn Willden
534085b76a Remove creation time checks.
We should not be relying on the HAL service to add CREATION_TIME to
keys.  It was always intended to be an optional tag that could be
added by keystore, or maybe the caller of keystore.  One widespread
Keymaster implementation started adding it (somewhat erroneously) if
it wasn't provided, and it appears that this implementation's behavior
became assumed to be the required behavior.

Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I34267c4e1f59fd8ee5f898f8c746a7b49f4d74a5
2019-12-29 21:33:00 -08:00
Wenhao Wang
6008f37ae9 Add TAG_MAC_LENGTH to EncryptionOperationsTest.AesWrongPurpose
Without the setting of TAG_MAC_LENGTH, the test fails due to
MISSING_MAC_PURPOSE.

Bug: 145626599
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: Ic58411b86e07dfeeb78211abf9271ee995beabc9
2019-12-23 11:29:19 -08:00
Treehugger Robot
3702b15a2a Merge "Updating a public exponent check" 2019-12-19 15:28:33 +00:00
Max Bires
444468b3dd Updating a public exponent check
This is updating the public exponent being checked from 3 to 65537. The
test was updated to use the latter public exponent without the check
also being updated

Test: atest VtsHalKeymasterV4_0TargetTest
Change-Id: I55fa2e67c94f0c52a1d65644f16b5f703a661e00
2019-12-19 00:49:24 -08:00
Treehugger Robot
63cc8d12a5 Merge "Adding sanity check for VBMeta device state" 2019-12-19 08:43:15 +00:00
Dan Shi
3bacd7f634 Convert VtsHalKeymasterV*_0TargetTest to be parameterized test
Bug: 142397658
Test: atest VtsHalKeymasterV3_0TargetTest \
  VtsHalKeymasterV4_0TargetTest

Change-Id: I0fbda4d9ab810a4ef616f8741919c522d5d58cc0
2019-12-11 09:46:54 -08:00
Max Bires
3d5713851e Adding sanity check for VBMeta device state
This test should will flag builds running as eng or userdebug that
report back the device is locked during development. This will also
catch the case where the device is a user build but reporting that it
isn't locked. This should help to avoid instances in the future where
userdebug builds report a locked device in the VBMeta information.

This patch also does a little bit of cleanup of the surrounding VBMeta
checking code.

Test: atest VtsHalKeymasterV4_0TargetTest
Change-Id: I3b387ade5eeee6a68b9ff307e503417d264ecbfe
2019-12-09 15:01:29 -08:00
Max Bires
ee1ccd88ba Fixing RSA tests not using the correct exponent
The Keymaster 4.0 HAL specifies that the public exponent for RSA is F4
(2^16+1). There were a few tests still using 3 as the exponent. This
patch updates those incorrect exponents accordingly.

Bug: 143404829
Test: atest VtsHalKeymasterV4_0TargetTest
Change-Id: Ibc82a8a912bc5926bcdd544e0370e4185a888c0d
2019-12-03 09:45:39 -08:00
Rob Barnes
3f7f55b378 Merge "Added standalone benchmark for keymaster." 2019-12-02 22:13:23 +00:00
Steven Moreland
7696aa885f ./update-makefiles.sh, for union changes/memory
Many more types can be used in Java.

Bug: 143566068
Test: N/A
Change-Id: Ie18e1e0f9c22f2ea15b755df3b048c9d651c4945
2019-11-26 09:24:31 -08:00
Rob Barnes
f82aa5d4fe Added standalone benchmark for keymaster.
Test: Run benchmark
Bug: 139890773
Change-Id: I23c511b70bd27c58a188b5fc8ae690cdbb775dec
2019-11-25 21:16:01 +00:00
Shawn Willden
94ad891792 Add Keymaster 4.1
Note that CL is missing complete tests (what's included is just a
stub, really) and support library code.  All of that will come in
near-future CLs.  This CL omits them because they'll take time and
there's a need to unblock Keymaster 4.1 implementers now.

Bug: 140193672
Bug: 140192237
Bug: 140824829
Test: Will be in a future CL
Change-Id: I0e6e3a38356f0517158a10604b549415641ad1b9
2019-11-20 12:14:36 -07:00
Rob Barnes
0cd9dd3893 Merge "Added LargeFinishInput test" 2019-11-15 19:56:44 +00:00
Rob Barnes
f5fc7c640b Added LargeFinishInput test
This tests passing a large input to finish. This should either succeed
or fail with the right error code.

Test: Run new VTS test
Change-Id: Ic4ef90adc6274317796bbe752f95fc9efa5fdb07
2019-11-14 18:05:25 -07:00
Treehugger Robot
8fb7cbd26b Merge "Adding test to check another ASN.1 Encoding Case" 2019-11-14 21:54:44 +00:00
Max Bires
ff02baaca9 Adding test to check another ASN.1 Encoding Case
This test will check that the length of the attestation application id
field will be properly encoded in valid DER ASN.1 in cases where the
length is long enough to require extra bytes to encode. In those cases,
the encoding of that field should include:
-A byte to specify how many bytes are required to enumerate the length
-The bytes required to enumerate the length
-The actual data that follows

Bug: 142674020
Test: atest keymaster_hidl_hal_test
Change-Id: I6d162efa4c8c6e0922989e234d0377caf3c1758e
2019-11-12 09:35:18 -08:00
Max Bires
2cdc273e8f Removing invalid HMAC tests.
Per Keymaster 4.0 spec, TEE and StrongBox implementations are only
required to support HMAC keys between 64 and 512 bits in length.
StrongBox implementations additionally must not support anything larger
than 512 bits. The tests removed in this CL specified key sizes larger
than 512 bits.

Bug: 143404829
Test: m VtsHalKeymasterV4_0TargetTest && adb sync data && \
adb shell data/nativetest64/VtsHalKeymasterV4_0TargetTest/VtsHalKeymasterV4_0TargetTest

Change-Id: I96ee3a20b981c288d88366f536b9924f907268f3
2019-11-07 12:48:07 -08:00
Treehugger Robot
9756532b64 Merge "Adding jbires to VTS OWNERS" 2019-10-25 17:54:54 +00:00
Max Bires
a722ff42a9 Adding test to check that ASN.1 lengths are properly encoded
This test checks that length metadata for the ASN.1 encoding of
attestation application ids are correct. It generates an app id that
will have a length between 127 and 256, which should create an encoding
that requires two bytes of length metadata - one byte to specify how many
bytes are needed for the length, and one byte for the length.

Some implementations of keymaster only use one byte in this case, which
will fail on strict ASN.1 parsers.

Bug: 142674020
Test: m VtsHalKeymasterV4_0TargetTest && adb sync data \
&& adb shell data/nativetest64/VtsHalKeymasterV4_0TargetTest/VtsHalKeymasterV4_0TargetTest

Change-Id: I7dfc38a09247eb3cb237f33a202044668d15cbca
2019-10-16 15:21:14 -07:00
Janis Danisevskis
cf5d7e83fd Fix UB in class NullOr
NullOr now stores the references a pointers internally. This fixes UB
where the internal reference was initalized by dereferencing nullptr.

Test: Compiles
Bug: 121390225
Change-Id: I2073e5aeac401309aa63b08e05db3c467fab6b69
2019-10-10 09:21:18 -07:00
Treehugger Robot
772fb53999 Merge "Add Keymaster VTS tests for some AES cases:" 2019-10-02 07:04:26 +00:00
Rob Barnes
fd877b5479 Merge "Added VTS tests for clearing operation slots after service death." 2019-10-01 16:52:49 +00:00
Rob Barnes
8ddc1c700d Add Keymaster VTS tests for some AES cases:
1.  AES operation attempted with unauthorized purpose.
2.  AES-GCM encryption performed with different nonces, should
generate different ciphertexts.
3.  AES-GCM encryption decryption round trip with delays between
begin and update and finish.

Bug: 133258003
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: Ia8b4b4b317ecff51b18e64dfa3b84bf77475812d
2019-09-19 10:03:35 -06:00
Colin Cross
263d2df2c7 Use libcrypto_static instead of libcrypto
Replace libcrypto with libcrypto_static, which can be protected through
visibility to ensure only modules that don't affect FIPS certification
can use it.

Bug: 141248879
Test: m checkbuild
Change-Id: I8685cb06d15f3425eeb96d998ffda54c82dcd387
2019-09-18 11:07:09 -07:00
Rob Barnes
bd37c3bf35 Added VTS tests for clearing operation slots after service death.
BUG: b/139689895
TEST: Added VTS tests to keymaster_hidl_hal_test.cpp
TEST: Ran on emulator against soft keymaster::v4_0::ng
Change-Id: I6c682cafee65cf7ea426bd03865bf868586efc62
2019-09-10 21:14:14 +00:00
Steven Moreland
b3a4d3832e Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I075670b64eebbbbd6a6ae0e84ad51bf1c6f5ba36
2019-09-06 01:07:02 +00:00
Max Bires
dddf75c01b Merge "Adding testing functionality for TAG_ROLLBACK_RESISTANCE"
am: 28a7fed681

Change-Id: I48327bcf5effe56e5f57fa53092cde6c10c62ecd
2019-08-23 05:28:49 -07:00
Max Bires
b1b45ff81c Adding testing functionality for TAG_ROLLBACK_RESISTANCE
Due to changes in implementation between keymaster 3.0 and 4.0, rollback
resistance is now specified by the caller. This patch addresses that
inconsistency to make sure rollback resistance is properly tested. If
rollback resistance is supported by the hardware, then it will now be
tested.

Test: atest VtsHalKeymasterV4_0TargetTest
Change-Id: I21e8d1e66932ddfad2d42ce8a43591431f3ff284
2019-08-15 12:46:56 -07:00
Max Bires
a0a2e8a035 Adding jbires to VTS OWNERS
Added OWNERS entry for Keymaster 4.0 VTS changes.

Test: jbires can +2 changes in VTS
Change-Id: I152d1e9f6fa7a021caa83d4b74beddde03384331
2019-08-14 17:39:31 -07:00
Felix
37298a7616 Merge "Add interface info to .rc files"
am: 98d0f4d52c

Change-Id: Ie6cfbacd523c4b09f77bee3369ec8e88b3fa0419
2019-07-08 12:22:23 -07:00
nagendra modadugu
eec090610b Merge "keymaster: Relax testing under GSI" into qt-dev
am: d10841a83d

Change-Id: If435ebd75ee04f1f6ea6324437683713b85a613a
2019-06-29 12:03:43 -07:00
nagendra modadugu
f18a8328a1 keymaster: Relax testing under GSI
GSI images do not have AVB verification enabled and therefore lack
several properties the keymaster HAL test depended on.  Selectively
disable those parts of the test that would fail with AVB verification
disabled.  Also disable date format checks under GSI.  When invoked from
GSI the TEE-backed keymaster doesn't use the correct date format.

Bug: 130843899
Test: VtsHalKeymasterV4_0TargetTest
Exempt-From-Owner-Approval: change only affects VTS-on-GSI behavior
Change-Id: Idaafb7b515c41290c766a8132f35d498ca15f48a
2019-06-29 18:27:38 +00:00
Garret Kelly
72c4746cda Merge "Increase leniency of attestation record timestamps" into qt-dev
am: 6c4e33d079

Change-Id: I741568f862d553a92344618406f0fb2f7a3d46f5
2019-06-25 23:19:49 -07:00
Felix
551b8d15ce Add interface info to .rc files
Signed-off-by: Felix <google@ix5.org>
Change-Id: I6d70bbdb66c3dce280bf6908c3750316a6f6cf70
2019-06-25 20:00:07 +02:00
Garret Kelly
9c0a45795f Increase leniency of attestation record timestamps
The TEE keymaster has been seen to be almost a minute out of sync with
the host clock during attestation.  Increase the leniency window to two
minutes.

Bug: 134408892
Bug: 134408367
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: Ic256a939dcd7e7b108099cfcf237cacde8dde059
2019-06-24 23:28:52 +00:00
Max Bires
90cda58d54 Merge "Removing an extraneous test" into qt-dev
am: 16b2c77456

Change-Id: I2bd55543991178bf313996841e51aff838986a5c
2019-06-17 14:44:44 -07:00
Max Bires
cf9daece29 Removing an extraneous test
Test: VTS passes
Bug: 133316458
Change-Id: I98d73ff025515a89e2743ed20950c840aedb5114
(cherry picked from commit b28e69f37e)
2019-06-17 15:32:05 +00:00
Steven Moreland
10363938d7 Merge "listByInterface -> listManifestByInterface" am: 877c7f5ce1
am: 5427525c6b

Change-Id: I780f4cdd4c01b89af28d81c21111053ffdde99df
2019-05-16 18:18:41 -07:00
Xin Li
4b6ac97b7d Merge "DO NOT MERGE - Merge pie-platform-release (PPRL.190505.001) into master." 2019-05-17 00:58:07 +00:00
Steven Moreland
5427525c6b Merge "listByInterface -> listManifestByInterface"
am: 877c7f5ce1

Change-Id: I0cc69469c3804fd189e4f021a835c7c4f46879ab
2019-05-16 17:08:19 -07:00
Treehugger Robot
877c7f5ce1 Merge "listByInterface -> listManifestByInterface" 2019-05-16 23:25:19 +00:00
Matthew Maurer
d65e81b1fb Merge "Allow INVALID_INPUT_LENGTH for oversized messages" am: b397fc8e88
am: 6194c02c64

Change-Id: I24a72716540258f6e790464b2951537d5bbc92c4
2019-05-16 14:49:45 -07:00
Matthew Maurer
6194c02c64 Merge "Allow INVALID_INPUT_LENGTH for oversized messages"
am: b397fc8e88

Change-Id: Ia3e4641b9fa4936655da6db1d8def5f31cee6e06
2019-05-16 13:36:35 -07:00
Matthew Maurer
b397fc8e88 Merge "Allow INVALID_INPUT_LENGTH for oversized messages" 2019-05-16 19:06:39 +00:00
Matthew Maurer
0690156c0d Merge "Use SHA_2_256 for importWrappedKey" am: 0ce3156f97
am: b2a847aea7

Change-Id: Ib382c184dc01505819f16c86007ab5578f0574f4
2019-05-16 10:09:01 -07:00