Commit graph

355 commits

Author SHA1 Message Date
Baranidharan Muthukumaran
3f200e078e Merge "Fix KM VTS tests for Strongbox implementations"
am: d6b4242d52

Change-Id: I52cd833dfa2c8cc4fb130544f5cb5d35217a0fc4
2018-09-04 03:55:02 -07:00
Treehugger Robot
d6b4242d52 Merge "Fix KM VTS tests for Strongbox implementations" 2018-09-04 10:44:18 +00:00
Eran Messeri
8ee59f2aa6 Merge "Fixing Keymaster documentation." into pie-vts-dev
am: 33f7970672

Change-Id: I0bd196af03f96817cbd23620b109e7665456f586
2018-08-29 01:11:55 -07:00
Shawn Willden
f7c0a7938d Change ImportWrappedKeyTest back to SHA1
Change I5f877b2a1ac66026a876e145416ba078d486e4b5 inadvertently changed
the digest used for ImportWrappedKey, breaking the test.  This CL
reverts that portion of the change.

Test: VtsHalKeymasterV4_0TargetTest
Bug: 112279922
Merged-In: Ib8e2e7793ba46ae0d29d8407bb730a35bdb5ea98
Change-Id: Ib8e2e7793ba46ae0d29d8407bb730a35bdb5ea98
(cherry picked from commit 0dba888612)
2018-08-28 15:19:40 -07:00
Shawn Willden
0b166a2daf Require keymaster4 attestations to contain the right version.
Note that devices with KM4 will fail to pass VTS after this
lands, until the fix from Qualcomm arrives.

Test: VtsHalKeymasterV4_0TargetTest
Bug: 112040197
Merged-In: Ie2cd917af704b9f19de3537297b3a7e4f0c861e9
Change-Id: Ie2cd917af704b9f19de3537297b3a7e4f0c861e9
(cherry picked from commit 4e006c2b92)
2018-08-28 15:19:03 -07:00
nagendra modadugu
913053419e keymaster: skip SHA2 digest tests for strongbox
Strongbox is not required to support SHA-2 digests,
so skip the related tests.

Bug: 109771020
Merged-In: I5f877b2a1ac66026a876e145416ba078d486e4b5
Change-Id: I5f877b2a1ac66026a876e145416ba078d486e4b5
(cherry picked from commit 8cec80be1f)
2018-08-28 15:18:32 -07:00
nagendra modadugu
8414fb8556 keymaster: spec does not require that update produce output
Remove out of spec enforcement on the amount of data returned
by update, as this is not specified in the HAL.

Bug: 109771020
Test: yes it is
Merged-In: Ic41afbd01d51faf48d3c0fe090409ebcd257cc1e
Change-Id: Ic41afbd01d51faf48d3c0fe090409ebcd257cc1e
(cherry picked from commit 7b75f015a7)
2018-08-28 15:17:31 -07:00
Shawn Willden
e1e08f8dde Fix attestation test.
Bug: 77588764
Test: VtsHalKeymasterV4_0TargetTest
Merged-In: Ibe264d08ae7b3333a6949761a92759f5305b3fcb
Change-Id: Ibe264d08ae7b3333a6949761a92759f5305b3fcb
(cherry picked from commit d898d0a422)
2018-08-28 15:16:58 -07:00
Eran Messeri
ff29edcc71 Fixing Keymaster documentation.
Keymaster HAL documentation documents the bootPatchLevel as having
tag 718, while types.hal indicates the tag value for it is actually
719.

Test: N/A
Bug: 78104779
Merged-In: I0dde0b3c863081f2594e20466d8e82866a5f2d2e
Change-Id: I0dde0b3c863081f2594e20466d8e82866a5f2d2e
(cherry picked from commit ae8da1b70a)
2018-08-28 15:08:39 -07:00
Baranidharan Muthukumaran
88a376b0a0 Fix KM VTS tests for Strongbox implementations
Modify RSA keysize used in various tests
to ensure both TEE and Strongbox implementations
can be validated.
Skip invalid keysizes that Strongbox does not
support.

Test: Patches the strongbox tests
Bug: 112189538
Change-Id: I46ab01ce9b8224403e2a334a894967761d6799c9
Signed-off-by: Max Bires <jbires@google.com>
2018-08-28 10:58:49 -07:00
Shawn Willden
d033196431 Change ImportWrappedKeyTest back to SHA1
am: ad5b5ff2f0

Change-Id: Ia36eb6dd3aa4a07b5a72291c81de6e0cede202af
2018-08-17 09:14:47 -07:00
Shawn Willden
a795d5e3e7 Require KM4 attestations contain the right version
am: 0f2b0966c6

Change-Id: I04801fc26713513d8d39a836e30545e148fd1f50
2018-08-17 09:14:39 -07:00
nagendra modadugu
95f20ea7c5 keymaster: skip SHA2 digest tests for strongbox
am: 7194604cd8

Change-Id: Id44ef77aea880dd565a1a8e466f6ac2e1c98047f
2018-08-17 09:14:31 -07:00
Shawn Willden
ad5b5ff2f0 Change ImportWrappedKeyTest back to SHA1
Change I5f877b2a1ac66026a876e145416ba078d486e4b5 inadvertently changed
the digest used for ImportWrappedKey, breaking the test.  This CL
reverts that portion of the change.

Test: VtsHalKeymasterV4_0TargetTest
Bug: 112279922
Bug: 80246122
Change-Id: Ib8e2e7793ba46ae0d29d8407bb730a35bdb5ea98
2018-08-17 06:58:32 -06:00
Shawn Willden
0f2b0966c6 Require KM4 attestations contain the right version
Note that devices with KM4 will fail to pass VTS after this
lands, until the fix from Qualcomm arrives.

Test: VtsHalKeymasterV4_0TargetTest
Bug: 112040197
Bug: 80246122
Change-Id: Ie2cd917af704b9f19de3537297b3a7e4f0c861e9
2018-08-17 06:58:12 -06:00
nagendra modadugu
7194604cd8 keymaster: skip SHA2 digest tests for strongbox
Strongbox is not required to support SHA-2 digests,
so skip the related tests.

