Commit graph

2365 commits

Author SHA1 Message Date
Janis Danisevskis
04b0283254 Keystore 2.0: Store key parameters
We now store key parameters in the database and returns sets of
authorizations to the keystore client's.

We also switched to mostly using the SecurityLevel type from the KeyMint
AIDL spec, rather then the temporary one from the Keystore 2.0 AIDL
spec.

Test: This enables some of the CTS test e.g. from
      atest android.keystore.cts.CipherTest
Change-Id: I0a13063b397a5ad835fecea0e6b44a98845c05be
2020-11-17 12:17:10 -08:00
Janis Danisevskis
85d4793fe8 Keystore 2.0: Use generated KeyMint AIDL bindingis.
This patch adjusts keystore2 to use rust bindings generated from the
KeyMint AIDL spec instead of using pregenerated bindings.

Bug: 160623310
Test: keystore2_test
Change-Id: I77bb0426991381535f9dbe4f32e7e137a8eb7df3
2020-11-16 22:35:45 -08:00
Treehugger Robot
a58771971b Merge "Add certificate utils to keystore2 crypto" 2020-11-17 00:55:02 +00:00
Janis Danisevskis
a7c72dbad7 Add certificate utils to keystore2 crypto
This patch adds code for certificate generation with boringssl.
This is required for the Keymaster to KeyMint legacy wrapper.

Bug: 171351607
Test: keystore2_crypto_test
Change-Id: Id2d35be04cb5ab8c4e6b0597f5a970150ab9e69b
2020-11-16 14:30:12 -08:00
Treehugger Robot
3b37aa5e43 Merge "Rename module for pregenerated keymint bindings." 2020-11-16 21:55:02 +00:00
Janis Danisevskis
1ea682ee86 Rename module for pregenerated keymint bindings.
This module uses a name that conflicts with the about
to land keymint AIDL spec. This patch renames this
temporary module to allow the keymint spec to land.

Test: Still compiles.
Change-Id: I4aa9a2fb125b2111f778e0182615ab29d2c9fe85
2020-11-16 12:54:24 -08:00
Janis Danisevskis
245453e0ea Merge "Keystore 2.0: Observe revision of the Keystore 2.0 AIDL interface." 2020-11-13 18:23:21 +00:00
Janis Danisevskis
2c7f962f8b Keystore 2.0: Observe revision of the Keystore 2.0 AIDL interface.
Remove output parameters by moving them into designated output
structures.

Test: see VTS test
Change-Id: If629f206b4bb69a798e63be37062bf507338d0f5
2020-11-12 20:48:01 -08:00
Wedson Almeida Filho
8a8ea67e55 Merge "Add provisioner CLI and its interface." 2020-11-12 16:47:31 +00:00
Wedson Almeida Filho
ba42dac790 Add provisioner CLI and its interface.
Change-Id: If7682c037232844568ba88a0ed38e26924e1c10e
2020-11-12 15:21:12 +00:00
Steven Moreland
26668f5bc2 Merge "Add @SensitiveData to Keystore service and callback" 2020-11-11 16:17:19 +00:00
Branden Archer
2f0c3976e3 Add @SensitiveData to Keystore service and callback
Bug: 171501998
Test: Builds and manual evaluation
Change-Id: Ie2f88994afca298df34020bc62659e7c51060e6e
2020-11-04 13:26:46 -08:00
Treehugger Robot
68ed7fcc63 Merge "Add crypto libraries" 2020-11-03 14:49:37 +00:00
Joel Galenson
ca0efb1f27 Add crypto libraries
Add C++ versions of the BoringSSL crypto functions we need (copied
from keystore) and create Rust wrappers for them.

Test: atest keystore2_test
Change-Id: I21ff8630df26ca73ae36395c5303270e96a6deb6
2020-11-02 07:21:11 -08:00
Treehugger Robot
552c0ca443 Merge "Add maxTargetSdk restriction to unused APIs." 2020-10-27 13:25:59 +00:00
Mathew Inwood
271f57b52c Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to remove
from the unsupported list.

Bug: 170729553
Test: Treehugger
Change-Id: I54fce50d3fb9d3ba02eae312c478bac419a46ede
2020-10-26 11:21:01 +00:00
Treehugger Robot
e0b6606138 Merge "Keystore 2.0: Start keystore2 daemon conditionally." 2020-10-25 20:49:53 +00:00
Janis Danisevskis
9402f2775b Keystore 2.0: Start keystore2 daemon conditionally.
This patch makes the keystore2 daemon start conditionally based on the
platform property ro.android.system.keystore2.enable.
This is patch can be reverted when the Keystore 2.0 migration is
complete. b/171563717

Bug: 171563717
Bug: 171305684
Test: The keystore2 daemon is running if the property
      ro.android.system.keystore2.enable is set and true
      and not running otherwise.
