Commit graph

8244 commits

Author SHA1 Message Date
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
Alice Wang
2dbabf3b72 [rkpd_client] Add Error type to rkpd_client
This makes rkpd_client independent of keystore2 and facilitates
the extraction of rkpd_client as a standalone library later.

Test: atest keystore2_test
Bug: 241428146
Change-Id: I3bcf0afdb587b2e95bd9a970631c29696f57ed4f
2023-11-09 09:28:36 +00:00
Alice Wang
4277d2e1ca [rkpd] Move watchdog calls from rkpd_client to keystore2
This cl moves watchdog calls to keystore2 to make rkpd_client
less dependent on keystore2, this allows us to make rkpd_client
an independent library more easily later.

Test: atest keystore2_test
Bug: 241428146
Change-Id: Ic3040ad65356aa7e25d38f36d453a258caf28403
2023-11-08 09:15:54 +00:00
Alice Wang
f1aba2721c Merge "[refactor] Split the message macro in a standalone library for reuse" into main 2023-11-08 09:05:30 +00:00
Alice Wang
5f70d89999 Merge "[rkpd] Move security level to RPC name conversion out of rkpd_client" into main 2023-11-08 09:05:21 +00:00
Alice Wang
e66c3310cd [refactor] Split the message macro in a standalone library for reuse
This simplifies the task of creating an independent library of
rkpd_client later.

Test: atest keystore2_test
Bug: 241428146
Change-Id: Idddf37d14580e691fde5a494e54297465cb693b6
2023-11-07 13:47:54 +00:00
Alice Wang
bf6a693217 [rkpd] Move security level to RPC name conversion out of rkpd_client
This will facilitate the extraction of rkpd_client as a standalone
library later.

Test: atest keystore2_test
Bug: 241428146
Change-Id: Icff6f88f2c3cc3dc50dd126067ed5f10c8aa7b29
2023-11-07 13:27:54 +00:00
Alice Wang
9e89235bf1 Merge "[refactor] Split watchdog in a standalone library for reuse" into main 2023-11-07 12:28:16 +00:00
Alice Wang
83c6aefb5d [refactor] Split watchdog in a standalone library for reuse
This simplifies the task of creating an independent library of
rkpd_client later.

Test: atest keystore2_test
Bug: 241428146
Change-Id: I2834c9be9f5100d52829e6392f0dd48e7c76beb1
2023-11-07 10:30:26 +00:00
Treehugger Robot
0e4c1c4129 Merge "Update needed for Rust v1.73.0" into main 2023-11-06 23:44:04 +00:00
Charisee
78e844b86a Update needed for Rust v1.73.0
Remove redundancy
Bug: 303252546
Test: ./test_compiler.py --prebuilt-path dist/rust-dev.tar.xz  --target aosp_cf_x86_64_phone --image

Change-Id: Ia4366c2694c235f8931eea56d13548f08805952f
2023-11-06 20:41:19 +00:00
Orlando Arbildo
c0e1f3589b Merge "Adding 'static bound on binder Interface implementation" into main 2023-11-06 18:44:01 +00:00
James Willcox
855f233004 Merge "Add getLastAuthTime() to IKeystoreAuthorization" into main 2023-11-02 21:09:20 +00:00
James Willcox
d215da817a Add getLastAuthTime() to IKeystoreAuthorization
This returns the time (from CLOCK_MONOTONIC_RAW) that the specified user
last authenticated using the given authenticator.

Bug: 303839446
Test: atest keystore2_client_tests
Change-Id: Idd4c477365ffa556b7985d1d926dfa554680ff28
2023-10-31 20:30:50 +00:00
Treehugger Robot
449c3b2cec Merge "Adding tests using APPLICATION_DATA and APPLICATION_ID." into main 2023-10-31 18:22:42 +00:00
Orlando Arbildo
9ee036add7 Adding 'static bound on binder Interface implementation
Adding a 'static bound for a binder Interface Implementation.
This is now needed to allow new code used to cast a Binder
Native object back to the original object that implements the
Binder Interface.

