Commit graph

2734 commits

Author SHA1 Message Date
Janis Danisevskis
2c08401f93 Keystore 2.0: Add support for the new CERTIFICATE_* tags.
Test: Keystore CTS tests
Change-Id: Ifbecd4517e8b6fb143283ed3f815aed4812a3c4a
2021-02-07 19:12:00 -08:00
Treehugger Robot
ae6899d2d9 Merge "Adding remote provisioning AIDL interface" 2021-02-06 01:20:34 +00:00
Treehugger Robot
0c7a5fd83b Merge "Adding remote provisioning functionality" 2021-02-06 01:20:34 +00:00
Treehugger Robot
01d8f1be2b Merge changes I98272fb0,I1ce8ca51
* changes:
  Keystore 2.0: No longer transition to database directory.
  Keystore 2.0: Make per boot database an in memory db.
2021-02-04 22:57:59 +00:00
Janis Danisevskis
3f2955c325 Keystore 2.0: No longer transition to database directory.
Keystore no longer transitions to the database directory as its working
directory. This allows keystore to start before data is mounted.

Test: keystore starts and early.
Change-Id: I98272fb0e97e8fe93eb87a657286681c78d28a60
2021-02-04 12:50:41 -08:00
Janis Danisevskis
b00ebd0c8c Keystore 2.0: Make per boot database an in memory db.
Test: keystore2_test
Change-Id: I1ce8ca517af2dc2777cbb23b52ea6a8df89cc99d
2021-02-04 12:50:41 -08:00
Max Bires
2b2e656418 Adding remote provisioning functionality
This commit provides the tables and database access functionality that
will be needed by Keystore to implement its portion of remote
provisioning.

Test: atest keystore2_test
Change-Id: I5b79b1df2896387511759c0a6fadca80edf528fc
2021-02-04 09:06:40 -08:00
Max Bires
148c08e1e7 Adding remote provisioning AIDL interface
This commit adds the AIDL interface required to use remote provisioning,
as well as the implementation.

Test: tbd
Change-Id: I28ade347a00210f4bc3b74664873c2cf5221adb0
2021-02-04 09:00:42 -08:00
Treehugger Robot
2b3ca3c367 Merge "Keystore 2.0: Adding uuid field to persistent.keyentry" 2021-02-03 05:57:13 +00:00
Max Bires
8e93d2be1e Keystore 2.0: Adding uuid field to persistent.keyentry
This change adds a uuid field to map keys to KM devices to the keyentry
table. For now, the security level reported by the KeyMint instance's
hardware info is uased as uuid until the hardware info returns an
actual uuid. This security level may differ from the security level
requested by keystore clients in some situations, e.g., when running a
pure software implementation or on chrome os.

Test: atest keystore2_test
Change-Id: I4b9556804eb6a435ac48d5929fc238e22c23d94d
2021-02-02 14:27:17 -08:00
Treehugger Robot
660cedaaea Merge "Keystore 2.0: Add Pure Certificate Entry suport." 2021-02-02 07:59:35 +00:00
Janis Danisevskis
377d1006de Keystore 2.0: Add Pure Certificate Entry suport.
Allow storing certificates without keys.
Also allow deleting subcomponents by setting corresponding arguments to
None.

Test: KeyStore CTS and keystore2_test
Change-Id: Ie3c937941c6dd6d4a43cd86273cce4f0d7880ca6
2021-02-01 22:35:36 -08:00
Treehugger Robot
df81f8e75b Merge "Add new SecurityLevel::KEYSTORE" 2021-02-02 06:13:07 +00:00
Janis Danisevskis
130c40fafc Merge "Keystore 2.0: Respect input consumed." 2021-02-02 06:00:34 +00:00
Janis Danisevskis
002891c342 Keystore 2.0: Respect input consumed.
Respect input consumed by KeyMint device and call update in a loop
until all input was consumed.

Test: Keystore CTS tests.
Change-Id: If7bcb019fe5f22d69e2d87d2ba56d597131e318c
2021-02-01 21:59:18 -08:00
Treehugger Robot
403808875b Merge "Specify version for aidl_interface explicitly" 2021-02-02 00:09:18 +00:00
Shawn Willden
a857a654d1 Add new SecurityLevel::KEYSTORE
We need a way to distinguish between tags that are enforced by KeyMint
with security level "SOFTWARE" and tags that are not enforced by
KeyMint but are expected to be enforced by KEYSTORE.

