Commit graph

63 commits

Author SHA1 Message Date
Shawn Willden
6715433ca7 Merge "Test import of a EC P-521 key." into oc-dev
am: ad40c6ccd7

Change-Id: I42bd0035153a5312b4654ec8b27f6ad6589d56e1
2017-06-23 15:39:19 +00:00
Shawn Willden
709e2e1ed9 Test import of a EC P-521 key.
This failure is also diagnosed by CTS, but it should be validated in VTS
as well.

Merged-In: Ia7654ff8813942fbca9dfa838337e9de5839a9e2
Bug: 33945114
Test: adb shell data/nativetests64/VtsHalKeymasterV3_0TargetTest/VtsHalKeymasterV3_0TargetTest
Change-Id: Ia7654ff8813942fbca9dfa838337e9de5839a9e2
2017-06-22 15:14:30 -06:00
Shawn Willden
18996b5aa5 Merge "Check return from DeleteKey correctly." into oc-dev
am: c4f859d1b5

Change-Id: Id817044028fa9bf060305fa7864d8d89755353dc
2017-06-21 00:54:09 +00:00
TreeHugger Robot
c4f859d1b5 Merge "Check return from DeleteKey correctly." into oc-dev 2017-06-21 00:45:17 +00:00
Janis Danisevskis
324ffd65ee Merge "Purge unsupported RSA key sizes from VTS tests" into oc-dev
am: bc970b089f

Change-Id: Id40754b5761b2acca8a487d33a4479c3d9fb0c33
2017-06-14 02:32:40 +00:00
Janis Danisevskis
39daaa0f96 Purge unsupported RSA key sizes from VTS tests
Support for 256 bit RSA keys are not mandated by keymaster specs and
must not be used in the VTS tests.

Bug: 62581389
Change-Id: If315088db2752ac2efe31fdb95db7ca13c3ce225
2017-06-13 13:30:15 -07:00
Janis Danisevskis
d4c2e5d8a5 Fix expected attestation version.
am: 538b7d85ef

Change-Id: I5ba0326f7e2f1547a1e08c2f44055a8938414ae4
2017-06-08 01:55:37 +00:00
Janis Danisevskis
538b7d85ef Fix expected attestation version.
The attestation version cannot be infered from the keymaster version
because we provide software attestation for legacy keymaster 1 keys.
This patch changes the attestation test to expect either attestation
version 1 or 2.

Bug: 37351644
Test: VtsHalKeymasterV3_0TargetTest
Change-Id: I4db83a543db20191d288b2ca8308aa6597cd8e22
2017-06-07 11:49:56 -07:00
Shawn Willden
392db77668 Annotate DeleteKey test with bug number.
am: abcd323019

Change-Id: I1e3eb2b93c0054fb48fc8dbd9e844a74736afe46
2017-06-01 15:26:30 +00:00
Shawn Willden
abcd323019 Annotate DeleteKey test with bug number.
Bug: 37623742
Change-Id: I2cb4bb39bacb3aabf5fff7937f60c7355c9636e3
Test: VTS test, manually run
2017-06-01 07:47:04 -06:00
Shawn Willden
1c69c5fcb8 Check return from DeleteKey correctly.
DeleteKey may legitimately return ErrorCode::UNIMPLEMENTED rather than
ErrorCode::OK, but the VTS test didn't allow that in all cases.  In many
case the return code was also left unchecked.

Test: adb shell/data/nativetest64/VtsHalKeymasterV3_0TargetTest/VtsHalKeymasterV3_0TargetTest
Bug: 62193967
Change-Id: I19a90a87850675b0700baf7409e57098e0584d54
2017-06-01 07:44:27 -06:00
Steven Moreland
f203167814 Update makefiles. (2/2)
am: 76cfb84140

Change-Id: I24d21438a5b2f447d2160929c6ff6e17b2b66820
2017-05-22 17:15:20 +00:00
Steven Moreland
76cfb84140 Update makefiles. (2/2)
Adds default configuration for all hals.

Bug: 38415912
Test: pass
Change-Id: Idd1f3a2b7b16ad956d31784a513e93a066cdd02e
2017-05-19 15:54:03 -07:00
Steven Moreland
a32ebce372 Update makefiles for c++-sources and c++-headers. (2/2)
am: bc71124120

