Commit graph

2353 commits

Author SHA1 Message Date
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
Treehugger Robot
dc6e5d9ecc Merge "Add functionality to Keystore 2.0 database module." am: 501a974912
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1419343

Change-Id: I7047e259671193e73f02217afdc57d549e8ca992
2020-09-09 20:40:38 +00:00
Treehugger Robot
501a974912 Merge "Add functionality to Keystore 2.0 database module." 2020-09-09 20:23:57 +00:00
Janis Danisevskis
63f7bc8f57 Add functionality to Keystore 2.0 database module.
This patch adds the following functionality:
 * Add the perboot grant table along with grant and ungrant
   API.
 * Add the persistent blobentry table along with API
   to add and load blob components.
 * Tests for the new API surface.

Authoship note:
This patch has joined authorship by jgalenson@google.com
and jdanis@google.com

Bug: 159370859
Test: keystore2_test
Change-Id: Ie1c6bcfb0718b7fa6ea850697b43f7d4527b3e87
2020-09-09 12:06:39 -07:00
Edman Anjos
e18c228d11 Merge "Model KeyStore security level in keymaster worker" am: ae73ca248e
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418729

Change-Id: I72df29824042c5e517744f2e19da5cfc9b3c4c8c
2020-09-08 13:39:10 +00:00
Edman Anjos
ae73ca248e Merge "Model KeyStore security level in keymaster worker" 2020-09-08 13:06:15 +00:00
Treehugger Robot
ece207d338 Merge changes I7cf1b0d5,Ib9943513,I98e0d91a,I7cb60da1 am: 74cdafdfd1
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418713

Change-Id: I0b2c007e59ce8c5ffa98c37dcd93c32cb33e87cc
2020-09-03 23:58:45 +00:00
Treehugger Robot
74cdafdfd1 Merge changes I7cf1b0d5,Ib9943513,I98e0d91a,I7cb60da1
* changes:
  Keystore2: Handle errors from binder service calls.
  Keystore selinux and permission modules accept CStr instead of Context.
  Remove aidl_generated.rs
  Switch database module over to generated types.
2020-09-03 23:29:48 +00:00
Treehugger Robot
d7badcb4f1 Merge "Revise database initialization." am: 1fe037562b
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1412211

Change-Id: I4561bf456e9a95a64fcf1dc0180fa3a7fcd2170d
2020-09-03 19:26:41 +00:00
Treehugger Robot
1fe037562b Merge "Revise database initialization." 2020-09-03 18:55:18 +00:00
Treehugger Robot
2c761e0cd8 Merge "Change error.rs to use generated types." am: 5061b81606
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1398873

Change-Id: If8b97c7b5f1ca304fe629fc4d0bf3b663592e388
2020-09-03 17:57:22 +00:00
Janis Danisevskis
017d20905d Keystore2: Handle errors from binder service calls.
This is required for handling Keymint errors received by the Keystore
service.

Test: keystore2_test
Change-Id: I7cf1b0d53db465a738c60594d929944379179836
2020-09-03 10:20:58 -07:00
Janis Danisevskis
935e6c6d1b Keystore selinux and permission modules accept CStr instead of Context.
The libselinux wrapper provides a Context struct, that conveniently
wraps and owns a context string as returned by libselinux. However,
libbinder_rs provides a non owned string with a lifetime bounded
by the currently ongoing transaction. So instead of accepting
a reference to an owning Context, the check_access function in the
libselinux wrapper as well as the higher level permission function in
the permission module accept &CStr now which Context can also deref
into.

Test: keystore2_test
Bug: 160623310
Change-Id: Ib99435134bcabfd9c7f3217f719f8ac21d0fd84e
2020-09-03 10:20:58 -07:00