Commit graph

5418 commits

Author SHA1 Message Date
Vikram Gaur
1a98f9cca9 Unbind Attestation keys when freeing up namespace.
In https://android-review.googlesource.com/c/platform/system/security/+/1698833
we added a check only for client keys. However, this means that on application
deletion only the keystore keys related to the application are unbound and the
attestation keys get orphaned.

Through this change, I am planning to unbind the attestation keys related to
the application as well.

Change-Id: I1c9d1ac6d6943cc53f5d74653e3da72cd4f2adf7
Test: atest keystore2_test
BUG: 232534682
2022-05-25 21:58:34 +00:00
Treehugger Robot
2575230d42 Merge "Revert "Fix encoding of PubKeyEd25519"" 2022-05-23 16:15:03 +00:00
Alan Stokes
d331f07446 Revert "Fix encoding of PubKeyEd25519"
Revert submission 2101265-b/233338216

Reason for revert: Breaks tests: b/233588299
Reverted Changes:
I6f7a61ee3:Fix encoding of PubKeyEd25519
I544d9086f:Verify that the VM-generated BCC is valid

Change-Id: Ifb93514c1bef186d82f7b8ce3eb175655514b79b
2022-05-23 13:12:14 +00:00
David Drysdale
c28640b55e Merge "Adding forced operation tests" 2022-05-23 08:07:00 +00:00
Treehugger Robot
f697ae4995 Merge "Fix encoding of PubKeyEd25519" 2022-05-23 08:01:02 +00:00
Hasini Gunasinghe
64ac1f8e96 Merge "Log SecurityLevel with RkpErrorStats." 2022-05-20 18:04:02 +00:00
Rajesh Nyamagoud
fa7c0f1c41 Adding forced operation tests
- Forced operation creation with all slots filled with normal operations
- Forced operation creation with all slots filled with forced operations

