Commit graph

3599 commits

Author SHA1 Message Date
Hasini Gunasinghe
dc0a466876 Merge "Keystore 2.0: Implement storage key upgrade on demand." 2021-04-23 22:39:04 +00:00
Andrew Walbran
fc1693723e Merge "Moving set_requesting_sid to new_binder method." 2021-04-22 15:03:47 +00:00
David Drysdale
f5c1ab0c5e Align KeyMint AIDL with usage
- Make HardwareAuthToken nullable on begin()
 - Drop unused vestigial performOperation() entrypoint
 - Drop unused Tag::BLOB_USAGE_REQUIREMENTS

Test: TreeHugger, VtsKeyMintAidlTargetTest (CF)
Change-Id: Ief6a9c97456cdf7e7626ff26a875792584c40199
2021-04-22 15:55:57 +01:00
Hasini Gunasinghe
63a3355c8e Merge "Keystore 2.0: Untangle mutex dependencies in add_auth_token." 2021-04-22 14:23:55 +00:00
Janis Danisevskis
be1969e4b8 Keystore 2.0: Untangle mutex dependencies in add_auth_token.
Some mutexes on the add_auth_token path were more dependent on one
another than necessary. This could lead to a chain were add_auth_token
would block on waiting for a time stamp token, which in turn could stall
the execution for seconds.

Also fix some comments.

Bug: 183676395
Test: N/A
Change-Id: I5c6ae1e47fe232ea9954497108f807bbcd37fef7
2021-04-22 14:15:00 +00:00
Treehugger Robot
601733bc91 Merge "Adding the factory extraction binary" 2021-04-21 20:18:54 +00:00
Max Bires
f60987eab4 Adding the factory extraction binary
This binary gets added to the system image under
/bin/rkp_factory_extraction_tool. The purpose of this tool is to query
every IRemotelyProvisionedComponent interface in the device manifest and
print out a CertificateRequest to stdout for each interface.

The CertificateRequest will contain no keys to sign and a semantically
useless challenge, since this tool is just for key upload. The items of
value will be the DeviceInfo CBOR blob which will get associated with
the encrypted device public key once it is uploaded to the backing
servers and decrypted.

The tool will fail if it is unable to successfully query an
IRemotelyProvisionedComponent interface that is specified in the device
manifest file.

Test: Build and run
Change-Id: Ia82787749be5963567019f6523075100208aa101
2021-04-20 17:05:39 -07:00
Hasini Gunasinghe
cc2439b666 Merge "Make NOT_FOUND errors silent for VPN profiles and keys." 2021-04-20 22:36:31 +00:00
Treehugger Robot
b2a2a1b58f Merge "Make log creation via statsd asynchronous." 2021-04-20 20:50:18 +00:00
Hasini Gunasinghe
e1d1bbd47f Make NOT_FOUND errors silent for VPN profiles and keys.
There are several errors printed in keystore2 startup due to above
NOT_FOUND errors.

Test: check keystore2 startup logs.
Change-Id: Icdf553b141cda09f371f7eb83b273444130fe3e7
2021-04-20 20:33:15 +00:00
Janis Danisevskis
b2434d03e9 Keystore 2.0: Implement storage key upgrade on demand.
Bug: 185811713
Test: N/A
Change-Id: Ie996f1b1ecf05f89e3ba11a53a5f8ed55083388a
2021-04-20 12:50:31 -07:00
Hasini Gunasinghe
190228160c Make log creation via statsd asynchronous.
This CL creates a new instance of async_task just to handle log
creation asynchronously due to two reasons:
1. Keystore2 starts much earlier than statsd and waits for it.
2. We want to take calling statsd API out of the critical path.

