Commit graph

8588 commits

Author SHA1 Message Date
Shaquille Johnson
a96ee28bf2 Merge "Remove duplicate code and add fn for flag check" into main am: 6f80e95312
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2852952

Change-Id: I45fbbdd55db2326ffa6f03b1fe1e1b09a2a0925c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-12-01 16:13:21 +00:00
Shaquille Johnson
6f80e95312 Merge "Remove duplicate code and add fn for flag check" into main 2023-12-01 15:22:59 +00:00
Shaquille Johnson
f015af1d56 Remove duplicate code and add fn for flag check
Test: atest CtsKeystoreTestCases
Change-Id: I47975e028896ebe5777bae8efe8b17507bb36500
2023-11-30 15:23:21 +00:00
Eric Biggers
d4553715a3 Merge "Rename the fix_unlocked_device_required_keys flag" into main am: 4835baecd7
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2843813

Change-Id: I672f702632447e66fa34eed4b866ea75497dc6e7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-30 00:21:18 +00:00
Eric Biggers
4835baecd7 Merge "Rename the fix_unlocked_device_required_keys flag" into main 2023-11-29 23:28:13 +00:00
Shaquille Johnson
abfc6f99d1 Merge "Deprecate put and return error in ILegacyKeystore" into main am: 2dc300aee0
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2797796

Change-Id: I0c99eff2ad660c565b2dba1c8e41293c33a7394d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-28 17:41:16 +00:00
Shaquille Johnson
2dc300aee0 Merge "Deprecate put and return error in ILegacyKeystore" into main 2023-11-28 16:13:22 +00:00
Shaquille Johnson
be6e91d15f Deprecate put and return error in ILegacyKeystore
Legacy keystore is a old relic that was suppoed to be
disabled a while ago. It has enabled functionality that was
supposed to be removed but wasn't because it would break
changes in the VPN and WIFI code. This would begin the
process of permanently removing it.

Test: atest CtsKeystoreTestCases
Change-Id: Iedc1dca24a40eb0cf30c5280fc2842ff79cf7f17
2023-11-28 15:12:04 +00:00
Shaquille Johnson
c705c146ba Merge "Rename flag wal_db_journalmode" into main am: 9c7503368f
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2843638

Change-Id: I57212c35ffd8b6ca9fe930480ce1ff3b9b132d60
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-27 17:14:26 +00:00
Shaquille Johnson
9c7503368f Merge "Rename flag wal_db_journalmode" into main 2023-11-27 16:07:15 +00:00
Shaquille Johnson
d28f5cbe9b Rename flag wal_db_journalmode
This flag was defined as a regular flag and then was later changed to a
fixed_read_only flag.  This scenario is currently "unsupported" by the
flags infrastructure; an error occurs when trying to advance the flag to
staging. Work around this by renaming the flag so that the flags
infrastructure sees it as an entirely new flag. This cl adds this flag
to the legacykeystore code as well.

Bug: 296464083
Bug: 311648623
Test: m keystore2
Change-Id: If62a5fac2404113ca0bbc0807f154401c4241bf1
2023-11-27 12:17:13 +00:00
Alice Wang
7835719ca7 Merge "[keystore2] Update comment when fetching rkpd attestation key" into main am: 0ecec06af2
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2845534

Change-Id: Ic9875170ce43bd7cce719d53daeb77e978f22e6b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-24 16:19:06 +00:00
Alice Wang
0ecec06af2 Merge "[keystore2] Update comment when fetching rkpd attestation key" into main 2023-11-24 15:40:49 +00:00
Alice Wang
f7148408b5 [keystore2] Update comment when fetching rkpd attestation key
No code change.

Test: atest keystore2_test
Bug: 310047761
Change-Id: I4269bd4bc146ac0d0aa7b5ca9af93957399aa7b6
2023-11-24 08:36:51 +00:00
Treehugger Robot
ab102cfc7b Merge "Fix android.keystore.cts.KeyAttestationTest" into main am: 111900fbc6
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2843680