Bug: 194359114
Test: atest keystore2_client_test
Change-Id: I493ea1c25d09597c44add430a20b5ca9c983e8d3
2022-05-20 15:40:03 +00:00
Treehugger Robot
b8f4e7c6cc Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/security" 2022-05-20 14:46:02 +00:00
Alan Stokes
56dd1977aa Fix encoding of PubKeyEd25519
Key ops should be an array rather than an integer
(https://datatracker.ietf.org/doc/html/rfc8152#section-7).

Bug: 233338216
Test: atest android.compos.test.ComposTestCase#testOdrefreshSpeed
Test: atest diced_open_dice_cbor_test
Change-Id: I6f7a61ee3828c3dc766f15c67950565081ba158e
2022-05-20 13:40:53 +01:00
Bob Badour
ae667ea93c [LSC] Add LOCAL_LICENSE_KINDS to system/security
Added SPDX-license-identifier-Apache-2.0 to:
  keystore2/tests/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: I816f5ba7db5e359b97f1bd0222ca43eebacfc4d1
2022-05-19 09:15:17 -07:00
Seth Moore
c9c373a19c Merge "Add extra OWNER, remove xoogler" 2022-05-18 21:16:51 +00:00
David Drysdale
cc74b54882 Add extra OWNER, remove xoogler
Test: None
Change-Id: I72c447e34aa4f21a33d95e3326ac617e165657df
2022-05-18 17:13:05 +01:00
Hasini Gunasinghe
1a8524bd0f Log SecurityLevel with RkpErrorStats.
Bug: 230750270
Test: Local testing with statsd TestDrive script
Merged-In: I8490e31df4a111ff6787ea67dd8a170b410566df
Change-Id: I8490e31df4a111ff6787ea67dd8a170b410566df
2022-05-18 06:26:45 +00:00
Alix Espino
16e71512d5 Merge "Deleted clang property in Android.bp files" 2022-05-17 05:26:58 +00:00
David Drysdale
dfa8b21553 Merge changes I52f95a7c,Iabe9af74
* changes:
  Adding test to create BACKEND_BUSY error
  rust_defaults entry created for Keystore2 AIDL library.
2022-05-17 05:22:17 +00:00
Rajesh Nyamagoud
b881d5189c Adding test to create BACKEND_BUSY error
Creates multiple child procs and creates opearations in it and
parent proc waits for all child procs operations status, expects
one or more opearations to fail with backeend busy error.

Bug: 194359114
Test: atest keystore2_client_test
Change-Id: I52f95a7cfd031d80c88bfc2ca478a26572f40150
2022-05-13 22:30:16 +00:00
Rajesh Nyamagoud
45689e569c rust_defaults entry created for Keystore2 AIDL library.
A rust_defaults "keystore2_use_latest_aidl_rust" that includes the latest
Keystore2 AIDL library. Modules that depend on Keystore2 directly can include
this rust_defaults to avoid managing dependency versions explicitly

Test: Compile
Change-Id: Iabe9af743c4ceb787db42ff7cc619bab97ec55c4
2022-05-13 19:33:36 +00:00
Alix
cb159ffa9f Deleted clang property in Android.bp files
Deleted deprecated clang property in Android.bp files using bpmodify.

Bug: 208980553
Test: treehugger
Change-Id: Id79d4e319ffc7d45b508772ae0df2e43bd22bf8f
2022-04-25 21:04:48 +00:00
David Drysdale
e2c4f0fcf4 Merge "Drop ancient default salt value" 2022-04-22 07:12:24 +00:00
Seth Moore
4c348bd49f Merge "Do not cache rkp_only property" 2022-04-21 17:23:11 +00:00
Seth Moore
dfdcb87504 Do not cache rkp_only property
To allow for testing, read the rkp_only properties every time instead
of caching the value. This allows the RemoteProvisioner tests to alter
the property, moving the device in and out of rkp-only mode.

Test: RemoteProvisionerUnitTests
Bug: 27306369
Change-Id: If9a616fd36095175f4aea07c897c67a11eb04bcf
2022-04-20 17:14:25 -07:00
Treehugger Robot
90c23a8c17 Merge "Fix lints from Rust 1.60.0" 2022-04-20 08:55:13 +00:00
Chris Wailes
20f50df906 Fix lints from Rust 1.60.0
Bug: 222737227
Test: m rust
Change-Id: I4f35c8e50a1837608ab69a7609caff9c485e8c85
2022-04-19 17:23:52 -07:00
Seth Moore
cd6b6a7ff8 Merge "Ensure that "rkp only" forces checks for rkp keys" 2022-04-19 16:17:30 +00:00
David Drysdale
6a0ec2ca08 Drop ancient default salt value
A value for the salt is present in all code paths:

- All callers of `Password::derive_key` pass a `Some(..)` value for the
  salt.  Remove this `Some` everywhere and...
- Change the signature of `derive_key` to expect a `&[u8]` for `salt`
  rather than an `Option<&[u8]>`.
- `Password::derive_key` is the only caller of `generateKeyFromPassword`
  (via bindgen to C++-land), so...
- Make it clear that the C++ `generateKeyFromPassword()` function
  expects 16 bytes of `salt`.

Bug: 172121323
Test: compile, TreeHugger
Change-Id: I41966cce96b5371785680c13bacfc5f95969372a
2022-04-19 11:25:26 +01:00
Seth Moore
562aebb873 Ensure that "rkp only" forces checks for rkp keys
An empty key pool should not allow fallback to the batch key if the
vendor indicates the system is rkp only.

Additionally, if the system is misconfigured (e.g. marked as rkp only
and has no remotely provisioned component hal) then we should insist
on checking RKP keys anyway. This will result in the given system
always returning OUT_OF_KEYS, which will fail various tests.

Test: keystore2_test
Test: RemoteProvisionerUnitTests
Bug: 227306369
Change-Id: I027bc56ff167abf99b18be01dccf05f90dd07f2a
2022-04-18 17:03:27 -07:00
Treehugger Robot
678a6f5af4 Merge "Turn on AFDO for keystore2" 2022-04-16 05:12:02 +00:00
Seth Moore
451c96f1e3 Merge "Fix unique id attestation on devices with keymaster" 2022-04-14 14:58:20 +00:00
Seth Moore
8c06c3e872 Fix unique id attestation on devices with keymaster
The wrong tag was included in the km_compat layer filter code for
key generation tags. This prevented the INCLUDE_UNIQUE_ID tag from
being passed to keymaster, breaking unique id attestation on platforms
with keymaster (keymint functionality was correct).

Test: KeyAttestationTest
Fixes: 228851969
Change-Id: I81ef55bb92c9869102a741e64375b883c3443224
2022-04-13 15:31:02 -07:00
Treehugger Robot
4e005bddd1 Merge "[LSC] Add LOCAL_LICENSE_KINDS to system/security" 2022-04-08 00:14:47 +00:00
Treehugger Robot
c3ab4bf4cf Merge "[Odsign] Record compos artifacts related metrics" 2022-04-07 20:30:38 +00:00
Bob Badour
11a8dab786 [LSC] Add LOCAL_LICENSE_KINDS to system/security
Added SPDX-license-identifier-Apache-2.0 to:
  keystore2/tests/legacy_blobs/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: Ifc2e14a9b60e364323794eaa5a8c181c4f0a78ee
2022-04-07 10:44:12 -07:00
Shikha Panwar
9429c9ecc0 [Odsign] Record compos artifacts related metrics
We write these records into odsign-metrics.txt. This
will later be read by system_server and sent to statsd.

comp_os_artifacts_check_record_ field in StatsReporter points to the
bufer which is later flushed to the file inm the dstructor.

Test: statsd_testdrive 19
Bug: 202926606
Change-Id: Ic6eca7e788a21120a0abca27b056e8ca355ac55a
2022-04-07 16:06:48 +00:00
Seth Moore
bdccd287c6 Merge "Add a new permission check around unique id attestation" 2022-04-06 12:40:27 +00:00
Seth Moore
8e95c7ce03 Merge "Return OUT_OF_KEYS if system is rkp only" 2022-04-04 23:10:32 +00:00
Max Bires
65207b5f10 Return OUT_OF_KEYS if system is rkp only
This change leverages the ro.remote_provisioning.rkp_only system
property in order to determine whether or not the system has fallback
keys. If there are no fallback keys, then ks2 will now return
OUT_OF_KEYS as a ResponseCode to the caller over the binder interface.

This will allow the caller to call generateKey() on the
RemoteProvisioner AIDL interface, blocking until the call is returned.
At this point, keys will either have been provisioned, or an actionable
error can be routed back to the developer.

Bug: 227306369
Test: atest RemoteProvisionerUnitTests
Change-Id: I8f5bc5add4ab895ab95c9e4e70e6fc9fa4422da5
2022-04-04 11:20:10 -07:00
Pirama Arumuga Nainar
205a7e59a9 Merge "Use shared libutils instead of static for keystore fuzzers" 2022-04-01 19:20:19 +00:00
Treehugger Robot
7de12b5730 Merge changes from topic "legacy_blob_tests"
* changes:
  Keystore 2.0: Add legacy blob test to TEST_MAPPINGS
  Adding tests to validate support for encrypted legacy blobs.
2022-03-31 21:48:48 +00:00
Seth Moore
66d9e908bf Add a new permission check around unique id attestation
Allow an application to either have an selinux permission or a
privileged application permission to request a unique id attestation.
Eventually, we will remove the sepolicy permission. However, until
GMSCore is updated to pick up the new permission, keep the policy
around.

Test: KeyAttestationTest
Bug: 216778747
Change-Id: I2401ca630d1599f0399b47e1fd9dd88d78318b95
2022-03-30 11:18:00 -07:00
Frederick Mayle
8945ea98e9 Merge "keystore: Fix double ownership of ConfirmationListener in test" 2022-03-29 20:49:01 +00:00
Janis Danisevskis
005400ef16 Keystore 2.0: Add legacy blob test to TEST_MAPPINGS
Test: keystore2_legacy_blob_test
Change-Id: Ifdd50bf2d837fc9120b0f847adca18bfde2be0ff
2022-03-29 19:59:48 +00:00
Rajesh Nyamagoud
3b6427961c Adding tests to validate support for encrypted legacy blobs.
Bug: 213173772
Bug: 213172664
Bug: 203101472
Test: atest keystore2_legacy_blobs_test
Change-Id: I3c898c4447c114dd6a9481615a3366c76ad3a2bb
2022-03-29 17:48:21 +00:00
Frederick Mayle
b3f93cded3 keystore: Fix double ownership of ConfirmationListener in test
Using std::make_shared with ndk::SharedRefBase objects causes memory
errors.

Test: TH
Bug: 226379467
Change-Id: I889f7a5b79b4c22b313cdcb6a118d7bb5d62d7a5
2022-03-29 17:37:14 +00:00
Treehugger Robot
095a4fcd78 Merge "Create authorizations and key_generations test modules -" 2022-03-29 17:03:16 +00:00
Rajesh Nyamagoud
901386c2c4 Create authorizations and key_generations test modules -
- authorizations: helper struct to create set of key authorizations
   - key_generations: helper methods to generate various keys.

Test: N/A
Change-Id: I23250838b7b6d8ad59f5ef8682861a07e856299f
2022-03-25 19:51:23 +00:00
Pirama Arumuga Nainar
aa7e8ba4fb Use shared libutils instead of static for keystore fuzzers
Bug: http://b/197965342

These fuzzers depend on libhidlbase.so which already depends on
libutils.so.  Moving to shared dep for them doesn't increase their
shared-library closure.  Using libutils.a instead causes build failures
with upstream lld because lld tries to fetch symbols from libutils.a to
resolve undefined symbols from libhidlbase as well.

Test: cherry-pick aosp/2036867 and `mma system/keystore`
Change-Id: I4a2d215736867032a13686c31978eaeec17fc15a
2022-03-24 19:06:05 -07:00
Treehugger Robot
b174ed0494 Merge "Keystore 2.0: Make KeyParameters serializable." 2022-03-25 00:54:46 +00:00
Janis Danisevskis
5d772ef30a Keystore 2.0: Make KeyParameters serializable.
This is required to enable keystore client tests.
Test: keystore2_test

Change-Id: I6e3c81180244e45f403d8d79c86650dcd33cc21a
2022-03-24 14:34:11 -07:00
Andrew Scull
8058404d27 Merge "Diced: Don't add resettable config" 2022-03-24 21:20:57 +00:00
Andrew Scull
c7bc7e9e16 Diced: Don't add resettable config
Unless the loader actively ensures the key change on factory reset, omit
the resettable (-70004) property from the config descriptor. By the time
diced gets involved, it's just along for the ride and it was down to the
earlier stages to enforce resetting across factory reset.

Test: atest system/security/diced
Bug: 225177477
Change-Id: I728774843cf0f4468bc7e98ccb29c27c1e808da5
2022-03-24 17:52:40 +00:00