Commit graph

58 commits

Author SHA1 Message Date
Rajesh Nyamagoud
3f6c15c656 Restructuring of AAID using aidl_interface build system.
Making changes to use cpp backend generated by aidl_interface
build system for KeyAttestationApplicationProvider.
Removed custom parcelables defined for AAID.
Updated the tests to use the aidl_interface generated bindings.

Bug: 267452060
Test: atest android.keystore.cts.KeyAttestationTest; atest
keystore_unit_tests; keystoreSignature_fuzzer;
keystorePackageInfo_fuzzer; keystoreApplicationId_fuzzer;
keystoreAttestationId_fuzzer

Change-Id: Ibdfb8e2837538d01a04b6771b1a71c38529d1307
2023-10-06 04:23:41 +00:00
Alix
cb159ffa9f Deleted clang property in Android.bp files
Deleted deprecated clang property in Android.bp files using bpmodify.

Bug: 208980553
Test: treehugger
Change-Id: Id79d4e319ffc7d45b508772ae0df2e43bd22bf8f
2022-04-25 21:04:48 +00:00
David Drysdale
c4e0d5bed1 Use defaults to reference current keystore AIDL
The KeyMint HAL will soon be updated for a new version, which will in
turn induce a version bump for the keystore2 AIDL interface. To make
this process easier, add cc_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: I8999de92443fd121a9515dccde8d76094dc93023
2021-12-02 08:19:40 +00:00
Aditya Wazir
4f33d5e290 libkeystore-attestation-application-id: Updated Android.bp
Updated Android.bp to build both static and shared library

Test: Build libkeystore-attestation-application-id
Bug: 187131475

Change-Id: Ica9710a701db0cd4fdc07c67514510f8305eb0ef
2021-11-02 21:40:00 +00:00
Treehugger Robot
4181f76592 Merge "Revert "libkeystore-wifi-hidl: Updated to vendor_available:true"" 2021-09-02 17:17:32 +00:00
Aditya Vasu Wazir
40353d8f97 Revert "libkeystore-wifi-hidl: Updated to vendor_available:true"
This reverts commit 64ce92520d.

Reason for revert: 'vendor_available:true' is no longer required

Change-Id: I9430bc9744bf7af91bf9a0b7faf6e553c273d3b1
2021-09-02 11:05:53 +00:00
Jiyong Park
0d61dd6c3a Remove ndk_platform backend. Use the ndk backend.
The ndk_platform backend will soon be deprecated because the ndk backend
can serve the same purpose. This is to eliminate the confusion about
having two variants (ndk and ndk_platform) for the same 'ndk' backend.

Bug: 161456198
Test: m
Change-Id: Ibeb4178f99857be75bb5f83a073a2d679058d921
2021-07-27 12:20:26 +09:00
Aditya Wazir
64ce92520d libkeystore-wifi-hidl: Updated to vendor_available:true
Updated libkeystore-wifi-hidl from 'vendor: true' to 'vendor_available: true'

Test: Build libkeystore-wifi-hidl
Bug: 187130384

Change-Id: Ifba05b57248f52ac33e297acd5d0b7811e3524ee
2021-06-11 11:06:26 +05:30
Aditya Wazir
f6c3bfc428 libkeystore-wifi-hidl: Updated Android.bp
Updated Android.bp to build both static and shared library

Test: Build libkeystore-wifi-hidl
Bug: 187130384

Change-Id: Idd0f35fc33a224c598fc3e96f11f88cacf5c9aba
2021-06-11 11:06:10 +05:30
Janis Danisevskis
2437fde7a6 Keystore 2.0: Remove Keystore 1.0 and remaining references
* Remove superseded keystore engine backends.
* Remove keystore_cli.
* Update keystoer_cli_v2 to use Keystore 2.0.
* Update confirmationui invocation test.
* Remove reference to enable keystore2 property from keystore2.rc.

Test: N/A
Bug: 171305684

Change-Id: I855dead9d95c2c8cfa451944087bc8290871c0e5
2021-03-22 14:34:45 -07:00
Bob Badour
4c7858c848 [LSC] Add LOCAL_LICENSE_KINDS to system/security
Added SPDX-license-identifier-Apache-2.0 to:
  fsverity_init/Android.bp
  identity/Android.bp
  keystore/tests/Android.bp
  keystore2/Android.bp
  keystore2/aaid/Android.bp
  keystore2/aidl/Android.bp
  keystore2/apc_compat/Android.bp
  keystore2/selinux/Android.bp
  keystore2/src/crypto/Android.bp
  keystore2/src/km_compat/Android.bp
  ondevice-signing/Android.bp
  provisioner/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  Android.bp
  keystore/Android.bp