Bug: 109771020
Bug: 80246122
Test: This is the test
Change-Id: I5f877b2a1ac66026a876e145416ba078d486e4b5
2018-08-17 06:58:12 -06:00
nagendra modadugu
683bd5d1b9 keymaster spec doesn't require update to output
Remove out of spec enforcement on the amount of data returned
by update, as this is not specified in the HAL.

Bug: 109771020
Bug: 80246122
Test: yes it is
Change-Id: Ic41afbd01d51faf48d3c0fe090409ebcd257cc1e
2018-08-17 06:57:28 -06:00
Shawn Willden
7b00c75643 Fix attestation test.
Bug: 77588764
Bug: 80246122
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: Ibe264d08ae7b3333a6949761a92759f5305b3fcb
2018-08-17 06:51:06 -06:00
Shawn Willden
66efa86145 Handle software keymaster implementations.
am: 1404b6e8b0

Change-Id: Ia054c30244e989cf60e3abb81304ed9fed0b2fbf
2018-08-15 15:29:30 -07:00
Shawn Willden
1404b6e8b0 Handle software keymaster implementations.
Test: VtsHalKeymasterV3_0TargetTest
Change-Id: I0ca923fab3e312c576abc2f51f6dd28482176db7
2018-08-15 12:13:34 -06:00
Hung-ying Tyan
3c07de32fc Fix free() in keymaster VTS
am: 555cb5e13b

Change-Id: Ida0db54bf04cc81b8dfe218f4e2835e59947e6b7
2018-08-10 14:31:03 -07:00
nagendra modadugu
4fce12f113 Respect limited requirements for Strongbox KM implementations
am: bbe9263f85

Change-Id: I16e0071a70b1ab5bc4317b608b36c8eeef559c58
2018-08-10 14:30:49 -07:00
Hung-ying Tyan
555cb5e13b Fix free() in keymaster VTS
The buffer is allocated by OPENSSL_malloc() in X509_NAME_oneline(name, nullptr, 0).
Should be reclaimed by OPENSSL_free() instead of free().

The patch is provided by vink.shen@mediatek.corp-partner.google.com

Bug: 109708231
Test: build pass
Merged-In: I66a864e3e28905eebac2e7d3a4517d4d5aaa39df
Change-Id: I66a864e3e28905eebac2e7d3a4517d4d5aaa39df
(cherry picked from commit 79db3ec849)
2018-08-10 00:48:32 +00:00
nagendra modadugu
bbe9263f85 Respect limited requirements for Strongbox KM implementations
With this patch the KM VTS test apply the restricted requirements on
supported key sizes, EC curves, and Digests to Strongbox keymaster
implementations.

Also amend tests to use Update().

Test: Yes it is
Bug: 74519020
Merged-In: Ibec9c3398671f81dbc0ecf78e554726276160579
Change-Id: Ibec9c3398671f81dbc0ecf78e554726276160579
(cherry picked from commit 3a7e2cade3)
2018-08-10 00:48:11 +00:00
Shawn Willden
0dba888612 Change ImportWrappedKeyTest back to SHA1
Change I5f877b2a1ac66026a876e145416ba078d486e4b5 inadvertently changed
the digest used for ImportWrappedKey, breaking the test.  This CL
reverts that portion of the change.

Test: VtsHalKeymasterV4_0TargetTest
Bug: 112279922
Change-Id: Ib8e2e7793ba46ae0d29d8407bb730a35bdb5ea98
2018-08-06 17:23:23 -06:00
Shawn Willden
4e006c2b92 Require keymaster4 attestations to contain the right version.
Note that devices with KM4 will fail to pass VTS after this
lands, until the fix from Qualcomm arrives.

Test: VtsHalKeymasterV4_0TargetTest
Bug: 112040197
Change-Id: Ie2cd917af704b9f19de3537297b3a7e4f0c861e9
2018-08-02 21:01:10 +00:00
nagendra modadugu
8cec80be1f keymaster: skip SHA2 digest tests for strongbox
Strongbox is not required to support SHA-2 digests,
so skip the related tests.

Bug: 109771020
Change-Id: I5f877b2a1ac66026a876e145416ba078d486e4b5
2018-07-23 11:25:00 -07:00
Eran Messeri
f1aa9d6b88 Merge "Fixing Keymaster documentation." into pi-dev
am: 897b56e2a8

Change-Id: I2089c6a5ca411b95b9e925e92999d246d4240b5f
2018-06-29 04:00:40 -07:00
TreeHugger Robot
897b56e2a8 Merge "Fixing Keymaster documentation." into pi-dev 2018-06-29 10:57:17 +00:00
nagendra modadugu
c7d39cf9ac Merge "keymaster: spec does not require that update produce output" into pi-dev
am: 409b5fd5fb

Change-Id: Ieb194a3116abcfee249c2033ed346aa7151fc26c
2018-06-26 17:05:10 -07:00
TreeHugger Robot
409b5fd5fb Merge "keymaster: spec does not require that update produce output" into pi-dev 2018-06-26 23:57:01 +00:00
nagendra modadugu
7b75f015a7 keymaster: spec does not require that update produce output
Remove out of spec enforcement on the amount of data returned
by update, as this is not specified in the HAL.

Bug: 109771020
Test: yes it is
Change-Id: Ic41afbd01d51faf48d3c0fe090409ebcd257cc1e
2018-06-26 15:44:36 -07:00
Shawn Willden
0804bb0cfc Merge "Fix attestation test." into pi-dev
am: be04f192e9

Change-Id: I276a5f18b35b5923590ab2c5f6d9688bd06d05bd
2018-06-25 16:47:51 -07:00
Shawn Willden
d898d0a422 Fix attestation test.
Bug: 77588764
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: Ibe264d08ae7b3333a6949761a92759f5305b3fcb
2018-06-25 06:36:02 -06:00
Eran Messeri
ae8da1b70a Fixing Keymaster documentation.
Keymaster HAL documentation documents the bootPatchLevel as having
tag 718, while types.hal indicates the tag value for it is actually
719.

Test: N/A
Bug: 78104779
Change-Id: I0dde0b3c863081f2594e20466d8e82866a5f2d2e
2018-06-21 20:35:45 +01:00
Janis Danisevskis
fdaab3d2a7 Merge "Relax HMAC computation check" into pi-dev
am: b6093dccf0