Change-Id: Id2497d12d94a7f49178ac45b2b66696535304ee8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-23 13:47:46 +00:00
Treehugger Robot
111900fbc6 Merge "Fix android.keystore.cts.KeyAttestationTest" into main 2023-11-23 13:04:09 +00:00
Alice Wang
b03ed83251 Fix android.keystore.cts.KeyAttestationTest
This cl moves the RPC name searching logic inside the attestation
key fetch function to fix the failing tests.

Test: atest keystore2_test
Bug: 310047761
Change-Id: Ied5fbd3248cae6aec230cacfa6807b3cb2b7cf4b
2023-11-23 11:59:45 +00:00
Eric Biggers
6ea1c60e67 Rename the fix_unlocked_device_required_keys flag
This flag was defined as a regular flag and then was later changed to a
fixed_read_only flag.  This scenario is currently "unsupported" by the
flags infrastructure; an error occurs when trying to advance the flag to
staging.  Work around this by renaming the flag so that the flags
infrastructure sees it as an entirely new flag.

Bug: 296464083
Bug: 311648623
Test: build
Change-Id: Iafde2d63578bf65b3f5a08ab57561eadbe8f6b7a
2023-11-22 16:21:59 +00:00
David Drysdale
eed416d4a8 Merge changes I28f673b6,I146f7cfd into main am: 39b7af2fcd
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2821841

Change-Id: Ie8a1edf47feacc1a8a2be827e5f3cc82160d5742
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-20 11:18:03 +00:00
David Drysdale
39b7af2fcd Merge changes I28f673b6,I146f7cfd into main
* changes:
  Flag for import of previously-emulated keys
  Cope with previously-emulated keys
2023-11-20 10:43:44 +00:00
Alice Wang
6722754e43 Merge "Make librkpd_client available to com.android.virt" into main am: 416683bc23
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2817842

Change-Id: I24e5bc60d318e6d8cd5cdf725d082e86947faac0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-17 09:29:37 +00:00
Alice Wang
416683bc23 Merge "Make librkpd_client available to com.android.virt" into main 2023-11-17 09:05:45 +00:00
Eric Biggers
9a4da544c1 Merge "keystore2: fix UnlockedDeviceRequired to work without LSKF" into main am: dfbab7e6bc
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2805742

Change-Id: I04dceb29e39ab4683035edf03c8d89dcb6f4f920
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 18:32:36 +00:00
Eric Biggers
dfbab7e6bc Merge "keystore2: fix UnlockedDeviceRequired to work without LSKF" into main 2023-11-15 17:33:33 +00:00
Shaquille Johnson
e2b3a0b53e Merge "Change name of flag to specify put" into main am: f1a07b2fe1
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2830010

Change-Id: I21001255c15e5745a70693af9e4d123bee780798
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 12:40:46 +00:00
Eran Messeri
ea60fe79fc Merge "Test added to generate a key with specifying cerificate subject and certificate serial number. Test generates a key and verifies the specified key characteristics." into main am: a68eb23f51
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2619159

Change-Id: I1234289746a32bae2134b07274dff1c693b18d93
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 12:40:34 +00:00
Shaquille Johnson
f1a07b2fe1 Merge "Change name of flag to specify put" into main 2023-11-15 12:14:42 +00:00
Eran Messeri
a68eb23f51 Merge "Test added to generate a key with specifying cerificate subject and certificate serial number. Test generates a key and verifies the specified key characteristics." into main 2023-11-15 12:11:14 +00:00
Shaquille Johnson
6084409db8 Change name of flag to specify put
Test: unapplicable
Change-Id: If1bba7c7cc486ed443a75e024b04cd017424126b
2023-11-15 09:38:09 +00:00
Treehugger Robot
11d0c8fe28 Merge "Skip test case for AVF since those are not supported." into main am: c330132bda
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2828414

Change-Id: I62c7f9c17419706fd55b9dbc6dcd7dd5c837e9af
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-15 01:40:47 +00:00
Treehugger Robot
c330132bda Merge "Skip test case for AVF since those are not supported." into main 2023-11-15 01:12:02 +00:00
Vikram Gaur
016d24c813 Skip test case for AVF since those are not supported.
BUG: 308586759
Test: atest librkp_support_test
Change-Id: Iba47f0cc4284fa684e4e72667e9e553841087475
2023-11-15 00:01:17 +00:00
Treehugger Robot
4ecee2da29 Merge "Adding tests to verify Device-Unique-Attestation." into main am: 0e0b09a901
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2616219