Added SPDX-license-identifier-BSD to:
  keystore-engine/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Ic9e19695bd19c3f127dfd545df60e4c9df89af77
2021-02-14 10:37:25 -08:00
Hasini Gunasinghe
8c8c2d4676 Log keystore key attestation events using statsd.
This is the third CL on sending keystore logging to statsd.
This creates the logs for key attestation events.
Test: Adding tests for logging is yet to be decided.
Bug: 157664923
Merged-In: I412ac59fd6bb2dbcb380f8579740d02ce2fd8790
Change-Id: I16cac8c4ee950adc330659dcb648052e8b2b41a2
2020-08-12 16:19:11 +00:00
Hasini Gunasinghe
242460eac7 Log keystore key operation events using statsd.
This is the second CL on migrating keystore logging to statsd.
This migrates the logging for key operation events.
Three new ResponseCodes are added for the logging purpose of the
	abort operations.

Test: Adding tests for logging is yet to be decided.
Change-Id: Iede72341b0f4c80199c9e16cef96a5d98bca8754
Merged-In: I68c1d89beeb733e4b6ba493b8d95935b7e73df60
2020-08-12 15:11:11 +00:00
Hasini Gunasinghe
4e55c2f279 Log keystore key creation events using statsd.
This is the first CL on migrating keystore logging to use statsd.
This migrates the logging for key creation events
	(generation/import).
A work-around is implemented to handle repeated fields via bitmaps
	because statsd does not support repeated fields as of now.

Test: Adding tests for logging is yet to be decided.
Bug: 157664923
Change-Id: Id23724cfbd21dca8ef5fd77e5712c0bc2e727f4b
Merged-In: Id23724cfbd21dca8ef5fd77e5712c0bc2e727f4b
2020-08-06 13:52:36 -07:00
David Zeuthen
59102f388f keystore: Pass verification token to credstore along with requested auth token.
This is needed because the Secure Areas backing the Identity
Credential HAL may exist in a different environment from where the
auth token is minted. In this case, the Secure Area needs a
verification token to make sense of the timestamp in the auth token.

Getting a verification token is an asynchronous operation so change
the binder method used by credstore to be asynchronous as well.

Bug: 156076333
Test: atest VtsHalIdentityTargetTest
Test: atest android.security.identity.cts
Change-Id: Id6cb6812a31d968069b7d72bd2b39b512d38d241
2020-05-08 11:30:49 -04:00
Shawn Willden
a97aea4040 Update keystore to use KM4.1.
This is the first part of the update, adjusting keystore to use the
KM4.1 interface, but not call any of the new methods.  That will come
in a subsequent CL.

Test: CtsKeystoreTestCases
Change-Id: Ib7486aad46c144471a1607eec31b8df1059a511d
Merged-In: Ib7486aad46c144471a1607eec31b8df1059a511d
2020-02-11 15:51:04 -07:00
David Zeuthen
f2a28671b0 Factor keystore_attestation_id into library and also use this in credstore.
This was needed because credstore needs to generate and pass the
generated AttestationApplicationId to the Identity Credential HAL.

Bug: 111446262
Test: atest android.security.identity.cts
Test: VtsHalIdentityCredentialTargetTest
Test: android.hardware.identity-support-lib-test
Change-Id: Id22b85ca083e23c7e1fbd3459910fba37a5db137
2020-01-31 16:23:30 -05:00
Roshan Pius
2650acc912 keystore: Move wifi keystore HAL service out
Also, removed the mutex added to protect keystore service internals
from synchronous HIDL calls.

Bug: 142969896
Test: Verified connecting to passpoint networks.
Change-Id: Iffb7dc6bbde6d205519ffdafeb0bd53fbc5611b1
Merged-In: Iffb7dc6bbde6d205519ffdafeb0bd53fbc5611b1
2019-10-28 14:03:16 -07:00
Steven Moreland
de99a52dc4 Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: I940228446b6f5b747399b408ad9af652ac618fda
2019-09-05 14:18:17 -07:00
bohu
cccab483c1 disable simplicit-signed-integer-truncation anitizer in keystore
It is crashing keystore