Bug: 185831595
Test: statsd_testdrive script
Change-Id: I79494edda1b195b0120e26d38ccc3e120977166b
2021-04-20 17:49:22 +00:00
Paul Crowley
230b4dcc3a Merge "Set NoAuthRequired on boot level 0 key" 2021-04-20 17:14:44 +00:00
Seth Moore
379c0c002f Merge changes from topic "keystore2-metrics"
* changes:
  Add support for keystore2 storage metrics
  Update PropertyWatcher to wait for property create
2021-04-20 16:00:46 +00:00
Paul Crowley
eb964cfad3 Set NoAuthRequired on boot level 0 key
Since no authentication is used for this key (only the
MaxUserPerBoot tag) the NoAuthRequired tag must be present.
Some buggy KM implementations don't require this.

Bug: 176450483
Test: keystore2_test
Test: boot Crosshatch device and check logs
Change-Id: Id12c0752938d746a9f6fbedbeb42fefd6049c20c
2021-04-19 18:14:58 -07:00
Treehugger Robot
33b8c2c799 Merge "Legacy VPN Profile Store: Fix listing empty legacy user directory." 2021-04-19 19:04:09 +00:00
Treehugger Robot
b6489cbdce Merge "Use the new more inclusive command-line options." 2021-04-19 17:45:16 +00:00
Janis Danisevskis
13f0915afe Legacy VPN Profile Store: Fix listing empty legacy user directory.
Bug: 185284638
Test: keystore2_test
Change-Id: If61f8715980dc1dd00bb3d1fb93feb7366402cce
2021-04-19 10:00:18 -07:00
Joel Galenson
915d3eae87 Use the new more inclusive command-line options.
Test: Compile
Change-Id: I9443541a912a0e9e718650a2349ba540f3f04958
2021-04-19 09:02:41 -07:00
Martijn Coenen
d6ff8bfbcc Merge "On-device signing: Make sure Keystore key has the correct boot level." 2021-04-19 07:21:08 +00:00
Seth Moore
78c091fa6e Add support for keystore2 storage metrics
Add pull atoms for getting information about current state of keystore2
storage.

Bug: 172013262
Test: atest system/keystore/keystore2
Test: statsd_testdrive 10103
Change-Id: I0ee115d9bc65d17e6533c4520a1b65067cd2260c
2021-04-16 19:29:58 +00:00
Seth Moore
7194035ea1 Update PropertyWatcher to wait for property create
Previously, PropertyWatcher would only wait for changes to a property,
however, if a property had not yet been created then PropertyWatcher
would fail. With this change, PropertyWatcher::wait will wait for
properties to be created as well as changed.

Bug: 172013262
Test: atest system/keystore/keystore2
Test: statsd_testdrive 10103
Change-Id: Ic2759581459759738c11e0c452c1457a4a95feea
2021-04-16 19:29:58 +00:00
Andrew Walbran
de45c8b999 Moving set_requesting_sid to new_binder method.
Bug: 178852354
Test: mm
Change-Id: Ib6af028b19d36965ad2de62c8ddc52936b6abec2
2021-04-16 16:56:36 +00:00
Treehugger Robot
2295dae962 Merge "Keystore 2.0: Add API for key migration to IKeystoreMaintenance" 2021-04-16 16:13:33 +00:00
Paul Crowley
9dbf9b3530 Merge "Revert^2 "Cryptographic security for MAX_BOOT_LEVEL"" 2021-04-16 15:51:27 +00:00
Martijn Coenen
79985bdce1 On-device signing: Make sure Keystore key has the correct boot level.
While Keystore itself enforces that these keys can only be created/used
during a certain boot level, we need to verify ourselves that the key
actually *has* the correct boot level.