Test: CI
Bug: 278780666
Change-Id: Ifa1ec4d4c6692d75ada6c58cb97e6c82b791be04
2023-10-31 00:15:22 +00:00
Shaquille Johnson
ca3fa2b990 Merge "Add flag for deprecation of Legacy Keystore" into main 2023-10-30 05:18:05 +00:00
Shaquille Johnson
7e4cd0ade7 Add flag for deprecation of Legacy Keystore
Test: m keystore2
Bug: 307460850
Change-Id: Ib09449ad1a84c9f6dd455d8b14e1830788c86d49
2023-10-30 03:53:36 +00:00
Rajesh Nyamagoud
290dd7386f Adding tests using APPLICATION_DATA and APPLICATION_ID.
1. Generate a key with application-data and use the generated key to
   create an operation using the same application-data. Test should
   create an operation successfully.

2. Generate a key with application-data and use the generated key to
   create an operation using different application-data. Test should
   fail to create an operation with `INVALID_KEY_BLOB` error code.

3. Generate a key with application-id and use the generated key to
   create an operation using the same application-id. Test should
   create an operation successfully.

4. Generate a key with application-id and use the generated key to
   create an operation using different application-id. Test should
   fail to create an operation with `INVALID_KEY_BLOB` error code.

5. Generate an attestation key without app-id and app-data. Test should
   generate a new key with specifying app-id, app-data and using
   previously generated attestation key. Test should be able to generate
   a new key successfully.

6. Generate an attestation key with app-id and app-data. Test should try
   to generate an attested key using previously generated attestation
   key without specifying same app-id, app-data. Test should fail to
   generate a new key with an error code `INVALID_KEY_BLOB`. It is an
   oversight of the Keystore API that `APPLICATION_ID` and
   `APPLICATION_DATA` tags cannot be provided to generateKey for
   an attestation key that was generated with them.

Bug: 279721870
Test: atest keystore2_client_tests
Change-Id: I56fad4806c6d96c5994f4affdd7aa6620b1f1be8
2023-10-27 19:25:09 +00:00
Tri Vo
c08cf0863a Merge "Add keystore2_client_tests to VTS" into main 2023-10-27 16:07:38 +00:00
Eran Messeri
6b0612d62c Merge "Add keystore2_client_tests to TEST_MAPPING" into main 2023-10-25 18:49:43 +00:00
Tri Vo
4e6dbef7f7 Add keystore2_client_tests to VTS
Bug: 194359114
Test: keystore2_client_tests
Change-Id: I74f29e8c42fd6fdca07a7999dfc2e5345ad45c09
2023-10-23 14:50:30 -04:00
Tri Vo
724e4e5660 Add keystore2_client_tests to TEST_MAPPING
Bug: 194359114
Test: keystore2_client_tests
Change-Id: Ia5f774cd797d1b4b4e343a5588833739ad4843ee
2023-10-23 14:50:25 -04:00
Eran Messeri
f692f42327 Merge "The INCLUDE_UNIQUE_ID parameter is not strictly expected to be in key authorizations." into main 2023-10-20 16:14:01 +00:00
Rajesh Nyamagoud
17a9261560 The INCLUDE_UNIQUE_ID parameter is not strictly expected to be in key authorizations.
Bug: 279721870
Test: atest keystore2_client_tests
Change-Id: Ic5724cf7ea2b6ad6d1f80e34524af777e5e0ea49
2023-10-19 17:29:12 +00:00
Eric Biggers
6ec35f4461 Merge changes I98f7716d,I9b16934f,I78f15e21 into main
* changes:
  keystore2: rename the ScreenLockBound superencryption keys and type
  keystore2: rename the LskfBound superencryption key and type
  keystore2: rename values of UserState enum
2023-10-19 16:22:26 +00:00
Eric Biggers
b1f641d7a5 keystore2: rename the ScreenLockBound superencryption keys and type
Rename the ScreenLockBound superencryption keys and superencryption type
to UnlockedDeviceRequired.  This avoids confusion about what "screen
lock bound" means and makes the terminology consistent with the
UnlockedDeviceRequired key parameter in the API.

Bug: 296464083
Test: atest -p --include-subdirs system/security/keystore2
Test: atest CtsKeystoreTestCases
Flag: exempt, mechanical refactoring and comment changes
Change-Id: I98f7716d05c06f8c6db0f3eb616fb6e780407c2d
2023-10-18 01:54:18 +00:00
Eric Biggers
673d34addb keystore2: rename the LskfBound superencryption key and type
Rename the LskfBound superencryption key and superencryption type (also
known as per-boot) to AfterFirstUnlock.

This makes it much clearer what the protection of this key is.  This
includes avoiding the misleading use of "LSKF"; the secret that's
actually relevant is the user's synthetic password, which is most
commonly unlocked with the LSKF but can potentially be unlocked in other
ways.  This is also helpful for the planned change to make the user's
super keys exist even while the user doesn't have an LSKF.