BUG: 123630767
Change-Id: I66f91286cc643a0e4a5e72716def13ba21b098a8
2019-02-01 11:47:14 -08:00
Branden Archer
84e7231d73 Grant VTS tests all permissions in keystore on userdebug/eng
A VTS test for the Wifi Keystore HAL is being created. The test
is run as root and attempts various operations that directly
use the Keystore service. By default that test will not be
able to perform necessary actions to exercise the HAL code,
such as creating keys for tests.

This change will enable the root user to perform all key
operations, but only on userdebug and eng builds. In addition,
the root user will be able to perform actions on behalf of the
wifi user; this is necessary as some operations in the Wifi
Keystore HAL assume the wifi user.

Bug: 120182820
Test: atest system/hardware/interfaces/wifi/keystore/1.0/vts/
      functional/VtsHalWifiKeystoreV1_0TargetTest.cpp

Change-Id: Ic6eb5748e0e19b64a44c4bdf88a7074f7367db3d
2019-01-29 11:16:53 -08:00
Treehugger Robot
91df8c0c63 Merge changes from topic "keystore-niap"
* changes:
  Increase the master key size to 256 bits
  Use vector to pass around keys
  Use SHA256 for 32 byte keys
  Replace Entropy with RAND_bytes
2019-01-11 16:59:09 +00:00
Branden Archer
44d1afa2c0 Replace Entropy with RAND_bytes
/dev/urandom is not an approved random number generator
for NIAP certification. Changing to use BoringSSL's
RAND_bytes(), which is approved.

Bug: 121272336
Test: Ran Keystore CTS tests against Walleye
Change-Id: I579d140ef56c90b477b0d8989e3b02375681aee8
2018-12-28 10:19:15 -08:00
Elliott Hughes
f1d336b64e C++17 is now the default.
Test: builds
Change-Id: Ib96ce1db95dfef6d2b5a269ee47dbd0a89650bc4
2018-12-05 19:48:42 -08:00
Eran Messeri
2ba77c303c KeyStore: Fix key name decoding
The key name is encoded into the filename containing the (encrypted) key
material.

Since the key name might contain characters that are not valid in a
filename, the name is encoded using a multi-character custom encoding
scheme.

However, the decoding function did not decode the key name correctly -
in particular, spaces were decoded to 'P', causing CtsVerifier tests
that install a key with a space in the name to fail (due to internal
inconsistency between the key names in KeyChain's DB and key names
obtained from Keystore).

Fix by correctly compensating for the "carrier" character.

Test: atest keystore_unit_tests
Bug: 116716944
Change-Id: I0326a9d9e6912b04bb13b3b350ead8ddcfcc12f8
2018-12-04 12:35:27 +00:00
Rob Barnes
bb6cabdaa1 Multi-threaded keystore
This patches changes the keystore to use the asychronous api model for
begin, update, finish, and abort.

Also removes unused class KeystoreArguments (aidl and implementation).

Test: Keystore CTS tests
Bug: 111443219

Change-Id: Icc6def9ff6dbe32193272d7d015079a006ebc430
2018-11-14 14:01:45 -08:00
Janis Danisevskis
ff3d7f4b83 Multithreaded Keystore
This patch transitions keystore a threading model with one dispatcher
thread and one worker thread per keymaster instance, i.e. fallback, TEE,
Strongbox (if available). Singleton objects, such as the user state
database, the enforcement policy, and grant database have been moved to
KeyStore and were made concurrency safe.
Other noteworthy changes in this patch:

* Cached key characteristics. The key characteristics file used to hold
  a limited set of parameters used generate or import the key. This
  patch introduces a new blob type that holds full characteristics as
  returned by generate, import, or getKeyCharacteristics, with the
  original parameters mixed into the software enforced list. When
  keystore encounters a lagacy characteristics file it will grab the
  characteristics from keymaster, merge them with the cached parameters,
  and update the cache file to the new format. If keystore encounters
  the new cache no call to keymaster will be made for retrieving the
  key characteristics.
* Changed semantic of list. The list call takes a prefix used for
  filtering key entries. By the old semantic, list would return a list
  of aliases stripped of the given prefix. By the new semantic list
  always returns a filtered list of full alias string. Callers may
  strip prefixes if they are so inclined.
* Entertain per keymaster instance operation maps. With the introduction
  of Strongbox keystore had to deal with multiple keymaster instances.
  But until now it would entertain a single operations map. Keystore
  also enforces the invariant that no more than 15 operation slots are
  used so there is always a free slot available for vold. With a single
  operation map, this means no more than 15 slots can ever be used
  although with TEE and Strongbox there are a total of 32 slots. With
  strongbox implementation that have significantly fewer slots we see
  another effect of the single operation map. If a slot needs to be
  freed on Stronbox but the oldest operations are on TEE, the latter
  will be unnecessarily pruned before a Strongbox slot is freed up.
  With this patch each keymaster instance has its own operation map and
  pruning is performed on a per keymaster instance basis.