Change-Id: Icf36068a4d863a8520854c7a83e51f960c188e12
2017-05-11 00:48:55 +00:00
Steven Moreland
bc71124120 Update makefiles for c++-sources and c++-headers. (2/2)
Test: pass
Bug: 38174080
Change-Id: Icad451f9f9ad5f46412356a4171a8a1222f8e545
2017-05-09 19:58:43 -07:00
Shawn Willden
bc25041f6e Merge "Add missing application ID tag to AES/HMAC attestation calls" into oc-dev
am: 585acc6778

Change-Id: I613bc59b8eeeed229131fcff32835e91d26adda6
2017-05-05 17:43:22 +00:00
TreeHugger Robot
585acc6778 Merge "Add missing application ID tag to AES/HMAC attestation calls" into oc-dev 2017-05-05 17:29:21 +00:00
Shawn Willden
839ef0db40 Merge "Fix Keymaster HAL crash." into oc-dev
am: a22bc7450b

Change-Id: I7c765d18c3a6fc8e9741e45802f2991b07cf6fdf
2017-05-03 21:59:29 +00:00
TreeHugger Robot
a22bc7450b Merge "Fix Keymaster HAL crash." into oc-dev 2017-05-03 21:50:23 +00:00
Steven Moreland
5c63b11f76 Remove redundant dependencies
android.hidl.base@1.0 and android.hidl.manager@1.0 are built into libhidltransport.

Test: links
Bug: 33276472
Merged-In: I08aaad80f7e2fc262aa3a8b66fe932e8133a928d
Change-Id: I08aaad80f7e2fc262aa3a8b66fe932e8133a928d
2017-05-02 15:29:30 -07:00
Janis Danisevskis
0c3dd48665 Fix KM3.0 deleteKey behavior inconsistent with VTS test.
Keymaster 3.0 VTS test required that deleteKey returns
ErrorCode::OK even if the key blob parameter is invalid or garbage.
The rationale is that deleteKey shall have the invariant that
key blobs are unusable after the deleteKey call. If it was unusable
before, this invariant is upheld.

This patch makes the legacy wrapper for the Keymaster HAL translate
an ErrorCode::INVALID_KEY_BLOB retuned by the legacy delete_key to
ErrorCode::OK.

Bug: 37351644
Test: Manually run VtsHalKeymasterV3_0TargetTest with legacy keymaster
      HAL installed (tested with sailfish)

Change-Id: Ib22c8b8e10334770a1d4a5570acf16c2c52a6c60
2017-04-27 08:43:25 -07:00
Shawn Willden
58ce93480b Add missing application ID tag to AES/HMAC attestation calls
Test: Manually verified by running VTS
Change-Id: Iaba04736e3ccc43a662407a6c18416f20d0ee4ea
2017-04-27 13:58:36 +00:00
Shawn Willden
fa67c8fc1d Fix Keymaster HAL crash.
Test: VTS test validates this fix
Change-Id: I5996c2166cf4141c97424df64a380f45b001d52e
2017-04-24 08:11:07 -06:00
Bartosz Fabianowski
8304a9040c Finish adding manufacturer and model to device ID attestation
This is a follow-up to change I5a9fd839497976cdb1e44cbe4a2d5b7730732b4c,
where manufacturer and model were added to the set of attestable device
IDs.

Bug: 37522655
Test: GTS com.google.android.gts.security.DeviceIdAttestationHostTest

Change-Id: Ied4246f4fc490feb2093f04c268aab83c8e1326d
2017-04-20 04:47:44 +02:00
TreeHugger Robot
206e38a4e8 Merge "Remove dependency of libhardware_legacy from HAL services" into oc-dev 2017-04-18 00:26:33 +00:00
Hung-ying Tyan
4f1bbf7074 Remove dependency of libhardware_legacy from HAL services
It is not used by these services.

Bug: 33241851
Bug: 37305530
Test: built and tested on sailfish
Change-Id: I1f3f51981d7dfcf27e18d9495c747b7662867d31
2017-04-15 10:17:16 +08:00
Shawn Willden
dc9965665e Require attestation app ID.
Bug: 37318025
Test: Manually tested
Change-Id: Iaa992c8d22e0c88c2a2570355199befa484adc19
2017-04-14 11:38:17 +00:00
Shawn Willden
4b93bb21dc Fix handling of KM3 attestations.
Test: Manually tested
Bug: 37318025
Change-Id: I91c0c0fe6d36fb4a02d6b58a3b0836a6f8996012
2017-04-14 11:37:42 +00:00
Steven Moreland
3b36a83a2e Update makefiles (2/2).
Test: pass
Change-Id: Ic7e6289c7b69785491708ce0acbb657f4c704229
2017-04-11 09:58:03 -07:00
Janis Danisevskis
1cc38f1e9c Adds default keymaster service to the early_hal class
The keymaster service is required by vold which starts very early
during boot up. This leads to the dependency loop:
init->installkey->vdc->vold->keymaster-service->init

