Commit graph

398 commits

Author SHA1 Message Date
Shawn Willden
b26a225b9c Keymaster 4.1 VTS tests
Test:  VtsHalKeymasterV4_1TargetTest
Change-Id: I488402079ebb3940e021ac1558aeee15c4b133c9
2020-01-21 01:31:39 -07:00
Shawn Willden
0a6755018f Update KM4 VTS tests to allow s/w implementation to pass.
Although no real devices should have a software implementation,
emulator and cloud devices do, and it's useful to be able to use them
as a development platform, which is facilitated by having useful VTS
tests.

This is in preparation for Keymaster 4.1 implementation and VTS work.

Bug: 140193672
Bug: 140192237
Bug: 140824829
Test: VtsHalKeymaster4.0TargetTest
Change-Id: Idc5de13c342ef1ac62d3131a1a2185d5e78a0d45
2020-01-21 01:31:28 -07:00
Shawn Willden
13f4bf8491 Remove service death test.
Moving to KM4.1 VTS.

Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I8f2b7ab3305833fe8639fdefb9cc263f99684920
2020-01-21 01:31:16 -07:00
Shawn Willden
c78dc91896 Change finish input test to avoid large sizes.
We'll add a large-size test to the Keymaster 4.1 VTS tests.

Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I2460106cf918e44ea5eeac5c518a89c311756eb3
2020-01-21 01:24:16 -07:00
Shawn Willden
5e1347cedf Update Keymaster 4.0 VTS to use parameterized tests.
Bug: 139437880
Test: VtsHalKeyamsterV4_0TargetTest
Change-Id: I487000cc19fe355fdef88f1561a38b2cbfd3c3c3
2020-01-21 01:12:31 -07:00
Shawn Willden
2adf7fb2d5 Remove dependency on libsoftkeymaster.
This is part of a refactor to facilitate reuse in Keymaster 4.1 VTS
tests.

Bug: 140193672
Bug: 140192237
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I9310a851648c028850f9795d303419c6a7e29a11
2020-01-21 01:01:31 -07:00
Shawn Willden
2d7394209e 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
2020-01-17 12:53:42 -07:00
Automerger Merge Worker
9193bd3eae Merge "Add TAG_MAC_LENGTH to EncryptionOperationsTest.AesWrongPurpose" am: a4bffdbeb0 am: 336af5783c am: c4b764ca09
Change-Id: I2847afc7dffa74a30f99a73042c7a07bd768188b
2020-01-06 19:02:05 +00:00
Wenhao Wang
a4bffdbeb0 Merge "Add TAG_MAC_LENGTH to EncryptionOperationsTest.AesWrongPurpose" 2020-01-06 18:22:49 +00:00
Automerger Merge Worker
c6f6cc6240 Merge "Remove creation time checks." am: 0184f1836d am: 58a95666eb am: 0804118fd5
Change-Id: Idb23e003f85002890d423c4e79329990bf8cb3af
2020-01-03 21:34:37 +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
Automerger Merge Worker
418ddc1754 Merge "Updating a public exponent check" am: 3702b15a2a am: 42b6ecbd53 am: d680601c72
Change-Id: If2a31f11981f6c793efc70a739fe54160c4fc281
2019-12-19 17:10:39 +00:00
Automerger Merge Worker
1026f2c33f Merge "Adding sanity check for VBMeta device state" am: 63cc8d12a5 am: 051f044853 am: ff9179099e
Change-Id: I305f6f30a2f5f4ddb483131a5ef48cf501fb2b74
2019-12-19 17:10:29 +00: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
Automerger Merge Worker
82bf9e83f9 Merge "Convert VtsHalKeymasterV*_0TargetTest to be parameterized test" am: aae9ff2315 am: 5960d7b49e am: 78648b8a28
Change-Id: I6d7383a4649ac9c1f2144c7ec05580e3c79486ca
2019-12-11 22:28:32 +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
Automerger Merge Worker
db21c8e59e Merge "Fixing RSA tests not using the correct exponent" am: ba111275cb am: 97a8659242
Change-Id: I6914b88f2a65188bd5057cca7c85c6bd58e05126
2019-12-03 20:03:33 +00: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
4fffa4a9d8 Merge "Added standalone benchmark for keymaster." am: 3f7f55b378 am: 7d67ad3453
am: 3213e8a929