* Introduce KeyBlobEntries which are independent from files. To allow
  concurrent access to the key blob data base, entries can be
  individually locked so that operations on entries become atomic.
  LockedKeyBlobEntries are move only objects that track ownership of an
  Entry on the stack or in functor object representing keymaster worker
  requests. Entries must only be locked by the dispatcher Thread. Worker
  threads can only be granted access to a LockedKeyBlobEntry by the
  dispatcher thread. This allows the dispatcher thread to execute a
  barrier that waits until all locks held by workers have been
  relinquished to perform blob database maintenance operations, e.g.,
  clearing a uid of all entries.
* Verification tokens are now acquired asynchronously. When a begin
  operation requires a verification token a request is submitted to the
  other keymaster worker while the begin call returns. When the
  operation commences with update or finish, we block until the
  verification token becomes available.

As of this patch the keystore IPC interface is still synchronous. That
is, the dispatcher thread dispatches a request to a worker and then
waits until the worker has finished. In a followup patch the IPC
interface shall be made asynchronous so that multiple requests may be in
flight.

Test: Ran full CTS test suite
      atest android.keystore.cts
Bug: 111443219
Bug: 110495056
Change-Id: I305e28d784295a0095a34810d83202f7423498bd
2018-10-31 14:31:26 -07:00
Dan Willemsen
418db44676 Match src paths with aidl package name
In order for the build system to track updates to the header files
during incremental builds, always specify the src files using the same
path as the package for C++ compilations.

Bug: 112114177
Test: m
Change-Id: Ia82483523a9398ad597ee128faffa2b4b1927f0d
2018-09-14 21:28:12 -07:00
Brian Claire Young
3133c45b12 Use correct call to get Android user ID
Rather than trying to store the active user ID, use
multiuser_get_user_id to pull the actual ID for the caller. This will
now behave correctly when called by background processes.

Test: CtsKeystoreTestCases, from both owner and guest users
Bug: 113280004
Change-Id: I73fd2ef2ac4b1ceb7ec3792761e827d801d0d905
2018-09-07 11:22:35 -07:00
Eran Messeri
03fc4c8769 KeyStore: Limit the Attestation Application ID
Limit the size of the Application ID attestation vector _prior_ to
sending it for attestation by Keymaster.
Previously, the Attestation Application ID vector would be DER-encoded
to contain all packages belonging to the caller UID, and only then
truncated to the max value that could be sent to Keymaster (1K),
potentially resulting in malformed DER-encoded data.

This makes clients' lives hard, as they would have to deal with
malformed DER, and breaks CTS tests that expect to parse this field in
the attestation record, when the device has too many packages running on
the system UID.

This change limits the size of the DER-encoded vector that would be
passed into Keymaster by estimating the encoded size and refraining from
adding any more package information into it if it'd exceed 1K when
encoded.

Also, cope with PackageManager failure to provide the list of packages.

Merged-In: I39ab9338922f7be358d27e1b2dae5d0a36009109

Test: keystore_unit_tests (adb pushed to /data/local/tmp, then: LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/keystore_unit_tests)
Test: runtest --path cts/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement
Bug: 112179406
Bug: 112061724
Bug: 111260028
Change-Id: I0759a632fbf678814f6b1c258f0b2e2524edb85c
2018-08-16 18:53:15 +01:00
Dan Willemsen
8bd06cd485 Merge "Remove unused tags property from Android.bp files" am: 9835d2ca30
am: d32fdf4de5

Change-Id: Ie8041bd2cdb4f9cf467c184af97f1b1591b972b4
2018-05-08 23:15:24 -07:00
Dan Willemsen
861d4a1363 Remove unused tags property from Android.bp files
The tags property is (and has always been) unused by Soong. The property has
been defined as a list of strings, and the `androidmk` converted any
LOCAL_MODULE_TAGS entries over to it, but we've never done anything with it.

In preparation for removing the definition from Soong, I'm removing it from all
Android.bp files in the tree.

Since this has never done anything, this is a no-op, but if you really did want
the Android.mk behavior, the proper way to define a module to be installed in
userdebug / eng builds is to use PRODUCT_PACKAGES_DEBUG or PRODUCT_PACKAGES_ENG
in the appropriate product makefile.