Change-Id: I205cf45af3e58028c120c2a118dd9dd6509e0bad
2018-06-20 15:36:46 -07:00
Janis Danisevskis
b6093dccf0 Merge "Relax HMAC computation check" into pi-dev 2018-06-20 22:32:13 +00:00
Janis Danisevskis
a1c4e0ec5d Relax HMAC computation check
This KM4 key agreement check is causing some pain on early units
that aren't completely provisioned in both locked and non-Green
(unlocked) states.

This doesn't impact KM3 devices (Pixel 2016/2017 etc.)

Bug: 110301629
Change-Id: I5a737ac8a335863b1099c29cf3c0496adeb41e15
2018-06-20 05:25:22 +00:00
nagendra modadugu
69242ea30b Merge "Respect limited requirements for Strongbox KM implementations" into pi-dev
am: 17be71d397

Change-Id: I16bde9c0defeb971cba8684c021a331a59b7937f
2018-06-18 10:32:22 -07:00
nagendra modadugu
3a7e2cade3 Respect limited requirements for Strongbox KM implementations
With this patch the KM VTS test apply the restricted requirements on
supported key sizes, EC curves, and Digests to Strongbox keymaster
implementations.

Also amend tests to use Update().

Test: Yes it is
Bug: 74519020
Change-Id: Ibec9c3398671f81dbc0ecf78e554726276160579
2018-06-18 09:20:56 -07:00
Hung-ying Tyan
e874dd7741 Fix free() in keymaster VTS
am: 79db3ec849

Change-Id: Ib555c571fb5aede39c7f1f9418a91f24b193c5a8
2018-06-10 21:58:19 -07:00
Xin Li
27353e7065 Merge pi-dev-plus-aosp-without-vendor into stage-aosp-master
Bug: 79597307
Change-Id: Ifa37597ef6090bfbf1b41307a60cf65cfa1f563d
2018-06-08 11:07:51 -07:00
Shawn Willden
fddc15e1ec Merge "Fix bug in VTS attestation cert verification." am: 636650bd84
am: 03a2fcd89f

Change-Id: I1270383112047ab90d87bee4a483a91bb9093090
2018-06-08 06:11:43 -07:00
Treehugger Robot
636650bd84 Merge "Fix bug in VTS attestation cert verification." 2018-06-08 13:00:19 +00:00
Hung-ying Tyan
79db3ec849 Fix free() in keymaster VTS
The buffer is allocated by OPENSSL_malloc() in X509_NAME_oneline(name, nullptr, 0).
Should be reclaimed by OPENSSL_free() instead of free().

The patch is provided by vink.shen@mediatek.corp-partner.google.com

Bug: 109708231
Test: build pass
Change-Id: I66a864e3e28905eebac2e7d3a4517d4d5aaa39df
2018-06-08 17:53:48 +08:00
TreeHugger Robot
8bac8dcba5 Merge "Minor corrections to the Keymaster4 documentation." into pi-dev 2018-05-31 16:49:10 +00:00
Shawn Willden
5b60a1b72e Minor corrections to the Keymaster4 documentation.
Gramatical and punctuation corrections; addition of missing
userSecureId to AuthorizationList schema and removal of extraneous
rollbackResistant from same; correction of OS_PATCHLEVEL source
property; and addition of missing TAG_UNLOCKED_DEVICE_REQUIRED
documentation.

Bug: 69550260
Test: N/A
Change-Id: I04092b7df3af69201ba1467cddc09f6f44e861a8
2018-05-30 16:20:48 -06:00
Shawn Willden
8d815f659d Fix default keymaster so it doesn't start an extra thread.
Bug: 80102279
Bug: 80251973
Test: N/A; this keymaster exists only for policy compliance. It's never used.
Change-Id: I45f0eefd9abdd02f6774aa52f238040510c5d62c
2018-05-24 20:52:11 +00:00
TreeHugger Robot
1f74538cdb Merge "Move Keymaster docs into HAL" into pi-dev 2018-05-24 02:11:43 +00:00
Shawn Willden
b20a5dd5d9 Move Keymaster docs into HAL
Bug: 69550260
Test: N/A
Change-Id: Ib135e4e4060f3a89480f6784b30e9008126b3b76
2018-05-23 18:26:42 -06:00
Shawn Willden
6dad2b3a4b Activate HMAC sharing check.
This had to be disabled because Qualcomm's keymaster4 returned a bad
value.

Bug: 77588764
Bug: 79698245
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: Ieb150d7f17c36f01acf2eeb665792594251b51ae
2018-05-23 05:44:42 -06:00
Steven Moreland
913c071391 Update comments for doc comments.
Doc comments look like "/** ... */" and they
can only be in certain places.

Bug: 79865343
Test: m
Change-Id: Ic15c08ff7dc6e4f9827c1dbe7f7236c11a572ec1
Merged-In: Ic15c08ff7dc6e4f9827c1dbe7f7236c11a572ec1
2018-05-21 14:36:29 -07:00
Steven Moreland
4ee4582230 Update comments for doc comments.
Doc comments look like "/** ... */" and they
can only be in certain places.

Bug: 79865343
Test: m
Change-Id: Ic15c08ff7dc6e4f9827c1dbe7f7236c11a572ec1
2018-05-18 10:10:32 -07:00
Shawn Willden
f0f05d4052 Add utility method to perform HMAC agreement
To make it easier for clients (vold & keystore) to perform key
agreement, this CL adds a service method that does it.  To make key
agreement consistent, this method sorts the HMAC sharing parameters
lexicographically.  The requirement for sorting is documented in the
HAL.

Test: Boot device
Bug: 79307225
Bug: 78766190
Change-Id: Idb224f27f8e4426281d9a0105605ba22bf7c7e95
2018-05-10 18:28:51 -06:00
Shawn Willden
44dc86edf8 Fix bug in VTS attestation cert verification.
Keymaster VTS is failing to verify that the last certificate in the
chain is self-signed.  CTS and GTS tests verify this, but it should be
validated at this level as well.