Test: VtsAidlKeyMintTargetTest
Change-Id: I8a88d661bca0125ee149276f6b9cb0017a1c9b12
2021-02-01 16:54:31 -07:00
Treehugger Robot
5318d3dc57 Merge "Keystore 2.0: Skip compat test if no legacy keymaster is available." 2021-02-01 23:36:00 +00:00
Janis Danisevskis
1291384d85 Keystore 2.0: Skip compat test if no legacy keymaster is available.
The km compatibility test only makes sense on devices that actually have
legacy keymaster. With this patch we skip all the tests if no connection
can be established.

Test: keystore2_km_compat_test
Change-Id: I6cfd52a0410fe1b13f5df4be11d23ef4ea223296
2021-02-01 13:51:50 -08:00
Treehugger Robot
07e6a52427 Merge "Keystore 2.0: Revise Legacy wrapper error handling" 2021-02-01 18:33:21 +00:00
Treehugger Robot
2de1313f53 Merge "Keystore 2.0: Fix permission tests." 2021-02-01 18:20:49 +00:00
Treehugger Robot
95eee225a4 Merge "Keystore 2.0: Install database busy handler." 2021-02-01 17:01:59 +00:00
Janis Danisevskis
a31dd9ef24 Keystore 2.0: Fix permission tests.
Some of the permission tests only pass on cuttlefish because its
system_server is permissive. This fix makes them pass on real devices.

Test: keystore2_test
Change-Id: I3cca0cf7ca30276eb75fa1d86a9243ee65d3d588
2021-02-01 08:17:42 -08:00
Janis Danisevskis
926a6c032f Keystore 2.0: Revise Legacy wrapper error handling
Now using mostly KeyMint error codes and a safe conversion function.

Test: keystore2_km_compat_test_cpp

Change-Id: I43ec848a8ee5544fcc8e79a4af0690e45bc28095
2021-01-31 22:41:04 -08:00
Janis Danisevskis
aea2734a7c Keystore 2.0: Install database busy handler.
Make keystore DB poll every 50us for the database lock.

Test: N/A
Change-Id: Ibb6c8d438e4b3d99d80671b6720baad23cc17a0d
2021-01-31 22:38:24 -08:00
Treehugger Robot
f3caf2698b Merge "Add AGREE_KEY operation for EC keys." 2021-01-28 13:08:43 +00:00
Treehugger Robot
13ffc59553 Merge "Keystore 2.0: Allow by key id usage of granted keys." 2021-01-27 02:29:21 +00:00
Treehugger Robot
be01ea59ec Merge "Keystore 2.0: Fix wrong check on wrapped key import." 2021-01-27 02:08:56 +00:00
Treehugger Robot
b0b1b0a049 Merge "Keystore 2.0: Move test utils to separate library." 2021-01-27 01:22:00 +00:00
Treehugger Robot
aa726fdd6e Merge "Keystore 2.0: Add attestation application id on generation and import." 2021-01-27 00:21:20 +00:00
Janis Danisevskis
2a8330a90d Keystore 2.0: Move test utils to separate library.
Move TempDir test utils to separate library for easier reuse.

Test: keystore2_test
Change-Id: If1edfde39b66efa43f8a5ed32a500fad57291512
2021-01-26 15:34:01 -08:00
Treehugger Robot
204954d8b1 Merge "Add .gitignore." 2021-01-26 23:27:46 +00:00
Janis Danisevskis
5d27fbb12d Keystore 2.0: Fix wrong check on wrapped key import.
Test: Keystore CTS Wrapped key import test.
Change-Id: Id613505112708041554ffa53e23a4e0bd69fa051
2021-01-26 15:24:28 -08:00
Treehugger Robot
5ba0951356 Merge "Keystore 2.0: Enforcement for limited use keys." 2021-01-26 23:05:51 +00:00
Jeongik Cha
98a5d095fa Specify version for aidl_interface explicitly
Bug: 150578172
Test: m
Change-Id: I5101d318c40268af8b8965910c0ff9d621f96740
2021-01-27 07:38:28 +09:00
Janis Danisevskis
212c68b471 Keystore 2.0: Add attestation application id on generation and import.
Bug: 173546023
Test: Attestation CTS tests.
Change-Id: Ibe94ff452742ef763adb3c59e575d1ea3fb7abb7
2021-01-26 14:11:16 -08:00
David Zeuthen
c8e96a0e13 Merge "keystore2: Prepare for future KeyMint::KeyPurpose values." 2021-01-26 22:05:24 +00:00
Janis Danisevskis
45760026ea Keystore 2.0: Allow by key id usage of granted keys.
When keys are loaded by grant they may be used by key id subsequently.
This patch adds a check of the grant database when loading the access
tuple. If one is found the access vector is populated allowing
the permission callback to perform access control based on the grant.