Bug: 296464083
Test: atest -p --include-subdirs system/security/keystore2
Test: atest CtsKeystoreTestCases
Flag: exempt, mechanical refactoring and comment changes
Change-Id: I9b16934f37222fef2bf01830f521928ef2c1853a
2023-10-18 01:54:18 +00:00
Eric Biggers
1386937eca keystore2: rename values of UserState enum
Rename UserState::LskfLocked to UserState::BeforeFirstUnlock, and
rename UserState::LskfUnlocked to UserState::AfterFirstUnlock.

This makes it much clearer what these states are.  This includes
avoiding the misleading use of "LSKF"; the secret that's actually
relevant is the user's synthetic password, which is most commonly
unlocked with the LSKF but can potentially be unlocked in other ways.
This is also helpful for the planned change to make the user's super
keys exist even while the user doesn't have an LSKF.

Bug: 296464083
Test: atest -p --include-subdirs system/security/keystore2
Test: atest CtsKeystoreTestCases
Flag: exempt, mechanical refactoring and comment changes
Change-Id: I78f15e2165876951c98e22e577fc4c92a3602b3b
2023-10-18 01:54:18 +00:00
Victor Hsieh
61e3d4fa11 Merge "Flag guard to make fsverity_init a no-op" into main 2023-10-17 18:25:10 +00:00
Victor Hsieh
0da66a5537 Flag guard to make fsverity_init a no-op
As early as fsverity_init, the flag can only be static (thus
is_fixed_read_only). It is now a constant/false and will be flipped
during the ramp up at build time.

Bug: 290064770
Test: mma
Test: Inspect the generated code
Change-Id: I4bd1addb996705f6e6b9f75313bf22b9ecd3e11c
2023-10-17 10:54:28 -07:00
Treehugger Robot
7eea1e3c1c Merge "Update needed for Rust v1.73.0" into main 2023-10-17 16:33:52 +00:00
David Drysdale
abdfe3a53e Merge "Add utilities to deal with software keyblobs" into main 2023-10-17 06:44:29 +00:00
Treehugger Robot
e79fe80acf Merge changes Ic7857267,I2bf53018 into main
* changes:
  Adding tests to check unique id attestation.
  Changes are made in keystore-client-tests to verify CREATION_DATETIME, ATTESTATION_CHALLENGE and ATTESTATION_APPLICATION_ID.
2023-10-16 17:20:52 +00:00
Eric Biggers
b6d1dfbe0b Merge "Remove IKeystoreMaintenance#getState()" into main 2023-10-16 16:26:56 +00:00
Alice Wang
3fed4bfcae Merge "[dice] Move open-dice Rust wrapper libraries to virt" into main 2023-10-16 15:07:50 +00:00
Alice Wang
817b5a046b [dice] Move open-dice Rust wrapper libraries to virt
Since these wrapper libraries are only used in virt projects.

Test: atest MicrodroidHostTests
Change-Id: I917c06bd031bb5bcd493fdc3435f8ec688bb705e
2023-10-16 13:47:23 +00:00
Charisee
6fff58e850 Update needed for Rust v1.73.0
Bug: 303252546
Test: ./test_compiler.py --prebuilt-path dist/rust-dev.tar.xz  --target aosp_cf_x86_64_phone --image
Change-Id: Icbe8740b2bff6bf35fd18cdaee1518af5a11a348
2023-10-14 21:11:03 +00:00
Alice Wang
28c7dceb22 Merge "[dice] Add API to derive CDI_Leaf_Priv from DiceArtifacts" into main 2023-10-13 14:34:18 +00:00
Treehugger Robot
df6fe6d17d Merge "Adding tests using MAX_USES_PER_BOOT, EARLY_BOOT_ONLY, BOOTLOADER_ONLY and USAGE_COUNT_LIMIT" into main 2023-10-13 10:56:03 +00:00
Alice Wang
fd9ebcf62e [dice] Add API to derive CDI_Leaf_Priv from DiceArtifacts
This function will be uses in several places for pVM
remote attestation.

Bug: 303807447
Test: atest libdiced_sample_inputs.integration_test \
libdiced_sample_inputs_nostd.integration_test