Bug: 79123157
Test: VtsHalKeymasterV3_0TargetTest
Change-Id: I5ff33fc8186182c2cf8d43d90cd59f89ce45d416
2018-05-04 16:15:06 +00:00
Brian C. Young
9fca9719a3 Remove superfluous test
This test was added on a bad assumption about the behavior of the
keymaster spec, and is now being removed.

Test: VTS
Bug: 77307569
Change-Id: Iac2f6f45ea1816505ff3b47bbdc548ff1161c96b
2018-04-11 12:38:52 -07:00
Shawn Willden
86a33acfce Correct bug in HmacKeySharingTest
The key sharing test modified the seed in an invalid way.

Bug: 77588764
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I0b2ac90397a3f23258ebd4dddc5f6043af7b1600
2018-04-09 14:16:38 -06:00
Shawn Willden
44f8b71874 Correct import wrapped key golden keys.
The golden test keys didn't include TAG_NO_AUTH_REQUIRED, which causes
them to be rejected by strictly compliant implementations.

Bug: 77588764
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I5157537e5407618ddc37debf00486977abb00f99
2018-04-04 21:35:11 +00:00
TreeHugger Robot
a71ab794a6 Merge "Correct TripleDes tests." into pi-dev 2018-04-04 21:31:25 +00:00
Shawn Willden
08839105dc Correct TripleDes tests.
The TripleDes tests failed to set TAG_NO_AUTH_REQUIRED, which causes
operations to be rejected by strictly compliant implementations.

Bug: 77588764
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I25cd5ec0ccede2b148f5da4566b8e1e20e8edbde
2018-04-04 21:31:22 +00:00
nagendra modadugu
9c36c91945 keymaster: provide instance name to getService()
Bug: 38430282
Test: VtsHalKeymasterV3_0TargetTest pass with exception
  of (AesEcbWithUserId, RsaAttestation, EcAttestation)
  which are expected failures.

Change-Id: I48e7195f512190deb608f1a69783c92254eef1aa
2018-03-30 18:31:35 -07:00
Brian Young
3f48322658 Add "Unlocked device required" key API
Add a keymaster parameter for keys that should be inaccessible when
the device screen is locked. "Locked" here is a state where the device
can be used or accessed without any further trust factor such as a
PIN, password, fingerprint, or trusted face or voice.

This parameter is added to the Java keystore interface for key
creation and import, as well as enums specified by and for the native
keystore process.

Test: CTS tests in I8a5affd1eaed176756175158e3057e44934fffed

Bug: 67752510

Merged-In: Id19d19b19532ac8d4c52aad46a954faa4515289d
Change-Id: Id19d19b19532ac8d4c52aad46a954faa4515289d
(cherry picked from commit 1840be6d35)
2018-03-28 08:38:56 -07:00
nagendra modadugu
a63596436b Remove DES 112 tests, and speed up RSA keygen
Only DES3 is supported (168-bit), so remove
tests for 112-bit DES.

Also replace the RSA public exponent 3, with
65537 in most tests so that RSA key generation
is faster.

Change-Id: I9958df81fe46d752d82072dc6c7effa34b2921a8
2018-03-01 17:26:12 -08:00
Brian Young
f67e953919 Revert "Restore "Add "Unlocked device required" parameter to keys""
This reverts commit 97e02689d9.

Reason for revert: Regression in creating auth-bound keys

Bug: 73773914

Bug: 67752510

Change-Id: I8ccba28580099c4c533f53b0be92f1d607ce63c6
2018-02-23 01:31:40 +00:00
Brian C. Young
97e02689d9 Restore "Add "Unlocked device required" parameter to keys"
Add a keymaster parameter for keys that should be inaccessible when
the device screen is locked. "Locked" here is a state where the device
can be used or accessed without any further trust factor such as a
PIN, password, fingerprint, or trusted face or voice.

This parameter is added to the Java keystore interface for key
creation and import, as well as enums specified by and for the native
keystore process.

This reverts commit 95b60a0f41.

Test: CTS tests in I8a5affd1eaed176756175158e3057e44934fffed

Bug: 67752510

Change-Id: I2893c23ab173ff5c39085d56b555e54770900cbc
2018-02-15 11:19:40 -08:00
Zhuoyao Zhang
bc02ee16e4 Merge "Convert keymaster hal test to use VtsHalHidlTargetTestEnvBase" am: eeeaaf5589 am: 6e4263fa6b
am: 75cfb6b035

Change-Id: I5a2b49315d74cc53b6205346e39d953826a15dab
2018-02-12 17:51:39 +00:00
Zhuoyao Zhang
14ab40b9e7 Convert keymaster hal test to use VtsHalHidlTargetTestEnvBase
Bug: 64203181
Test: make vts
      vts-tradefed run vts -m VtsHalKeymasterV3_0Target

Change-Id: I6f245996749a53418b71f516ba782fe9d4321501
2018-02-10 12:40:25 -08:00
Jorim Jaggi
62df80180b Merge "Revert "Add "Unlocked device required" parameter to keys"" 2018-01-30 15:36:28 +00:00
Brian Young
95b60a0f41 Revert "Add "Unlocked device required" parameter to keys"
This reverts commit 5fe872413b.

Reason for revert: Build breakages on elfin, gce_x86_phone.

Bug: 72679761
Bug: 67752510
Change-Id: I2857b2a9b6ff26735bd4989a36c5e5deb4953904
2018-01-30 15:31:19 +00:00
TreeHugger Robot
ea52a4d3b8 Merge "Add "Unlocked device required" parameter to keys" 2018-01-29 23:16:02 +00:00
Shawn Willden
98b998b59a Support library enhancements, to ease transition of vold to KM4
Keymaster clients need to see all the available devices and figure out
which they want to use.  This method finds them all and returns them
in a vector sorted from most secure to least, according to a heuristic
defined in Keymaster::VersionResult::operator<

This CL also makes a few other minor improvements to the support
library, providing more information in VersionResult and adding some
more convenience methods in AuthorizationSetBuilder.

Test: Build & boot
Change-Id: I876238ee9ff72573c30d60e1cec665dd610bcde6
2018-01-25 22:38:56 -07:00
Brian C. Young
5fe872413b Add "Unlocked device required" parameter to keys
Add a keymaster parameter for keys that should be inaccessible when
the device screen is locked. "Locked" here is a state where the device
can be used or accessed without any further trust factor such as a
PIN, password, fingerprint, or trusted face or voice.