Change-Id: I3fa6d9d485edb066f8c79e27775c58e4485bbfa2
2019-12-02 14:32:31 -08:00
Rob Barnes
3f7f55b378 Merge "Added standalone benchmark for keymaster." 2019-12-02 22:13:23 +00:00
Steven Moreland
c2a2995047 Merge "./update-makefiles.sh, for union changes/memory" am: 00daede4d5 am: 0942e33017
am: 87fe284668

Change-Id: I3a331b5e1c5418426a084f1c7bfe436214a1b68f
2019-11-26 15:00:11 -08: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
bdc9434b3c Merge changes from topic "add-km-41" am: f66777ad50 am: 7f7e9608dc
am: 78926e3375

Change-Id: I7964555358e9150d58f53eb154ee7acf5eea1a78
2019-11-21 15:01:55 -08: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
b046774b26 Merge "Added LargeFinishInput test" am: 0cd9dd3893 am: 2b7a5caaf1
am: e5567ae93d

Change-Id: I2f7cd04aef3847dfebc6dda8ad335858283f167b
2019-11-15 12:27:57 -08: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
Max Bires
c7cb2e9cc8 Merge "Adding test to check another ASN.1 Encoding Case" am: 8fb7cbd26b am: 2e220a7507
am: 2dd6fa731b

Change-Id: I35f3a58b3299c2cff56f829f0efececd0f5f8045
2019-11-14 14:19:18 -08:00
Treehugger Robot
8fb7cbd26b Merge "Adding test to check another ASN.1 Encoding Case" 2019-11-14 21:54:44 +00:00
Max Bires
05f700ffeb Merge "Removing invalid HMAC tests." am: b09819f2da am: 2557502d5e
am: 6c54a3df7e

Change-Id: I68f5ba01fc1d3357263dfbc54aca9f72e3dc8297
2019-11-12 15:09:54 -08: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
Max Bires
99d0ee3e26 Merge "Adding jbires to VTS OWNERS" am: 9756532b64 am: 3137c54d4f am: 7558ead96c
am: c70d259d06

Change-Id: Id6b967b677d60eaf49dcce53b9b1dd19f9f2ff9d
2019-10-25 11:51:23 -07:00
Treehugger Robot
9756532b64 Merge "Adding jbires to VTS OWNERS" 2019-10-25 17:54:54 +00:00
Max Bires
9f30a06060 Merge "Adding test to check that ASN.1 lengths are properly encoded" am: c6b086785d am: b3ee534556 am: 96098b0cd9
am: 995fa3dbe8

Change-Id: I8eb3a3b80f219a050250eb266949978d531bf3fb
2019-10-24 15:54:26 -07: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
1a4755ee0a Fix UB in class NullOr am: cf5d7e83fd am: 24db85e33e am: 51bbd6719b
am: 6f630d198f

Change-Id: Id21d0cfa6852dda9f0158f233063c462989b93f4
2019-10-10 21:47:58 -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
Rob Barnes
147f26b1ea Merge "Add Keymaster VTS tests for some AES cases:" am: 772fb53999 am: 0baa38ed55 am: 0eb84f484a
am: e70544b15c

Change-Id: Id496d05e590aa8e1e9f2c78bdc21306e8c839faa
2019-10-02 01:29:54 -07:00
Treehugger Robot
772fb53999 Merge "Add Keymaster VTS tests for some AES cases:" 2019-10-02 07:04:26 +00:00
Rob Barnes
1b598f5da3 Merge "Added VTS tests for clearing operation slots after service death." am: fd877b5479 am: 2b3640a442 am: 89cd80c9da
am: f610e72c81

Change-Id: Ie2c68f4195d494a1c5af712234f6a7d98c98892e
2019-10-01 10:28:23 -07:00
Rob Barnes
fd877b5479 Merge "Added VTS tests for clearing operation slots after service death." 2019-10-01 16:52:49 +00:00
Colin Cross
6962c45657 Merge "Use libcrypto_static instead of libcrypto" am: c048c187be am: 06b758a918 am: 978e59e401
am: 135b3a4417

Change-Id: I2ae264a5c9998b7c6a2a4bb868e313161f1a3701
2019-09-26 08:20:46 -07: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