Change-Id: I5fcb36529115f6bce1a14677f894b25fabfe4383
Exempt-From-Owner-Approval: global no-op build change
Test: remove `tags` from Soong, see errors go away.
2018-05-08 17:15:29 -07:00
Max Bires
33aac2dda2 Adding DropBox logging support for keystore functionality
This will allow us to track the actual usage patterns of keystore
functions and error occurences.

Bug: 36549319
Test: DropBox logging works for keystore tags
Change-Id: Iadfba3afebaa0be753212b1111b68f50b77f9978
(cherry picked from commit d6d8952b34)
2018-04-25 21:46:08 +00:00
Brian Young
9a947d573b Restore "Add "Unlocked device required" parameter to keys"
dd 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 ccb492da44.

Test: CTS tests in I8a5affd1eaed176756175158e3057e44934fffed

Bug: 67752510

Merged-In: I485e0855c4a09073e067c1a628f7d93eab489483
Change-Id: I485e0855c4a09073e067c1a628f7d93eab489483
(cherry picked from f6125de02d)
2018-03-28 08:38:57 -07:00
Brian Young
9371e95bb0 Add "unlocked device required" keystore 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.

This commit adds the API only, full functionality will be added in a
later change.

Test: CTS tests in CtsKeystoreTestCases

Bug: 67752510

Merged-In: I210fbb635a2c98e3d6208859387a5eb3f10ab976
Change-Id: I210fbb635a2c98e3d6208859387a5eb3f10ab976
(cherry picked from commit 947877a55c)
2018-03-28 08:38:57 -07:00
Brian Young
ccb492da44 Revert "Restore "Add "Unlocked device required" parameter to keys""
This reverts commit 05900c1ad8.

Reason for revert: Regression in creating auth-bound keys

Bug: 73773914

Bug: 67752510

Change-Id: I2b247ec871d2a0a2adb9100559e4c821aeba265d
2018-02-23 01:31:22 +00:00
Brian C. Young
05900c1ad8 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 1b75929a58.

Test: CTS tests in I8a5affd1eaed176756175158e3057e44934fffed

Bug: 67752510

Change-Id: I4becf698f8bc34b7a9d53ab2200480480fdd1a9c
2018-02-15 11:16:38 -08:00
Logan Chien
3bd6a51a6d Fix PDK build
This commit moves "IConfirmationPromptCallback.aidl" and
"IKeystoreService.aidl" to "system/security/keystore/binder" so that
"libkeystore_aidl" can be built in PDK builds.

Test: Run `cts-tradefed run cts -m CtsKeystoreTestCases` on Pixel 2017
and the test results are idential with and without this CL.

Test: Build PDK with special manifest described in
http://b/69539820#comment18 and http://b/69539820#comment19.