Change-Id: I2b3d6c70f45f3dafb9edb6f2f6960be94e13ed20
2020-10-23 11:14:52 -07:00
Treehugger Robot
68ec103cb2 Merge "Add Keystore 2.0 service." am: 0078542aa1
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1395708

Change-Id: I8b30f67ee5943ce28ac55928906bb9e93c657e04
2020-10-16 02:55:23 +00:00
Treehugger Robot
0078542aa1 Merge "Add Keystore 2.0 service." 2020-10-16 02:36:44 +00:00
Janis Danisevskis
1af9126a1f Add Keystore 2.0 service.
This patch adds a boilerplate Keystore 2.0 service. It is configured to
run on the device but does not provide any useful service yet.
It provides basic functionality for generating, importing and using
keys, but it still lacks full Keystore functionality.

Test: VtsKeystore2V1_0TargetTest (in followup CL)
Bug: 160623310
Bug: 160930114
Bug: 160930117
Bug: 160930331
Bug: 159465122
Change-Id: I7dfa2f2f63f4da3af620aff2ec99c0cba3bda6fd
2020-10-15 16:11:09 -07:00
Xin Li
d5a79419b8 Skip ab/6749736 in stage.
Merged-In: I3c023063eff938812d7001d621d027b81572f4c8
Change-Id: Ied5cd2adff15c89a895bf751cecb047267931ce4
2020-10-08 17:24:04 -07:00
Treehugger Robot
c0f98114f7 Merge changes from topic "ks2_aidl_autogen" am: c79a95510f
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1454000

Change-Id: I5b8f42ad16476257feacaa105023e8192ac313f6
2020-10-08 17:59:18 +00:00
Treehugger Robot
c79a95510f Merge changes from topic "ks2_aidl_autogen"
* changes:
  Keystore 2.0: Add globals.rs and utils.rs
  Update prebuilt keymint interface.
  Keystore 2.0: Adopt associated const enum variants.
  Keystore 2.0: Switch to autogenerated AIDL bindings.
2020-10-08 17:41:00 +00:00
Janis Danisevskis
a75e208d30 Keystore 2.0: Add globals.rs and utils.rs
These two files add some utility functions and a thread local reference
to a database connection.

Test: None
Change-Id: I34fdf977deb233571b9a0c6d50da20e47593d6a5
2020-10-08 08:22:34 -07:00
Janis Danisevskis
c5b5cb6f08 Update prebuilt keymint interface.
Change-Id: I2af01ffdcd22bd2389b193bab90a5c9ceb79da64
2020-10-07 17:52:43 -07:00
Janis Danisevskis
c5b210b62b Keystore 2.0: Adopt associated const enum variants.
The aidl to rust generator now generates tuple structs with associated
constants as variants. This patch adjusts the existing Keystore 2.0
codebase to this change.

In the process one more variant was added to the
implement_key_parameter_conversion_to_from_wire! macro and the
indentation was fixed.

Test: keystore2_test
Change-Id: I2639c76d4da7401f6799180e1bfcb3e420341628
2020-10-07 17:52:32 -07:00
Janis Danisevskis
71dc30de9c Keystore 2.0: Switch to autogenerated AIDL bindings.
Remove pregenerated file android_security_keystore2.rs and
reconfigure the build to use the generated target
android.security.keystore2-rust instead.

Test: keystore2_test
Change-Id: Iad24cab05ef35ccc766f7342225d4b79e8051ada
2020-10-06 19:31:05 -07:00
Hasini Gunasinghe
eb4a5a5d70 Merge "Pass default values for the optional fields in attestation logs" am: 6214d7d3ad
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1448835

Change-Id: I6289f63a9188f87c48f33127c9bcd931919e491e
2020-10-06 21:54:08 +00:00
Hasini Gunasinghe
6214d7d3ad Merge "Pass default values for the optional fields in attestation logs" 2020-10-06 21:34:36 +00:00
Hasini Gunasinghe
2481b9deb7 Pass default values for the optional fields in attestation logs
This CL provides the fix for the issue reported in b/169959923.

Bug: 169959923
Test: tested using statsd_testdrive script.
Change-Id: I3fe42e85abd0976782795ad4fa13a804702624d6
2020-10-05 12:46:42 +00:00
Janis Danisevskis
a5562fae1d [automerger skipped] Merge "Keystore 2.0: Remove list permission from keystore2_key security class." am: d55f6ceacc -s ours
am skip reason: Change-Id Ie0a29d8b08c53977ae2ed04d042868044d2c34c5 with SHA-1 3d72aad0bc is in history

Original change: https://android-review.googlesource.com/c/platform/system/security/+/1434719

Change-Id: I3475e3e4a7ede8e810ef8a2b6e4b2a5b307dc825
2020-10-01 17:10:10 +00:00
Janis Danisevskis
d55f6ceacc Merge "Keystore 2.0: Remove list permission from keystore2_key security class." 2020-10-01 16:49:33 +00:00
Janis Danisevskis
3d72aad0bc Keystore 2.0: Remove list permission from keystore2_key security class.
The list permission is special keystore2 permission that allows
callers to list arbitrary namespaces. It is not a key or namespace
specific permission.