Test: keystore2_test
Change-Id: If70dfbc035aed5aa3842663d475b489df3e3dd4e
2021-01-26 13:18:38 -08:00
Treehugger Robot
6acc95ae21 Merge "Keystore 2.0: Legacy support: Tweak to certificate generation." 2021-01-26 21:14:48 +00:00
Treehugger Robot
666877639e Merge "Keystore 2.0: Add missing context in generated and import key." 2021-01-26 20:28:30 +00:00
Treehugger Robot
bda9334779 Merge "Remove myself from OWNERS" 2021-01-26 19:04:25 +00:00
Janis Danisevskis
104d8e42d7 Keystore 2.0: Add missing context in generated and import key.
Also small cleanup in enforcements.rs.

Test: N/A
Change-Id: If6afcb5e247402c1201a1a8719e35e369a38d99e
2021-01-26 11:00:58 -08:00
Janis Danisevskis
dc502d1820 Keystore 2.0: Legacy support: Tweak to certificate generation.
The legacy wrapper would attempt to self sign certificates based on key
purpose and authorization requirements. But there are keys that meet
those but still fail due to impossible parameter combinations such as
PKCS 1.5 padding with no digest.
With this patch we perform a ephemeral key signature when the self
signing attempt fails so that the key generation can still commence
successfully.

This patch also adds some error logging and revisits some of the error
handling code in the legacy wrapper.

Test: atest android.keystore.cts.SignatureTest\
      #testAndroidKeyStoreKeysHandledByAndroidKeyStoreProviderWhenSigning
Change-Id: I3be017636ae9fc61374e47f47a1e1fc5b266f6e2
2021-01-26 10:37:17 -08:00
Brian Carlstrom
0a1f21381c Remove myself from OWNERS
Bug: 178456376
Bug: 178486685
Change-Id: I9b24d0f46c43383674f2ab6c7374ee0dc648f453
Test: NA
2021-01-26 17:21:17 +00:00
Qi Wu
b9433b507b Keystore 2.0: Enforcement for limited use keys.
Bug: b/174140443
Test: atest keystore2_test
Change-Id: I6433b7c7f305d67d8e77277990f732d634801f10
2021-01-26 08:45:31 -08:00
David Zeuthen
eccc5a3f2f Merge "Credstore changes for Android 12" 2021-01-26 14:50:27 +00:00
Bram Bonné
a6b83824ac Add AGREE_KEY operation for EC keys.
Bug: 177977728
Test: make
Change-Id: If3bc82db3d513f439e5817f5f1d233253ef13234
2021-01-26 11:27:56 +01:00
Jeongik Cha
2394a331e0 Merge "Specify version for aidl_interface explicitly" 2021-01-26 03:33:15 +00:00
Jeongik Cha
9f632c6e7a Specify version for aidl_interface explicitly
Bug: 150578172
Test: m
Change-Id: Id5b4e82c56659f5b580eb7c0330c3a5ef1b4780e
Merged-In: Id5b4e82c56659f5b580eb7c0330c3a5ef1b4780e
(cherry picked from commit 269e554254)
2021-01-26 01:09:22 +00:00
Treehugger Robot
1e292289b7 Merge changes from topic "keymint_rust_derives"
* changes:
  Keystore 2.0: Untangle GC from Keystore DB.
  Keystore 2.0: Revisit Enforcements.
2021-01-25 21:21:55 +00:00