This patch resolves this issue by adding service keymaster to the class
early-hal which will get started right after hwservicemanager on devices
that get treble.

Bug: 35764921
Test: Device boots. And lshal shows that service keymaster has two
      clients, keystore and vold.

Change-Id: Id0b6722de900b5513d46adb81d76b02fa6e155df
2017-04-05 17:22:46 -07:00
Janis Danisevskis
88164a4c0e Add DeleteKey and DeleteAllKeys test to Keymaster VTS tests
The tests added verify that a generated key is no longer usable
after it was
 - explicictely deleted with deleteKey, or
 - all keys where deleted with deleteAllKeys.

Bug: 32022681
Test: make vts -j30 BUILD_GOOGLE_VTS=true TARGET_PRODUCT=aosp_arm64 &&
      vts-tradefed run commandAndExit vts --skip-all-system-status-check
      --primary-abi-only --skip-preconditions
      --module VtsHalKeymasterV3_0TargetTest -l INFO
Change-Id: I172ee5d3ccf1850c3c92d3a1a9e991f46b07a0e3
2017-03-31 15:38:27 -07:00
Shawn Willden
63e15f0790 Revert "Revert "Add keymaster VTS tests.""
This reverts commit 8e10baee45.

Test: Tests pass, except known failures with in-progress vendor fixes
Change-Id: Ia95c1444100e123fa65d095b001878cf9040d0c4
2017-03-30 13:21:54 +00:00
Keun Soo Yim
bf0f670580 Merge "Revert "Add keymaster VTS tests."" into oc-dev 2017-03-29 20:19:28 +00:00
Keun Soo Yim
8e10baee45 Revert "Add keymaster VTS tests."
This reverts commit dda22ea884.

Change-Id: Ie6a60e17ed5258840eba3d3f6b8092636160b2c2
2017-03-29 20:18:52 +00:00
Andreas Huber
8074912d8c Merge "Convert all comments into "doxygen-ready" comments." into oc-dev 2017-03-29 18:48:37 +00:00
Andreas Huber
40d3a9bd8c Convert all comments into "doxygen-ready" comments.
Bug: 36453077
Test: mma
Change-Id: I0b1f77dfae5d2258969e33d85ecf45401ffbdfaa
2017-03-29 08:53:58 -07:00
Shawn Willden
dda22ea884 Add keymaster VTS tests.
Note: Recent Google devices have keymaster implementations that don't
pass this test suite.  See https://goo.gl/6hsGwa for a summary.

Bug: 32022681
Test: This is the test suite.
Change-Id: Ib200b68e0c7844df02eb9f086385d6c36e306d45
2017-03-29 13:28:16 +00:00
Steven Moreland
561b602a99 Update makefiles for hwtypes.h
Test: pass
Change-Id: I8e17eb8fec5d2f04c526476a866c8dd54ccb556c
2017-03-28 15:18:20 +00:00
Shawn Willden
031b6050b1 Revert "Add auth token parsing to IKeymasterDevice.hal"
This reverts commit 62f63c7ddb.

Reason for revert: b/36637075

Bug: 36637075
Change-Id: Ie0e8d0b480047a7c68f266e7e5d8a31722f85128
2017-03-28 00:44:17 +00:00
Shawn Willden
62f63c7ddb Add auth token parsing to IKeymasterDevice.hal
Auth tokens have an unfortunate dual character. To most of the system
they are opaque blobs that are intended only to be obtained from one
HAL (e.g. gatekeeper or fingerprint) and passed to another
HAL (keymaster), but keystore actually needs to extract some bits of
information from them in order to determine which of the available blobs
should be provided for a given keymaster key operation.

This CL adds a method that resolves this dual nature by moving the
responsibility of parsing blobs to the HAL so that no component of the
framework has to make any assumptions about their content and all can
treat them as fully opaque. This still means that the various HAL
implementers have to agree on content, but they also have to agree on an
HMAC key which much be securely distributed to all at every boot, so
asking them to agree on an auth token format is perfectly
acceptable. But now the Android system doesn't have to care about the
format.