Change-Id: If13aaeb9db3bd4da5c37f0da226220bca276b5db
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-14 23:28:46 +00:00
Rajesh Nyamagoud
e5557ffdce Test added to generate a key with specifying cerificate subject and
certificate serial number. Test generates a key and verifies the
specified key characteristics.

Bug: 279721870
Test: atest keystore2_client_tests
Change-Id: I3ea356da8ca3404a94081a680210a9f426a2b908
2023-11-14 23:25:30 +00:00
Treehugger Robot
0e0b09a901 Merge "Adding tests to verify Device-Unique-Attestation." into main 2023-11-14 23:04:35 +00:00
Rajesh Nyamagoud
b1c8e83392 Adding tests to verify Device-Unique-Attestation.
1. Test to verify Device-Unique-Attestation is not supported on
   `TRUSTED_ENVIRONMENT` security level. Test shoould fail to generate a
   key with device-unique-attestation with `INVALID_ARGUMENT` error code.

2. Generate EC/RSA keys with `DEVICE_UNIQUE_ATTESTATION` using `STRONGBOX`
   security level. Test should generate akey and verify key
   characteristics and cert-chain signatures. Test should be able to
   perform an operation using the generated key successfully.

3. Try to generate a device unique attested key with attestation of
   invalid device's identifiers. Test should fail to generate a key with
   error code `CANNOT_ATTEST_IDS`.

4. Generate a device unique attested key with attestation of the
   device's identifiers. Test should succeed in generating a attested
   key with attestation of device identifiers. Test might fail on
   devices which don't support device id attestation with error response
   code `CANNOT_ATTEST_IDS`. Separate test is added for each attestation
   id with RSA and EC keys.

Bug: 279721870
Test: atest keystore2_client_tests
Change-Id: I627a01dc44558a4393d14f9931b1708196ee6ff9
2023-11-14 21:33:19 +00:00
Alice Wang
134a7cb0bc Merge "[rkpd] Refactor rkpd_client into an independent lib for reuse" into main am: 6a5cfb02cf
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2817840

Change-Id: I56ae572cb4b5f6cacd9e4f44acd81bf496516004
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-14 08:08:06 +00:00
Alice Wang
6a5cfb02cf Merge "[rkpd] Refactor rkpd_client into an independent lib for reuse" into main 2023-11-14 07:37:00 +00:00
Alice Wang
9e519c85b2 Merge "Revert^2 "[rkpd_client] Add Error type to rkpd_client"" into main am: 5c96cefe87
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2824651

Change-Id: I774724e99e87aa1f1eaf3cb71693525dee90e23b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-13 22:13:11 +00:00
Alice Wang
5c96cefe87 Merge "Revert^2 "[rkpd_client] Add Error type to rkpd_client"" into main 2023-11-13 21:34:20 +00:00
Treehugger Robot
1947209766 Merge "Updated fuzz_config in Android.bp file" into main am: 98a802d844
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2505775

Change-Id: Id094bf5a3f7504724abd250556652a172f44f384
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-13 19:10:56 +00:00
Treehugger Robot
98a802d844 Merge "Updated fuzz_config in Android.bp file" into main 2023-11-13 18:43:15 +00:00
Eric Biggers
b0478cfa34 keystore2: fix UnlockedDeviceRequired to work without LSKF
The security improvements to UnlockedDeviceRequired in Android 12
regressed its behavior by making it no longer work for unsecured users,
e.g. users with a Swipe lock screen.  Two different things broke it:

1. Keystore started enforcing that a HardwareAuthToken be present for
   all keys that use UnlockedDeviceRequired.

2. Keystore started superencrypting all keys that use
   UnlockedDeviceRequired.  Previously, only keys that used
   UserAuthenticationRequired were superencrypted.