Bug: 167516462
Test: atest
Change-Id: I096d63323e0faf7a97ec5f571d2fdcee75d47c6e
2021-04-16 10:52:50 +02:00
Janis Danisevskis
cdcf4e5ca1 Keystore 2.0: Add API for key migration to IKeystoreMaintenance
Bug: 184664830
Test: atest keystore2_test
Change-Id: Ic61cd403365841ba2202ac3ed8bcb01c97063d45
2021-04-15 20:27:55 -07:00
Satya Tangirala
5e212dad79 Merge "Remove Tag::PURPOSE before passing KeyParameters to km_dev.begin()" 2021-04-15 17:37:41 +00:00
Satya Tangirala
2642ff9239 Remove Tag::PURPOSE before passing KeyParameters to km_dev.begin()
Some keymint/keymaster devices return an error if Tag::PURPOSE is
present in the key parameters passed to the keymint/keymaster device's
begin() method. So we remove that Tag from the KeyParameters. The
Tag::PURPOSE is communicated to begin() as a separate argument anyway,
so the begin() method still has all the information it needs.

Bug: 184861759
Test: Cuttlefish and Bramble boot
Change-Id: Ifb08565ea29b9d148879533164266ccd113618c9
2021-04-15 09:06:02 -07:00
Janis Danisevskis
8409b13b92 Merge "Vpnprofilestore: Set sqlite busy hander to None." 2021-04-13 15:22:55 +00:00
Janis Danisevskis
d80305eaee Merge "Keystore 2.0 legacy_blob.rs: Fix list non existing user." 2021-04-13 01:02:06 +00:00
Janis Danisevskis
7df9dbfd7a Keystore 2.0 legacy_blob.rs: Fix list non existing user.
In when listing the keys for a user an empty list should be returned
instead of a system error if the user did not exists in the legacy
databse.

Test: atest keystore2_test
Change-Id: Ic9d4822dfe002adf2728b7f84e3e122a5bd1db24
2021-04-12 16:21:15 -07:00
Steven Moreland
085436836d Merge "Keystore 2.0: Use Strong<> for Rust AIDL interfaces" 2021-04-12 23:01:52 +00:00
Janis Danisevskis
1be7e18a4a Vpnprofilestore: Set sqlite busy hander to None.
Set the busy handler to None, because it is unlikely that a transaction
lock can be successfully taken while busy wating in the sqlite librarly.

Also add a vpn database stress test.

Bug: 184006658
Test: atest vpnprofilestore_test
Change-Id: Ia18d5e86683cde908444f6257949497fdd2872e4
2021-04-12 14:53:11 -07:00
Paul Crowley
44c02da368 Revert^2 "Cryptographic security for MAX_BOOT_LEVEL"
Revert submission revert-1660531-max-boot-level-crypto-KFMCEDKSIV

Reason for revert: topic:vold-use-keystore2 has landed fixing the bug

Reverted changes:
Ibf63734a: Revert "Set earlyBootEnded before apex starts"
Id02f63a7: Revert "Expose AID_KEYSTORE"
Ibcedeff4: Revert "Cryptographic security for MAX_BOOT_LEVEL"

Restored changes:
Ia3b968afc:Set earlyBootEnded before apex starts
Ia69891291:Expose AID_KEYSTORE
I12530cd13:Cryptographic security for MAX_BOOT_LEVEL

Reverted-SHA1: 229f2c038c

Original commit message:
Use a KDF to generate a key for each boot level, anchored in a key
which can only be used once per boot.

Bug: 176450483
Test: atest com.android.tests.odsign.OnDeviceSigningHostTest#verifyArtUpgradeSignsFiles
Change-Id: I62609052647316c5c381e1df12963996aba97f23
2021-04-12 11:22:37 -07:00
Jeffrey Vander Stoep
75531c1695 Merge "Temporarily disable a bunch of new linter errors" am: 0f0aaa74ed am: f15d08274e
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1669946

Change-Id: I7845dfff855023ef75854ed6d67342e090b11a57
2021-04-09 19:13:16 +00:00
Jeffrey Vander Stoep
f15d08274e Merge "Temporarily disable a bunch of new linter errors" am: 0f0aaa74ed
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1669946