Bug: 32962548
Test: CTS tests pass, plus manual testing.
Change-Id: I78aa6e4ea9c5d8f34906b0969909387e2c5894e6
2017-03-24 22:22:34 -06:00
Shawn Willden
d4417fb982 Add digest support and implementation name to getHardwareFeatures
This is needed to support the keystore statistics gathering initiative.
It will allow us to get information about what kinds of keymaster
implementations exist in the ecosystem, and which ones fail in which
ways.

Bug: 36549319
Test: Will add to VTS tests
Change-Id: I49ee4623656060d69a6de7723b11cd715150451a
2017-03-25 02:09:14 +00:00
TreeHugger Robot
dc039363d9 Merge "Add manufacturer and model to device ID attestation" 2017-03-23 00:01:46 +00:00
Janis Danisevskis
b77dbe37c1 Check for unimplemented keymaster function delete_key
delete_key is optional and may not be implemented by
a legacy hal. So the function pointer must be checked for
nullptr prior to being used.

Bug: 36500704
Test: run VTS tests with legacy hal that does not implement delete_key
Change-Id: Ie51dd173314826ef260319153c7df96d88b8a42f
2017-03-22 10:46:41 -07:00
Bartosz Fabianowski
2377553df2 Add manufacturer and model to device ID attestation
Discussions have shown that in addition to brand, device and product,
we should also allow devices to attest their manufacturer and model.

Bug: 36433192
Test: GTS com.google.android.gts.security.DeviceIdAttestationHostTest

Change-Id: I5a9fd839497976cdb1e44cbe4a2d5b7730732b4c
2017-03-20 14:01:03 +01:00
TreeHugger Robot
33b3a66047 Merge "keymaster HAL uses "default" service name" 2017-02-25 01:57:45 +00:00
Chris Phoenix
06be50266b keymaster HAL uses "default" service name
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.

Test: marlin boots

Bug: 33844934
Change-Id: I6533e4fe0e63e2d0b0158148f5e438bb4b6b5886
2017-02-24 14:31:22 -08:00
Steven Moreland
7e73d5b908 Remove viral dependency on libhwbinder. (2/2)
find hardware/interfaces -name Android.mk -exec sed -i -e '/libhwbinder
\\/d' {} \;
find hardware/interfaces -name Android.bp -exec sed -i -e
'/"libhwbinder"/d' {} \;
./hardware/interfaces/update-makefiles.sh

Note, automotive has some actual dependencies on libhwbinder, filed
b/35758626 for this.

Test: everything links
Test: (sanity) booted marlin on internal master with these changes
Bug: 35710429
Change-Id: I6d0726c8130d00684b978efbdd48e3ae396f12e5
2017-02-24 12:18:01 -08:00
TreeHugger Robot
da1773c3ce Merge "Have generateKey() treat additional entropy as optional" 2017-02-14 13:01:00 +00:00
Bartosz Fabianowski
50624e995d Have generateKey() treat additional entropy as optional
KeyStore.generateKey() takes an entropy parameter. This is optional
and can be null. That is how KeyStore used to work but a recent
refactor made us always feed the entropy to keymaster, even if it
is empty (null or byte[0] on the Java side). This CL makes us ignore
such empty entropy again.

We only noticed this because a recently added GTS test that happens
to set the entropy to null is failing on some hardware (other
keymaster implementations silently ignore this invalid attempt to
set entropy).

Bug: 35156555
Test: gts-tradefed run gts --module GtsGmscoreHostTestCases
      --test com.google.android.gts.security.DeviceIdAttestationHostTest

Change-Id: Iadaf40e69350c17dd18e4dc2a1dab97fa911e1bf
2017-02-14 11:24:38 +01:00
Steven Moreland
a0da1a1c3d Move hidl shims to the vendor partition. (2/2)
We need google shims on the vendor partition because they are providing
an implementation of a vendor defined interface. They were written by
google just as a courtesy/to make the transition easier. They're
basically a set for vendors to assemble their hal implementations
from.

Bug: 34135607
Test: marlin persist.hal.binderization on/off
Change-Id: I2e2af5af39264cf290259755bb9b2eb9827a21f5
2017-02-13 15:03:41 -08:00