Commit graph

2728 commits

Author SHA1 Message Date
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
5859037b86 [automerger skipped] Merge "Merge Android R" am: eebcd1a3b2 -s ours am: 4608b391a0 -s ours am: 5ec74b27ae -s ours am: 0b7043388a -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: If534b97cf19414f6741d241468b365f99da846b2
2020-09-11 03:59:01 +00:00
Xin Li
0b7043388a [automerger skipped] Merge "Merge Android R" am: eebcd1a3b2 -s ours am: 4608b391a0 -s ours am: 5ec74b27ae -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: I8b7a2be58b9af54fcfa61f3c3721049262e8ed70
2020-09-11 03:33:30 +00:00
Xin Li
5ec74b27ae [automerger skipped] Merge "Merge Android R" am: eebcd1a3b2 -s ours am: 4608b391a0 -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: I8145d1db5658b7e391ae0493c9bbcb61df95ad5b
2020-09-11 02:02:40 +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
a5662bdbf0 Merge "Add functionality to Keystore 2.0 database module." am: 501a974912 am: dc6e5d9ecc am: 76bcc53b55 am: a830075bb9
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1419343

Change-Id: I5c02f563376d0e3766a4fd6903ba39773e21d9f3
2020-09-09 21:54:36 +00:00
Treehugger Robot
a830075bb9 Merge "Add functionality to Keystore 2.0 database module." am: 501a974912 am: dc6e5d9ecc am: 76bcc53b55
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1419343

Change-Id: I0e9d26b1a3bedf4b38fff30bdfe437556b24e5b8
2020-09-09 21:37:29 +00:00
Treehugger Robot
76bcc53b55 Merge "Add functionality to Keystore 2.0 database module." am: 501a974912 am: dc6e5d9ecc
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1419343

Change-Id: I6429d46c686bc22eacbca09a25cfb3c24f58e1c7
2020-09-09 21:10:04 +00: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
ae05b8d5c5 Merge "Model KeyStore security level in keymaster worker" am: ae73ca248e am: e18c228d11 am: d6f7f93eb0 am: 4e8d8bfe6f
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418729

Change-Id: I11c70a5713af872e758a5043ee38946e672b6e8e
2020-09-08 14:25:30 +00:00
Edman Anjos
4e8d8bfe6f Merge "Model KeyStore security level in keymaster worker" am: ae73ca248e am: e18c228d11 am: d6f7f93eb0
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418729

Change-Id: I47726a62ab5c6dc0feb16e292e0234740fd5645f
2020-09-08 14:13:55 +00:00
Edman Anjos
d6f7f93eb0 Merge "Model KeyStore security level in keymaster worker" am: ae73ca248e am: e18c228d11
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418729

Change-Id: Ieff7339d64a7542d3a2bee1db671e9c9942157f1
2020-09-08 14:01:53 +00: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
23ff828444 Merge changes I7cf1b0d5,Ib9943513,I98e0d91a,I7cb60da1 am: 74cdafdfd1 am: ece207d338 am: 94390b8c84 am: c304c3bab2
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418713

Change-Id: Iedabb49e7da335879abf8d1b9cdb43248a9d92ba
2020-09-04 01:16:37 +00:00
Treehugger Robot
c304c3bab2 Merge changes I7cf1b0d5,Ib9943513,I98e0d91a,I7cb60da1 am: 74cdafdfd1 am: ece207d338 am: 94390b8c84
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418713

Change-Id: I997814fccabb57edfd69bfec3a0f1dad51525588
2020-09-04 00:44:17 +00:00
Treehugger Robot
94390b8c84 Merge changes I7cf1b0d5,Ib9943513,I98e0d91a,I7cb60da1 am: 74cdafdfd1 am: ece207d338
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418713

Change-Id: I3f7206f108c6634df32b862fde79705e2a17fe28
2020-09-04 00:11:20 +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
2a8e61a07e Merge "Revise database initialization." am: 1fe037562b am: d7badcb4f1 am: fe1899cb96 am: 0a03a74a60
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1412211

Change-Id: I98989f8ead1a55bbcdfb46ed58b60796d72436cb
2020-09-03 20:30:06 +00:00
Treehugger Robot
0a03a74a60 Merge "Revise database initialization." am: 1fe037562b am: d7badcb4f1 am: fe1899cb96
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1412211

Change-Id: I9ece0b773dc8d5d3a7757efe804fd589d04480e9
2020-09-03 20:02:44 +00:00
Treehugger Robot
fe1899cb96 Merge "Revise database initialization." am: 1fe037562b am: d7badcb4f1
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1412211

Change-Id: I8d31c013cc0a2549535dd32284986b590a1d3fb2
2020-09-03 19:44:24 +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
8ee060efbc Merge "Change error.rs to use generated types." am: 5061b81606 am: 2c761e0cd8 am: 6736876342 am: e662afb87d
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1398873

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

Change-Id: I6e998ed640d5aafbe8f21e55df2081867ee47e10
2020-09-03 18:31:51 +00:00
Treehugger Robot
6736876342 Merge "Change error.rs to use generated types." am: 5061b81606 am: 2c761e0cd8
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1398873

Change-Id: I8591476849f47f7d60454919d509f0bf8cb6776e
2020-09-03 18:11:50 +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
Treehugger Robot
7723e61018 Merge "Slightly cleanup KeyParameter error handling." am: 5de2d3086d am: ead283d4e5 am: b5529092fd am: 029330e03c
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418720

Change-Id: Iffc8f0424a90c1ae5348250c4446d9c8bdd397e7
2020-09-03 16:59:27 +00:00
Janis Danisevskis
52ffe1e87e Merge "Keystore 2.0 permissions.rs: Use generated aidl types." am: 21e53ab0ff am: 156ebcbc5d am: 95d0dc4491 am: a18b5e54c5
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1394308

Change-Id: If43ea1883006244faf70d9a63e68febd4d705651
2020-09-03 16:59:15 +00:00
Treehugger Robot
029330e03c Merge "Slightly cleanup KeyParameter error handling." am: 5de2d3086d am: ead283d4e5 am: b5529092fd
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418720

Change-Id: I324582b9498f0f09cbfbda24a9e73eec755fe638
2020-09-03 16:46:50 +00:00
Janis Danisevskis
a18b5e54c5 Merge "Keystore 2.0 permissions.rs: Use generated aidl types." am: 21e53ab0ff am: 156ebcbc5d am: 95d0dc4491
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1394308

Change-Id: Idfad96233b29ec3dd9ff545448b55ee57e0a5441
2020-09-03 16:46:40 +00:00
Treehugger Robot
b5529092fd Merge "Slightly cleanup KeyParameter error handling." am: 5de2d3086d am: ead283d4e5
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1418720

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

Change-Id: Iab16501ae6beb8282ca6572cb09fb9b62cfbd6fb
2020-09-03 16:32:38 +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