Change-Id: I06377dcd8809084ec5d4112181586bc9e04862a1
2021-04-09 18:32:45 +00:00
Jeffrey Vander Stoep
0f0aaa74ed Merge "Temporarily disable a bunch of new linter errors" 2021-04-09 17:48:43 +00:00
Treehugger Robot
c2c408d379 Merge "Handle keystore keys that are missing certificates." am: f44834ab28 am: 3478647654
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1670632

Change-Id: I73433025a39eb9c7a27b774a4f4f0584bef031c0
2021-04-09 07:39:22 +00:00
Jeff Vander Stoep
46bbc614b8 Temporarily disable a bunch of new linter errors
With the upgrade to 1.51.0 there are a bunch of new clippy
errors. Disable these on a per-file basis until they can be
addressed by the keystore owners.

Test: TH
Bug: 184833962
Change-Id: Idd96447370d6ff31032bbaecddbce0a035821f41
2021-04-09 09:28:22 +02:00
Treehugger Robot
3478647654 Merge "Handle keystore keys that are missing certificates." am: f44834ab28
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1670632

Change-Id: I7db0fe415f6bb638263e1e56c4be33f530871fee
2021-04-09 06:53:51 +00:00
Treehugger Robot
f44834ab28 Merge "Handle keystore keys that are missing certificates." 2021-04-09 06:22:48 +00:00
Treehugger Robot
7482a22c43 Merge "Keystore 2.0: Implement unique id rotation on factory reset." am: 0b0d11f8ea am: 7c01b0cd3b
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1668629

Change-Id: I28edc675df7662e7d1f285631a38565d0a24c02f
2021-04-09 05:10:55 +00:00
Treehugger Robot
7c01b0cd3b Merge "Keystore 2.0: Implement unique id rotation on factory reset." am: 0b0d11f8ea
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1668629

Change-Id: I63c16c42e236c4f15c0473666ed4366df423173d
2021-04-09 04:49:55 +00:00
Treehugger Robot
0b0d11f8ea Merge "Keystore 2.0: Implement unique id rotation on factory reset." 2021-04-09 04:16:12 +00:00
A. Cody Schuffelen
f74ca25a63 Handle keystore keys that are missing certificates.
The calling code handles missing public keys, but the implementation did
not handle missing certificates, so this would trigger a program crash.

Test: Run with cuttlefish keymint implementation
Bug: 182928606
Change-Id: Ie80373d0a3eca2b39e963c175feafd20698f499b
2021-04-08 20:58:04 -07:00
Andrei Homescu
0a8291bf98 Keystore 2.0: Use Strong<> for Rust AIDL interfaces
This updates the APC code to use &Strong<dyn IConfirmationCallback>
instead of &dyn IConfirmationCallback for AIDL interfaces.

Bug: 182890877
Test: m
Change-Id: Ia841cf22daa1ef2f497fcc9bd0bbfa649100f86e
2021-04-08 22:01:02 +00:00
Janis Danisevskis
5cb52dc417 Keystore 2.0: Implement unique id rotation on factory reset.
This patch implements unique id rotation on factory reset. It is assumed
that the timestamp file disappears on factory reset so the timestamp
file's creation time gives a lower bound on the time since the last
factory reset.

Bug: 184784809
Test: atest keystore2_test
Change-Id: Iaa1c74b0ccffe69d5d9c68e7c6dac98a13136437
2021-04-08 14:08:47 -07:00
Janis Danisevskis
f120d1c0e4 Merge "Keystore 2.0: Sensitive data annotation." am: 8ec84b332b am: 2e323bd170
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1665679

Change-Id: Iad32ad04f0b1e32f51fc061bbaa4937318e6d4da
2021-04-08 00:31:51 +00:00
Janis Danisevskis
2e323bd170 Merge "Keystore 2.0: Sensitive data annotation." am: 8ec84b332b
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1665679

Change-Id: I2169bac0fbe1ad292cadf688480279ce6afbaea6
2021-04-07 22:55:04 +00:00