Ignore-AOSP-First: This needs to land in googleplex first to updated
                   prebuilt vendor images. Otherwise it breaks
		   aosp-with-phone builds.
Test: N/A
Change-Id: Ie0a29d8b08c53977ae2ed04d042868044d2c34c5
2020-10-01 05:33:29 +00:00
Janis Danisevskis
ee10b5fab0 Keystore 2.0: Remove list permission from keystore2_key security class.
The list permission is special keystore2 permission that allows
callers to list arbitrary namespaces. It is not a key or namespace
specific permission.

Test: N/A
Merged-In: Ie0a29d8b08c53977ae2ed04d042868044d2c34c5
Change-Id: Ie0a29d8b08c53977ae2ed04d042868044d2c34c5
2020-09-30 12:20:56 -07:00
Hasini Gunasinghe
f6121aedfe Merge "Convert KeyParameter to wire type." am: 29c9edd2d5
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1414588

Change-Id: Ic80ba5f9d6a51c2c0af48dd6d8543f404d6ad767
2020-09-16 00:37:51 +00:00
Hasini Gunasinghe
29c9edd2d5 Merge "Convert KeyParameter to wire type." 2020-09-16 00:00:15 +00:00
Hasini Gunasinghe
3eb77c275c Convert KeyParameter to wire type.
For communicating with keymint and SPI.
This CL also moves all test modules to the bottom of the file.

Bug: 167744352
Test: Unit tests
Change-Id: I085dbe68076ba361c4d89f63de87c3b2f05627bc
2020-09-15 14:47:56 +00:00
Treehugger Robot
5b71c59b69 Merge "Add helper function to insert with retry." am: b6375273ac
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1423614

Change-Id: I000c46d140e9c74b9481bc9afb4f3a76ce2a8112
2020-09-14 17:18:28 +00:00
Treehugger Robot
b6375273ac Merge "Add helper function to insert with retry." 2020-09-14 16:46:05 +00:00
Joel Galenson
845f74bebe Add helper function to insert with retry.
This breaks the code that tries to insert into a database with a
random id into a helper function, since it's now shared between two
functions.

Test: keystore2_test
Change-Id: Ib03b6082246120e6b3ff2a45b5bf8d324c40f7a7
2020-09-14 08:25:07 -07:00
Treehugger Robot
e7cc9f51bc Merge "Keystore 2.0: Minor update to pregenerated keymint rust bindings." am: ff275a3f59
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1424935

Change-Id: Ifd115571f0dd75399f145d6ab5c877b1fdbd3247
2020-09-11 16:50:08 +00:00
Treehugger Robot
e702b79235 Merge "Keystore2.0 database.rs: Add storing and loading key parameters." am: 73c3d220a4
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1424928

Change-Id: I1eedfda3fc53e715ce6f11fa3df4308cb89516b0
2020-09-11 16:49:12 +00:00
Treehugger Robot
ff275a3f59 Merge "Keystore 2.0: Minor update to pregenerated keymint rust bindings." 2020-09-11 16:36:09 +00:00
Treehugger Robot
73c3d220a4 Merge "Keystore2.0 database.rs: Add storing and loading key parameters." 2020-09-11 16:25:00 +00:00
Janis Danisevskis
3f322cb44b Keystore2.0 database.rs: Add storing and loading key parameters.
This patch adds functionality for storing and loading key parameters.
It also normalizes import names of generated types by importing
SecurityLevel as SecurityLevelType.

It also breaks out loading blob components into its own helper
function.

Bug: 159370859
Test: keystore2_test
Change-Id: I2969c7c467cb3ae9cf8c283122a6f82f775cad37
2020-09-11 16:24:25 +00:00
Xin Li
4608b391a0 [automerger skipped] Merge "Merge Android R" am: eebcd1a3b2 -s ours
am skip reason: Change-Id I7047e259671193e73f02217afdc57d549e8ca992 with SHA-1 dc6e5d9ecc is in history

Original change: https://android-review.googlesource.com/c/platform/system/security/+/1422589

Change-Id: If4c47989ab6bf4ff3a29a9c82e2513c387a30006
2020-09-11 00:40:10 +00:00
Janis Danisevskis
31993bac65 Keystore 2.0: Minor update to pregenerated keymint rust bindings.
Test: N/A
Change-Id: I2e2441b5b87e315ce102b54be784014a10441c4a
2020-09-10 11:16:35 -07:00
Xin Li
eebcd1a3b2 Merge "Merge Android R" 2020-09-10 17:22:17 +00:00
Xin Li
2bb3bec603 Merge Android R
Bug: 168057903
Merged-In: I7047e259671193e73f02217afdc57d549e8ca992
Change-Id: I4e3e8a1d51d340a69cbb944f3c19fee1a7c3a24e
2020-09-09 20:21:28 -07:00