Commit graph

2260 commits

Author SHA1 Message Date
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
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
d55f6ceacc Merge "Keystore 2.0: Remove list permission from keystore2_key security class." 2020-10-01 16:49:33 +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
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
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
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
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
Janis Danisevskis
38637bf648 Remove aidl_generated.rs
Test: keystore2_test
Change-Id: I98e0d91a9e5d97c4ade4081ec7dd522aceb5c8ad
2020-09-03 10:20:58 -07:00
Janis Danisevskis
60400feb48 Switch database module over to generated types.
Test: keystore2_test
Bug: 159370859
Change-Id: I7cb60da12ae2bdd9316b754869b9d10dd85dce85
2020-09-03 10:20:50 -07:00
Treehugger Robot
5061b81606 Merge "Change error.rs to use generated types." 2020-09-03 17:05:36 +00:00
Janis Danisevskis
4df44f4fca Revise database initialization.
Initializing the Keystore 2.0 database will now open the files
persistent.sql and perboot.sql. Tables are created, if they don't
exist, once per service startup instead of on every connection
instantiation. In the test situation we make use of the module
private visibility to create in-memory test databases or attaching
to a set of temporary files.

Test: keystore2_test
Bug: 159370859
Change-Id: I88594dabc72483779d980e81dbc05f2b7a687437
2020-09-03 08:52:32 -07:00
Janis Danisevskis
e24f347d2f Change error.rs to use generated types.
This patch also removes AidlResult form the error module.
The new version of the Keystore 2.0 AIDL spec requires that ResponseCode
and ErrorCode will be returned as service specific error, instead of the
Result type.

Test: keystore2_test
Change-Id: I6f730b282c84abc8be2e693e5d2c7053648d7588
2020-09-03 08:52:30 -07:00
Treehugger Robot
ead283d4e5 Merge "Slightly cleanup KeyParameter error handling." am: 5de2d3086d
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418720

Change-Id: Ic0a818e2de30e058a922856a77f3e36fa820a769
2020-09-03 15:48:17 +00:00
Janis Danisevskis
156ebcbc5d Merge "Keystore 2.0 permissions.rs: Use generated aidl types." am: 21e53ab0ff
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1394308

Change-Id: Icd51b3dbafa8ebf98797326ac94f46d801715467
2020-09-03 15:48:11 +00:00
Treehugger Robot
5de2d3086d Merge "Slightly cleanup KeyParameter error handling." 2020-09-03 15:40:33 +00:00
Janis Danisevskis
21e53ab0ff Merge "Keystore 2.0 permissions.rs: Use generated aidl types." 2020-09-03 15:33:32 +00:00
Hasini Gunasinghe
2093675d78 Merge "Implement key_parameter conversion from/to rusqlite storage." am: a2716509a1
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1374656

Change-Id: Ib75a85c7f71f5dcd9c55d6e835434bfd9ff7245d
2020-09-02 21:35:58 +00:00
Joel Galenson
5c0ec0d83c Slightly cleanup KeyParameter error handling.
Test: keystore2_test
Change-Id: I06fb3ba134337e989b80acb0616a9f1eaf566069
2020-09-02 14:24:30 -07:00
Janis Danisevskis
1b3a6e25da Keystore 2.0 permissions.rs: Use generated aidl types.
Modify permissions.rs to use generated aidl types instead of
placeholders.

Test: keystore2_test

Change-Id: Ia6bcc9cff714a5839f0d2391c30c287e4e4cbadf
2020-09-02 14:13:22 -07:00
Hasini Gunasinghe
a2716509a1 Merge "Implement key_parameter conversion from/to rusqlite storage." 2020-09-02 21:10:58 +00:00
Hasini Gunasinghe
af99366934 Implement key_parameter conversion from/to rusqlite storage.
This implements conversion methods on top of basic
keyparameter implementation in aosp/1350725

Bug: 159722691, 159723797, 161798431
Test: atest --host keystore2_tests.
Change-Id: I1457ae4cf4336ebc5bff2645bca55ad285a4449c
2020-09-02 19:24:34 +00:00
Treehugger Robot
fb52d90fe5 Merge "Add getpidcon to libselinux bindings and fix a typo." am: fd13bc1fe6
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1412210

Change-Id: Iab916907e93604179133c14968dc85834ca39b49
2020-09-02 18:17:24 +00:00
Treehugger Robot
fd13bc1fe6 Merge "Add getpidcon to libselinux bindings and fix a typo." 2020-09-02 18:01:53 +00:00
Edman Anjos
ba9b7d32a7 Model KeyStore security level in keymaster worker
On certain device configurations the security level reported by the
Keymaster HAL differs from the security level understood in KeyStore.
Namely, on devices with only a software Keymaster, KeyStore will set it
in the TEE slot, and create a new in-process legacy Keymaster for the
software slot.

This change introduces a field to keymaster worker to represent the
security level that KeyStore understands this worker to operate on.

Bug: 167412989
Test: atest CtsKeystoreTestCases
Change-Id: Ifeaa4782913be45d89cdd175a02302c7dc318719
2020-09-02 19:11:37 +02:00
Janis Danisevskis
63c4fb0df6 Add getpidcon to libselinux bindings and fix a typo.
Bug: 158500146
Test: None
Change-Id: Ia5e58933eff3766e2aa0a7b072107aeec294aa2f
2020-09-02 09:52:17 -07:00
Xin Li
98003f1d08 Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: Ibd6ee7bf201a920e72602010bef128083f235453
Change-Id: Id31817f370322187d410dbd76e3d19184f9cf28d
2020-08-28 13:59:20 -07:00
Treehugger Robot
40a05abd77 Merge "Add derive macros to KeyDescriptor" am: ca543112cd
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1402755

Change-Id: I370905a3054e07f9e408f5d133ba5009703dab07
2020-08-26 18:12:10 +00:00
Treehugger Robot
ca543112cd Merge "Add derive macros to KeyDescriptor" 2020-08-26 17:34:43 +00:00
Treehugger Robot
312a51926a Merge "Update generated AIDL interface code." am: 826558a741
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1402754

Change-Id: I6484e92a1c85eab41b93314bcf5e1c05d6a3604a
2020-08-26 17:06:17 +00:00
Treehugger Robot
826558a741 Merge "Update generated AIDL interface code." 2020-08-26 16:53:03 +00:00