Change-Id: I6f45ff35c6e48eb42a32d28c1eb3e851859db655
2023-10-13 08:38:29 +00:00
David Drysdale
c0ed986a8d Add utilities to deal with software keyblobs
Add code (adapted from system/keymint/common/src/keyblob/legacy.rs)
which parses keyblobs in the format produced by the previous C++
reference implementation of KeyMint.

Bug: 283077822
Bug: 296403357
Test: tested with ARC upgrade, see b/296403357
Change-Id: I519eed0ac968d5c2595f95609ffadede5d2d2677
2023-10-12 09:27:49 +01:00
David Drysdale
cc5143e2b1 Merge changes I8539455e,I14f0d535 into main
* changes:
  Cope with Keymaster->KeyMint device upgrade
  Commonize upgrade_keyblob_if_required_with
2023-10-11 10:50:21 +00:00
Tri Vo
1cb39dd704 Merge "Adding tests using tags ACTIVE_DATETIME, ORIGINATION_EXPIRE_DATETIME, USAGE_EXPIRE_DATETIME." into main 2023-10-10 14:21:18 +00:00
Tri Vo
deeda26f0f Merge "Restructuring of AAID using aidl_interface build system." into main 2023-10-10 14:04:23 +00:00
David Drysdale
5accbaa18a Cope with Keymaster->KeyMint device upgrade
When handling keyblob upgrade required, also watch out for an invalid
keyblob error that might indicate that a key used to be a
km_compat-wrapped Keymaster key.

In this situation, try stripping off the km_compat prefix and
attempt upgrade of the inner keyblob data instead.

Bug: 251426862
Bug: 283077822
Bug: 296403357
Test: tested with ARC upgrade, see b/296403357
Change-Id: I8539455e33ab2e1c97f26174476ee9d616269e74
2023-10-10 07:04:50 +01:00
Eric Biggers
2f9498af06 Remove IKeystoreMaintenance#getState()
IKeystoreMaintenance#getState() is no longer called, so remove it along
with the enum value for the GetState permission.

Bug: 296464083
Test: atest -p --include-subdirs system/security/keystore2
Change-Id: I9ec6cca78cd1eb899ac7adfc99fc5eee41dc7e44
2023-10-09 23:16:05 +00:00
Rajesh Nyamagoud
f408c28c0e Adding tests to check unique id attestation.
Bug: 279721870
Test: atest keystore2_client_tests
Change-Id: Ic7857267345035ad0d92d8176d34cfe3e64e5c62
2023-10-09 21:59:43 +00:00
Rajesh Nyamagoud
5f6db2f442 Changes are made in keystore-client-tests to verify CREATION_DATETIME,
ATTESTATION_CHALLENGE and ATTESTATION_APPLICATION_ID.

Bug: 279721870
Test: atest keystore2_client_tests
Change-Id: I2bf530189e41ede27763ef696ff9a126c4110e24
2023-10-09 21:51:19 +00:00
Rajesh Nyamagoud
f436a9326c Adding tests using MAX_USES_PER_BOOT, EARLY_BOOT_ONLY, BOOTLOADER_ONLY and USAGE_COUNT_LIMIT
1. Generate a key with `BOOTLOADER_ONLY` tag. Test should successfully
   generate a key and verify the key characteristics. Test should fail
   with error code `INVALID_KEY_BLOB` during creation of an operation
   using this key.

2. Generate a key with `EARLY_BOOT_ONLY` tag. Test should successfully
   generate a key and verify the key characteristics. Test should fail
   with error code `EARLY_BOOT_ENDED` during creation of an operation
   using this key.

3. Generate a key with `MAX_USES_PER_BOOT` tag. Test should successfully
   generate a key and verify the key characteristics. Test should be
   able to use the key successfully `MAX_USES_COUNT` times. After
   exceeding key usage `MAX_USES_COUNT` times subsequent attempts to use
   the key in test should fail with error code `MAX_OPS_EXCEEDED`.

4. Generate a key with `USAGE_COUNT_LIMIT` tag. Test should successfully
   generate a key and verify the key characteristics. Test should be
   able to use the key successfully `MAX_USES_COUNT` times. After
   exceeding key usage `MAX_USES_COUNT` times subsequent attempts to use
   the key in test should fail with error code `KEY_NOT_FOUND`. Test
   should also check attest record for attested keys that
   `USAGE_COUNT_LIMIT` is included in attest record.

Bug: 279721870
Test: atest keystore2_client_tests
Change-Id: I205964b571d92dc0fcbd11b1f6d45bc3aea7c050
2023-10-09 21:44:48 +00:00