This parameter is added to the Java keystore interface for key
creation and import, as well as enums specified by and for the native
keystore process.

Test: go/asym-write-test-plan

Bug: 67752510

Change-Id: I466dfad3e2e515c43e68f08e0ec6163e0e86b933
2018-01-25 10:18:21 -08:00
TreeHugger Robot
406406fb90 Merge changes from topic "tui_keystore"
* changes:
  Add Trusted Confirmation support to Keymaster HAL.
  Sort tags in keymaster_tags.h alphabetically
2018-01-25 17:31:38 +00:00
Shawn Willden
129629bde4 Add Trusted Confirmation support to Keymaster HAL.
Bug: 63928580
Test: VtsHalKeymasterV4_0TargetTest

Change-Id: I402be6f182f7f375493334d5e000fec23f3551f6
2018-01-24 10:19:10 -08:00
Janis Danisevskis
83509cd758 Sort tags in keymaster_tags.h alphabetically
Test: No functional changes
Change-Id: I49c5632b5dae1f24634e99eb71a9471e91275fbd
2018-01-24 10:19:10 -08:00
Steven Moreland
12372db498 Merge "Update makefiles." 2018-01-23 22:37:32 +00:00
Steven Moreland
5d1e41a8fd Update makefiles.
Bug: N/A
Test: N/A
Change-Id: Idb1d74aeed9b82ca6568c76f35552f3fcc894239
2018-01-23 19:44:19 +00:00
Shawn Willden
b9be9ded26 Add support for BOOT and VENDOR patch levels to keymaster.
Bug: 68250869
Test: Manual.  VTS testing is not possible.
Change-Id: Ifa2025ce31592dbeb274ee3a2c300a7de416ae1f
2018-01-23 10:21:06 -07:00
TreeHugger Robot
af4d761cf5 Merge "Add additional parameters to importWrappedKey" 2018-01-22 20:18:17 +00:00
TreeHugger Robot
e541981ac2 Merge "Add VerificationToken tests." 2018-01-20 03:25:18 +00:00
Shawn Willden
8d28efa9b8 Add additional parameters to importWrappedKey
Bug: 31675676
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I31166d0c562d92bbdcf3357782ac2a076a1bc2d9
2018-01-19 20:09:05 -07:00
Shawn Willden
4fbc1d574b Add VerificationToken tests.
Bug: 70409878
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I5458729ef8c3494f45fe8274b391133b997d43f2
2018-01-20 02:54:23 +00:00
TreeHugger Robot
dec9b4480d Merge "Specify SecurityLevel::SOFTWARE in default keymaster 4.0 service." 2018-01-19 22:49:27 +00:00
Shawn Willden
256929827a Move KeyParameter operator== to support lib.
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I4b71a9fbd986c1bd1001e3ab49de5d360b303b27
2018-01-19 09:44:11 -07:00
Shawn Willden
3d9433268f Add HMAC key sharing tests
Bug: 70409878
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I9da12a70ce04f606980b5c8bec8deaeaa318bf81
2018-01-18 21:35:54 -07:00
Shawn Willden
252233df69 Refactor VTS tests a bit, to enable adding tests in separate files.
Bug: 70409878
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: Idd147d20761e7123005b468841a2ddb46cc19576
2018-01-18 21:35:49 -07:00
Shawn Willden
163063e15b Merge "Fix build breakage" 2018-01-19 02:20:37 +00:00
TreeHugger Robot
a7c5a47d64 Merge "ImportWrappedKey: preliminary VTS tests" 2018-01-19 02:14:56 +00:00
Shawn Willden
0555ddd6ba Fix build breakage
Previous CLs to move keymaster wrappers broke the build (but somehow
not in my tree, nor in TreeHugger's build).

Test: Build
Change-Id: I0494e1e38ee7e8806f3758d533b6b1e3a6c576d1
2018-01-18 19:12:53 -07:00
Frank Salim
ad57fa93fb ImportWrappedKey: preliminary VTS tests
• Happy-path import
• Masked
• Wrong mask
• Wrong Purpose

Bug: 63931634

Test: data/nativetest/VtsHalKeymasterV4_0TargetTest/VtsHalKeymasterV4_0TargetTest --hal_service_instance=android.hardware.keymaster@4.0::IKeymasterDevice/strongbox
Change-Id: Ie7948bca25ee4840d179fb879b054755199c96d9
2018-01-18 17:32:35 -07:00
Frank Salim
16350c9efc Specify SecurityLevel::SOFTWARE in default keymaster 4.0 service.
Test: it compiles

Change-Id: I0ae85000c802dd375f0c7d66c7c9c71b143107aa
2018-01-18 14:41:20 -08:00
Shawn Willden
7d339812c9 Move Keymaster wrapper into support library.
This wrapper was used to manage KM3/KM4 compatibility in keystore.
It's also needed in vold, so this CL moves it here, to make it usable
for vold.

Test: keystore CTS tests
Change-Id: I8079b8577f7d4a8fd67f47fbe1f48861e4a0734b
2018-01-18 15:39:50 -07:00
Shawn Willden
8823a4415c Add support for 3DES algorithm to Keymaster.
Test: VtsHalKeymasterV4_0TargetTest
Bug: 31675676
Change-Id: I68a67b78979002a38e92454f79715ed516026889
2018-01-17 14:15:38 -07:00
Shawn Willden
2d6b39d034 Add Trusted User Presence support to Keymaster HAL.
Test: not yet
Change-Id: I99451cb6e21b577281bd7a889e1a44db7b26525f
2018-01-10 22:52:12 -07:00
Shawn Willden
a6eb3faeb5 Remove references to Keymaster::3.0 from Keymaster::4.0
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: Idf627a3d7a51d2a464bd1723a32e88f43969bf45
2018-01-04 15:05:36 -07:00
Janis Danisevskis
c0af94ad84 Merge "Fix typos in KM4 interface definition documentation" 2018-01-02 17:36:26 +00:00
Janis Danisevskis
d29fb73c14 Fix typos in KM4 interface definition documentation
Test: N/A
Change-Id: I037ae8bc8cd35479a8e19af2f4651206fb02fda9
2017-12-27 09:09:54 -08:00
Steven Moreland
7d1e04051e Update Keymaster makefiles.
Test: none
Change-Id: Ic7cc31f9cee7ceaa834e48b6de39d4a351aff2b1
2017-12-22 14:59:16 -08:00
Shawn Willden
647357f6cb Remove libkeymaster_staging
Test: Builds
Change-Id: I742a3e36fd96c3a1b37181f48aab7e5faa63b063
2017-12-21 12:49:35 -07:00
TreeHugger Robot
4f7dabb1a9 Merge "Add support for StrongBox implementations to Keymaster HAL" 2017-12-12 18:48:05 +00:00
Shawn Willden
9e0c1fe534 Add support for StrongBox implementations to Keymaster HAL
Also adds secure key import.

Bug: 63931634
Test: not yet
Change-Id: I54f38a8787e2fcb51e01f378228e4a0c576fdfbe
2017-12-12 07:14:45 -07:00
Steven Moreland
4cd5506baa Update makefiles.
Been seeing these in CLs. Some were forgotten.

Test/Bug: none

Change-Id: I678f9ef157a3631586a3d3a9cc503121eed5a703
2017-12-11 20:48:11 +00:00
Shawn Willden
32aa7ecb55 Rename IKeymaster back to IKeymaserDevice
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: Ic5e7f936ef75aa64834677f6589822fbedce39cd
2017-11-30 19:37:07 -07:00
Steven Moreland
e5c6548346 Remove subdirs
Removing whenever I see these in code reviews.

Test: none
Merged-In: I4322f533a837d55618ec2ed2125e8966ace9d61d
Change-Id: I4322f533a837d55618ec2ed2125e8966ace9d61d
2017-11-28 14:23:43 -08:00
Shawn Willden
1e50c676f6 Add Keymaster V4.0
This CL merely duplicates all of the Keymaster V3.0 functionality and
VTS tests, and provides a pure software implementation of the 4.0 HAL,
which passes the VTS tests.  Future CLs will remove some cruft and
unused features, then add new features and accompanying tests.

Note that the reason that this is V4.0 rather than V3.1 is because V4.0
will not be fully backward compatible with V3.0.  Specifically, V4.0
will allow for "StrongBox" implementations, which will only provide a
subset of Keymaster functionality.  StrongBox versions of Keymaster will
be implemented in discrete, special-purpose hardware which will
generally be much less powerful (slower, less RAM, etc.) than is needed
to support a full Keymaster implementation.

So, while the V4.0 interface will be a strict superset of the V3.0
interface, which could normally be best implemented as an extension, it
will allow StrongBox implementations which are unable to pass the V3.0
test suite, which means that it will not be true that a V4.0
impementation IS-A V3.0 implementation, as would be expected of a V3.1
implementation.  The V4.0 test suite will distinguish between StrongBox
and non-StrongBox implementations and enforce appropriately-reduced
requirements on the former.

In addition to the duplication, 4.0 also cleans up some cruft from 3.0:

  - Removes tags and types which were in previous versions but never
    used;
  - Removes support for wrapping pre-Treble keymaster HALs with KM4,
    since they'll only be wrapped by the default KM3 implementation;
  - Renames the ROLLBACK_RESISTANT tag to ROLLBACK_RESISTANCE and
    defines new semantics for it;
  - Changes auth token handling to use the HardwareAuthToken struct
    passed in as an explicit argument to the relevant methods,
    rather than an opaque byte vector provided as a KeyParameter;
  - Updates the VTS tests to use a gtest "environment" for better
    integration with VTS test infrastructure;
  - Adds a test for upgradeKey.
  - Makes comment formatting more consistent, including using the
    correct two-space typographical convention to separate sentences.

Bug: 63931634
Test: VtsHalKeymasterV4_0TargetTest
Change-Id: I3f01a4991beaa5c4332f72c91e8878a3bf0dec67
2017-11-28 13:41:52 -07:00
Iris Chang
784e993ef6 Merge "Fix Keymaster VTS for OpenSSL error code change" am: fc23356909 am: f9fceff665
am: 11fab4809b

Change-Id: Ibe60ee37e674ff9622f795b6cce7ae9c255bd5d5
2017-11-22 02:16:25 +00:00
Iris Chang
f9fceff665 Merge "Fix Keymaster VTS for OpenSSL error code change"
am: fc23356909

Change-Id: If832fc5e82618c394fd253215cd5c8e5e0011e39
2017-11-22 02:04:08 +00:00
Treehugger Robot
fc23356909 Merge "Fix Keymaster VTS for OpenSSL error code change" 2017-11-22 01:55:27 +00:00
Ryan Campbell
6f62a49017 Transfer VTS test ownership. am: ae6b2a5f1e am: 8ca98990ab
am: 4596756e1b

Change-Id: I3f889b17ff28d49c120b4ce42f1b79a75441bc0d
2017-11-17 02:17:33 +00:00
Ryan Campbell
8ca98990ab Transfer VTS test ownership.
am: ae6b2a5f1e

Change-Id: I4dd526bbfc6e8fa51495f4298e820e62f2fb62dd
2017-11-17 02:10:09 +00:00
Ryan Campbell
ae6b2a5f1e Transfer VTS test ownership.
Remove self from test ownership and transfer to new owners as agreed.

Test: none
Bug: 69425312
Change-Id: I8b189e6f2d7076b9ee7f3bad91445ccf6c5e1767
Merged-In: I8b189e6f2d7076b9ee7f3bad91445ccf6c5e1767
2017-11-16 14:48:00 -08:00
Iris Chang
890d3dfe27 Fix Keymaster VTS for OpenSSL error code change
OpenSSL changes error code of large RSA data from
KM_ERROR_INVALID_INPUT_LENGTH to KM_ERROR_INVALID_ARGUMENT which causes
HidlHalGTest#EncryptionOperationsTest.RsaOaepTooLarge and 
HidlHalGTest#EncryptionOperationsTest.RsaPkcs1TooLarge tests failed. 
Fix keymaster VTS to accept both the error codes.

Bug: 68289922
Test: HidlHalGTest#EncryptionOperationsTest.RsaOaepTooLarge and
      HidlHalGTest#EncryptionOperationsTest.RsaPkcs1TooLargeHidlHalGTest#EncryptionOperationsTest.RsaOaepTooLarge
      and HidlHalGTest#EncryptionOperationsTest.RsaPkcs1TooLarge are
      passed after applying this modification and other Keymaster 3.0
      VTS test cases are not affected.
Change-Id: I493bfa1c6e4b69560dfae3585a416b5c3d33e215
2017-11-15 08:09:52 +00:00
Xin Li
bb9e38fef9 Merge commit '1a06284b24f5eb7bb9c1fea0817da8898b3b1bff' from
oc-mr1-dev-plus-aosp into stage-aosp-master

Change-Id: I2a044eb8c9981d0a8198ffe2df55559afbd76341
Merged-In: I4fb9f18884f7ef21162015a0032c4431444f7025
2017-11-14 12:08:38 -08:00
Steven Moreland
8db261bc99 Updating makefiles for hidl_interface.
Bug: 64487114
Test: manual
Merged-In: Ie13d9e014cf2b81c18c67f551b4644fb9f0ba812
Change-Id: Ie13d9e014cf2b81c18c67f551b4644fb9f0ba812
2017-11-13 10:00:18 -08:00
Steven Moreland
a1169dd600 Update makefiles for hidl_interface.
Bug: 35570956
Test: manual
Change-Id: I7a220b78ee081240e1dc30ef5672ba39e3e98375
2017-11-10 09:06:55 -08:00
Steven Moreland
1d7374c5e1 Update for Soong java makefiles. am: c3e80fa01e am: 0fff75dee1 am: 6c811964a1
am: 116161d94e

Change-Id: I33643636e2511de77fdf7de57777eb67edee2e52
2017-10-11 16:39:21 +00:00
Steven Moreland
116161d94e Update for Soong java makefiles. am: c3e80fa01e am: 0fff75dee1
am: 6c811964a1

Change-Id: I85ccbb4a15cd18938607f5bca4e065b9d7e0182b
2017-10-11 16:31:07 +00:00
Steven Moreland
6c811964a1 Update for Soong java makefiles. am: c3e80fa01e
am: 0fff75dee1

Change-Id: I5b524ccf13233f3696881a2a670b5d2134fd5f15
2017-10-11 16:27:24 +00:00
Steven Moreland
0fff75dee1 Update for Soong java makefiles.
am: c3e80fa01e

Change-Id: Ia8835f9c95bd98a96f5fd3aff11191e7d3726fb9
2017-10-11 16:23:54 +00:00
Steven Moreland
c3e80fa01e Update for Soong java makefiles.
Test: pass
Bug: 33420795
Change-Id: Id9b1919a19b8ff682738cfb0869a479b4dbb4293
2017-10-10 23:07:20 +00:00
Iris Chang
13edc1a4d3 Merge "VTS: fix VtsHalKeymasterV3_0Target issue" am: 1912c73a7f am: b87becf1c2 am: 7fdf8d791f
am: 41df3d9063

Change-Id: I98db06ff0ca957ea35bf0793e1ed8163dc64e2c2
2017-10-06 01:55:09 +00:00
Iris Chang
41df3d9063 Merge "VTS: fix VtsHalKeymasterV3_0Target issue" am: 1912c73a7f am: b87becf1c2
am: 7fdf8d791f

Change-Id: I63b0905fc6091f62b297ed9c85f21e97fe84decd
2017-10-06 01:53:28 +00:00
Iris Chang
7fdf8d791f Merge "VTS: fix VtsHalKeymasterV3_0Target issue" am: 1912c73a7f
am: b87becf1c2

Change-Id: I4674864a39b3f558d30bf63f1b79505c69330867
2017-10-06 01:51:40 +00:00
Iris Chang
b87becf1c2 Merge "VTS: fix VtsHalKeymasterV3_0Target issue"
am: 1912c73a7f

Change-Id: I781812c77d96a0a7beb832298df8d537ce1d55da
2017-10-06 01:49:29 +00:00
Treehugger Robot
1912c73a7f Merge "VTS: fix VtsHalKeymasterV3_0Target issue" 2017-10-06 01:43:54 +00:00
Iris Chang
54ca32a130 VTS: fix VtsHalKeymasterV3_0Target issue
Failed cases:
AttestationTest.RsaAttestation
AttestationTest.EcAttestation

Analysis:
The verify_attestation_record() in Keymaster_hidl_hal_test.cpp calls
parse_attestation_record() to set the value of att_challenge. It fails
to compare att_challenge with challenge by memcmp.
Because setToExternal() method uses buffer pointer to local variable
(record), not use memcpy to copy into itself buffer in
parse_attestation_record(). When it leaves the parse_attestation_record(),
we will get the att_challenge which is null buffer to compare with challenge
incorrectly.

Fix: use memcpy to copy the buffer.

Bug: 65039571
Test: build passed. VtsHalKeymasterV3_0Target -> PASSED: 106, FAILED: 0.

Change-Id: I700a9242cc9a5f4cb196b62860823601e4088531
2017-10-06 00:45:42 +00:00
Steven Moreland
70bfb9d250 Merge "Update for hidl adapter module defaults." am: 988c977079 am: 861651985f am: b53e6ad535
am: 9a17f41f6f

Change-Id: I78d9292068b372238554fd9d35128e69f5b5f9d2
2017-10-04 21:54:11 +00:00
Steven Moreland
9a17f41f6f Merge "Update for hidl adapter module defaults." am: 988c977079 am: 861651985f
am: b53e6ad535

Change-Id: I23269fb7a9bdd352e670a80f390527d9eef31412
2017-10-04 21:51:00 +00:00
Steven Moreland
b53e6ad535 Merge "Update for hidl adapter module defaults." am: 988c977079
am: 861651985f

Change-Id: Ifdb878720d42120e7309dd2a49e5a91059ff4b72
2017-10-04 21:48:04 +00:00
Steven Moreland
861651985f Merge "Update for hidl adapter module defaults."
am: 988c977079

Change-Id: I289818be1b30397391847ba1c532d1014fdbed27
2017-10-04 21:45:09 +00:00
Steven Moreland
527fd76a0e Update for hidl adapter module defaults.
Test: pass
Change-Id: Idc6a943149a279bf17cfcfd0f2571473e53bbbbf
2017-10-04 12:47:03 -07:00
Janis Danisevskis
5a07ed4802 Switch to new NG AndroidKeymaster3Device
Test: VtsHalKeymasterV3_0TargetTest
Bug: 67358942
Change-Id: Idc7ac599c359b3af2e4866b9eb446a05e96132a0
2017-10-03 16:13:21 -07:00
Janis Danisevskis
b17178a1a4 Fix wrong origin assumption for wrapped KM0 hals
KM0 supports only asymmetric encryption. And for those we cannot
distinguish between imported and generated keys.
This patch adds correct handling for KM0 origin tags.

Test: run vts test with wrapped km0 module from
      system/security/softkeymaster

Bug: 67358942
Bug: 67363396

Test: VtsHalKeymasterV3_0TargetTest
Change-Id: I7f5ddd21dde284dbfbd68b3b83fb75c1457dbd59
2017-10-03 16:13:21 -07:00
Janis Danisevskis
957b1dc654 Reflect: Removed KeymasterEnforcement dependencies on openssl
in system/keymaster.

Test: VtsHalKeymasterV3_0TargetTest

Bug: 67358942
Change-Id: Ie3e1fb94a299635e6c7cf45d78822b03bedf5d11
2017-10-03 16:13:21 -07:00
Janis Danisevskis
7e03f98bd2 Software keymaster attestations return 3 as keymaster version
Bug: 67358942
Bug: 67359348
Test: VtsHalKeymasterV3_0TargetTest
Change-Id: Ia04a55b407343ddddd4467c401ee2556e8fe9bd9
2017-10-03 16:13:21 -07:00
Janis Danisevskis
1235d348e6 Relax finish result on RSA operations
Some RSA operation tests expect ErrorCode::INVALID_ARGUMENT
and others ErrorCode::INVALID_INPUT_LENGTH for the same
diagnosed syndrome, i.e., the input message was too long.

This patch relaxes the expectations on one of these tests
expecting ErrorCode::INVALID_INPUT_LENGTH, to also accept the
more consistent ErrorCode::INVALID_ARGUMENT.

Bug: 67358942
Bug: 67359132
Test: VtsHalKeymasterV3_0TargetTest
Change-Id: I573d3a01b052f0256611064f23ae791007cf7122
2017-10-03 16:13:20 -07:00
Janis Danisevskis
02bc2768d4 Add OWNERS files to keymaster resources am: e6014f69ea am: 1ff3510d29 am: 2d83c98987
am: a0e1f49a11

Change-Id: Ic1eab465d8392c79411ce6c6097c40585748db1f
2017-10-03 22:31:13 +00:00
Janis Danisevskis
a0e1f49a11 Add OWNERS files to keymaster resources am: e6014f69ea am: 1ff3510d29
am: 2d83c98987

Change-Id: I97cc35b7736319ae679f1ff88f07bf98857acf30
2017-10-03 21:47:46 +00:00
Janis Danisevskis
2d83c98987 Add OWNERS files to keymaster resources am: e6014f69ea
am: 1ff3510d29

Change-Id: Ida237f73875e70d9d1e24547f1e9b90de12a7729
2017-10-03 21:35:50 +00:00
Janis Danisevskis
1ff3510d29 Add OWNERS files to keymaster resources
am: e6014f69ea

Change-Id: I71c2388fd278869daa652ae10fb8b7848b6e5443
2017-10-03 21:22:58 +00:00
Janis Danisevskis
e6014f69ea Add OWNERS files to keymaster resources
This patch adds swillden@ and jdanis@ as owners of keymaster/3.0/vts
and keymaster/3.0/default.

Test: No code changed
Change-Id: I04bc0f741e8fafd53aee7c9dd62954548b81263d
2017-10-03 13:37:19 -07:00
Steven Moreland
91799c6cc7 Merge "Fix typo in update makefiles." am: 9960148420 am: f07e364ce3 am: 71a193a425
am: 9fdd241905

Change-Id: I1c852fa6600fecc44d5afd1a65a5f51c43ecf71c
2017-09-27 00:02:52 +00:00
Steven Moreland
9fdd241905 Merge "Fix typo in update makefiles." am: 9960148420 am: f07e364ce3
am: 71a193a425

Change-Id: I45ae43f07323254212532acbf0f891d11143b05f
2017-09-26 23:58:51 +00:00
Steven Moreland
71a193a425 Merge "Fix typo in update makefiles." am: 9960148420
am: f07e364ce3

Change-Id: If5bbf259458363b755989578c2f3828cbcb3d07c
2017-09-26 23:55:59 +00:00
Steven Moreland
f07e364ce3 Merge "Fix typo in update makefiles."
am: 9960148420

Change-Id: I949634e72f817f3a5411130e968acd8efd1d7725
2017-09-26 23:51:07 +00:00
Steven Moreland
a5299ee739 Fix typo in update makefiles.
Bug: 37518178
Test: pass
Change-Id: Ic401b3a473f15ca4c01e58b3072e19db7c31b653
2017-09-26 21:59:43 +00:00
Steven Moreland
7741c0e17b Update makefiles for hidl adapter. am: 26a0bb2762 am: 73949c1d7e am: b94d0c7290
am: 97228c0b7d

Change-Id: Ic4b459b7c1a4325453945b0b00db8f44e4e77c26
2017-09-26 13:36:09 +00:00
Steven Moreland
97228c0b7d Update makefiles for hidl adapter. am: 26a0bb2762 am: 73949c1d7e
am: b94d0c7290

Change-Id: If766cffbcc003cc0cc5eb98969b924aa918fff44
2017-09-26 12:53:13 +00:00
Steven Moreland
b94d0c7290 Update makefiles for hidl adapter. am: 26a0bb2762
am: 73949c1d7e

Change-Id: I9af2df255ccdac36c8c11bbca973c42ea2e758fe
2017-09-26 12:48:40 +00:00
Steven Moreland
73949c1d7e Update makefiles for hidl adapter.
am: 26a0bb2762

Change-Id: I3a811f5cd49bd4e81e8fcd5c8e88922115812539
2017-09-25 23:14:44 +00:00