The above changes apparently resulted from a misconception that for the
device to be unlocked, the user must have authenticated.  However,
unsecured users cannot authenticate and cannot have HardwareAuthTokens,
yet the device is always considered unlocked for them.

This change first fixes cause (1) by making Keystore allow keys that use
UnlockedDeviceRequired to be used without a HardwareAuthToken, provided
that they don't also use UserAuthenticationRequired (which is the
protection that actually requires a HardwareAuthToken).

Regarding cause (2), superencryption is an important security
enhancement for UnlockedDeviceRequired, so it's not being removed.
Instead, the real problem is in the way that Keystore unnecessarily ties
superencryption to the existence of the LSKF.  That is, Keystore creates
a user's super keys only when an LSKF is set, and Keystore deletes all
the user's super keys and superencrypted keys when the LSKF is removed.

Therefore, this change, in coordination with the corresponding
LockSettingsService change, makes each user's Keystore super keys have
the same lifetime as the user's synthetic password.  That basically
means they are created when the user is created and are deleted only
when the user is deleted.  In addition, when a user's LSKF is removed,
Keystore now deletes *only* the user's auth-bound keys.

The fix for cause (1) is entirely in Keystore and is guarded by the
fix_unlocked_device_required_keys flag.  The fix for cause (2) consists
of two new IKeystoreMaintenance methods, initUserSuperKeys() and
onUserLskfRemoved(), that are called by LockSettingsService and are
flagged at the LockSettingsService level.  Note that once the flag is
removed, it will be possible to remove superseded code, including the
onUserPasswordChanged() method of IKeystoreMaintenance and the
init_user() and reset_user() functions that it calls.

Bug: 296464083
Test: # Did the following with and without the flag enabled:
      atest com.android.server.locksettings \
      && atest -p --include-subdirs system/security/keystore2 \
      && atest CtsKeystoreTestCases
Change-Id: If12824369fbad4a90e5cd0427e792655fd233b96
2023-11-13 18:39:29 +00:00
Alice Wang
307ff9e008 Make librkpd_client available to com.android.virt
Test: atest keystore2_test
Bug: 241428146
Change-Id: Ife0d4e9b55622089f262685d61bdefc2a52cbc47
2023-11-13 10:31:19 +00:00
Alice Wang
01c16b6142 [rkpd] Refactor rkpd_client into an independent lib for reuse
This allows rkpd_client to be reused by both keystore2 and
AVF pVM remote attestation.

Test: atest keystore2_test librkpd_client.test
Bug: 241428146
Change-Id: Ibdf95c4deb2ba499daaecd170c2971cda4e80bba
2023-11-13 10:31:08 +00:00
Alice Wang
849cfe4347 Revert^2 "[rkpd_client] Add Error type to rkpd_client"
This reverts commit f84c46c3b3.

Reason for revert: Reland the original cl aosp/2821995
with an adjustment about the Timeout error type in order
to maintain the original ResponseCode.

Test: atest RkpdAppIntegrationTests
Bug: 310139666
Change-Id: Id4ee05eb616c125f9d28b25f4668ca3071ccb26c
2023-11-13 10:28:14 +00:00
David Drysdale
093811ef22 Flag for import of previously-emulated keys
Test: build
Bug: 283077822
Change-Id: I28f673b6eb905c2953fbb91f2658ff224ca0e21c
2023-11-10 13:21:41 +00:00
Alice Wang
ddfb11931e Merge "Revert "[rkpd_client] Add Error type to rkpd_client"" into main am: 0b140f418a
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2824755

Change-Id: I8b7db0cd664c3d8c0bba5b4a9e9cb3840c2bdef2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-10 13:14:54 +00:00
Alice Wang
0b140f418a Merge "Revert "[rkpd_client] Add Error type to rkpd_client"" into main 2023-11-10 12:40:10 +00:00
Aashna Jena
f84c46c3b3 Revert "[rkpd_client] Add Error type to rkpd_client"
This reverts commit 2dbabf3b72.

Reason for revert: DroidMonitor revert for b/310139666

Bug: 310139666
Change-Id: I1213940cc4e3112038c1cc66f5a218a9378d6b0f
2023-11-10 12:13:22 +00:00