Test: Build a target (described in http://b/72961456) with
`platform.zip` built from master FSK source tree.

Bug: 69539820
Bug: 72961456
Change-Id: Ia0979568835efaf24508b0fac97357c85fd3f44c
2018-02-14 15:46:18 +08:00
Brian Young
1b75929a58 Revert "Add "Unlocked device required" parameter to keys"
This reverts commit 5407bf1ece.

Reason for revert: Build breakages on elfin, gce_x86_phone.

Bug: 72679761
Bug: 67752510
Change-Id: I1a4f8f725fe3aa7195f266ed77bbb7f4cccaa662
2018-01-30 15:31:47 +00:00
Brian C. Young
5407bf1ece 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: Ie526a1beb2ddb6aa10eb77e896e74363db14adaa
2018-01-25 10:28:48 -08:00
TreeHugger Robot
b6de2e0eb9 Merge "Add support for confirmation APIs." 2018-01-25 17:31:38 +00:00
Shawn Willden
eedcfe96d1 Move Keymaster wrappers to the KM4 support lib
Test: CTS
Change-Id: Id84de1d4bcc9643ffa24a678ad5d0d2385baec5e
2018-01-18 15:38:55 -07:00
David Zeuthen
c6eb7cd999 Add support for confirmation APIs.
This code implements new keystore APIs for confirmations.

Also add new 'confirmation' verb to the keystore_cli_v2 command to be
used for testing confirmations. It will block until there's a
callback. Example invocations:

 phone:/ # keystore_cli_v2 confirmation --prompt_text="Hello World" --extra_data=010203 --ui_options=1,2,3
 Waiting for prompt to complete - use Ctrl+C to abort...
 Confirmation prompt completed
 responseCode = 0
 dataThatWasConfirmed[30] = {0xa2, 0x66, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x6b, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x65, 0x65, 0x78, 0x74, 0x72, 0x61, 0x43, 0x01, 0x02, 0x03}
 phone:/ #

If a prompt is already being shown, the |OperationPending| return code
(code 3) is returned:

 phone:/ # keystore_cli_v2 confirmation --prompt_text="Hello World" --extra_data=010203 --ui_options=1,2,3
 Presenting confirmation prompt failed with return code 3.

Canceling a prompt:

 phone:/# keystore_cli_v2 confirmation --prompt_text="Hello World" --extra_data=010203 --cancel_after=1.5
 Sleeping 1.5 seconds before canceling prompt...
 Waiting for prompt to complete - use Ctrl+C to abort...
 Confirmation prompt completed
 responseCode = 2
 dataThatWasConfirmed[0] = {}

Bug: 63928580
Test: Manually tested.
Change-Id: Ida14706ad066d5350b9081eb7821c7b1a1472dd2
2018-01-17 15:38:44 -05:00
Janis Danisevskis
c1460141c0 KeyStore: use security level to chose keymaster device
Keymaster4 introduces security levels. Android devices
may have multiple keymaster implementations, one for each
possible security level, where the presence of a strong
security level implies the presence of all lower levels.

This patch adds code that enumerates all keymaster device
implementations available from ServiceManager and populates
Keystore's keymaster device database with at most one keymaster
implementation per security level. It gives precedence to
newer versions if multiple implementations exist for the same security
level.

The security level is chosen by a set of flags passed to the keystore
operations generate, import, addRngEntropy.
For existing keys the right security level is chosen by the blob flags.

To that end a new flag KEYSTORE_FLAG_STRONGBOX was added, and the
security level is expressed through a combination of
KEYSTORE_FLAG_FALLBACK (F) and KEYSTORE_FLAG_STRONGBOX (S).
Encoding is as follows:

             F     S
Software     1     X (don't care)
TEE          0     0
Strongbox    0     1

Some operations in keystore cli2 where amended with the optional
--seclevel flags. Allowing the user to chose the security level for the
given operation. Possible options are "software", "strongbox", and "tee"
where tee is the default value.

Test: Existing KeyStore CTS tests run

Change-Id: I01ef238f5e7067e480cf9b171630237236046bb1
2017-12-27 16:38:09 -08:00
Shawn Willden
bb22a6c50d Use libkeymaster4support in keystore.
Test: CTS
Change-Id: Iee8f308a5255a03b02fce162cc4184d45f75fd1b
2017-12-27 09:24:19 -08:00
Shawn Willden
2e0282a08d Remove libkeymaster_staging
Test: Builds
Change-Id: I830c22745ca5f19eb53ef1862e5cfc4b080d7d6a
2017-12-21 12:51:18 -07:00
Shawn Willden
0329a82c48 Move keystore to Keymaster4
Test: CTS
Change-Id: I6b7fa300f505ee685b1fe503edea3188225a98e3
2017-12-20 09:01:01 -07:00
Shawn Willden
c67a8aa3f5 Add abstract wrapper around IKeymasterDevice.
The "Keymaster" class provides an abstraction that hides the
underlying implementation.  It will always inherit the current
IKeymasterDevice version and extend it with additional pure virtual methods
that are used by keystore to query for meta information.  This class
will in turn have subclasses which will wrap an instance of each
different version of IKeymasterDevice that we support.

Test: CTS
Change-Id: I62420dc0a8c196bb3f19753a8f304d46a75fae0e
2017-12-20 08:45:29 -07:00
Shawn Willden
fa5702fbf0 Rename keystore.{h|cpp} to KeyStore.{h|cpp}
We currently have two different keystore.h files.  This renames one of
them, and the corresponding implementation, to KeyStore.h, which
tracks the class name.

Test: runtest --path cts/tests/tests/keystore/src/android/keystore/cts
Change-Id: I910e3d60d165b65d055e7da92acd04d3ee73a6d3
2017-12-18 20:59:31 -07:00
Rubin Xu
0d0e113f8f Build keystore_cli_v2
Add back keystore_cli_v2 to the system image, which was missing after switching
to Android.bp. Ideally we should only build this for userdebug/eng builds.

Bug: 69351686
Test: builds
Change-Id: Id2cbc024af79b042e3d49913758cc39c4cf9f432
2017-12-08 15:50:50 +00:00