Commit graph

8585 commits

Author SHA1 Message Date
Seth Moore
2203ec7c81 Merge "Revert "Static link libcrypto into rkp_factory_extraction_tool"" into main am: ba35a7e36b
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2823035

Change-Id: If7eff17ab58e8beaca18f012957c23c37d2a9052
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-09 17:01:04 +00:00
Seth Moore
ba35a7e36b Merge "Revert "Static link libcrypto into rkp_factory_extraction_tool"" into main 2023-11-09 16:22:59 +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
David Drysdale
746e1be8ef Cope with previously-emulated keys
If a device has upgraded Android versions then the KeyMint device
may also have been upgraded.  If that's the case, then there may
be keyblobs that were created in software on the old device, because it
didn't support some feature.

Watch out for these keys, and if encountered, try to import them into
the current KeyMint device:

- extract the key material from the key blob
- add PKCS#8 wrapping for import

Bug: 283077822
Bug: 296403357
Test: tested with ARC upgrade, see b/296403357
Change-Id: I146f7cfdaac9fe22b7bb6850b7e48ea113945902
2023-11-09 07:20:23 +00:00
Alice Wang
d006595fb1 Merge "[rkpd] Move watchdog calls from rkpd_client to keystore2" into main am: 779c94e7f2
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2821690

Change-Id: I61fda2efe5167f2dfba8fb5347b5872bacf59fe3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-08 22:10:14 +00:00
Alice Wang
779c94e7f2 Merge "[rkpd] Move watchdog calls from rkpd_client to keystore2" into main 2023-11-08 21:41:34 +00:00
Seth Moore
891d4c5741 Revert "Static link libcrypto into rkp_factory_extraction_tool"
Revert submission 2706393-static-link-hwtrust

Reason for revert: This seems to be causing CFI failures.

Reverted changes: /q/submissionid:2706393-static-link-hwtrust

Change-Id: I5b301341ee869ace00a1314e65fbdc5e34863b64
2023-11-08 19:42:48 +00:00
Eric Biggers
c826c0669a Merge changes I26394509,I9d76a0ec,I88779273 into main am: 17e96a8797
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2805741

Change-Id: Icfd47ed73a6172a8c118f44e5ef653b7e8b1d885
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-08 18:48:06 +00:00
James Willcox
5b5890081b Merge "Use CLOCK_BOOTTIME for keystore2 auth token received time" into main am: 464c7d3d2b
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2822970

Change-Id: If5a14bee81ca590fcb378357d0487ccbca61dead
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-08 18:47:53 +00:00
Eric Biggers
17e96a8797 Merge changes I26394509,I9d76a0ec,I88779273 into main
* changes:
  keystore2: link to android.security flags library
  keystore2: log super key creation
  keystore2: factor out create_super_key()
2023-11-08 18:42:45 +00:00
James Willcox
464c7d3d2b Merge "Use CLOCK_BOOTTIME for keystore2 auth token received time" into main 2023-11-08 18:12:42 +00:00
James Willcox
80f7be1516 Use CLOCK_BOOTTIME for keystore2 auth token received time
CLOCK_BOOTTIME is more correct because it includes time spent
while the device is suspended.

This also fixes an issue when comparing the times resulting from the
get_last_auth_time() API in the Java world, because we want to use
SystemClock.elapsedRealtime(), which uses CLOCK_BOOTTIME.

Bug: 309686873
Test: atest keystore2_client_tests
Change-Id: I89d71ccfcfe4f8b3495fede40ae26ad6fa2b0118
2023-11-08 17:13:49 +00:00
Alice Wang
e82faef4b4 Merge "[refactor] Split the message macro in a standalone library for reuse" into main am: f1aba2721c
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2817476

Change-Id: I1f3230880e2ea34e938fc78f80e0198ba60279cc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-08 09:36:08 +00:00
Alice Wang
17fabddcdb Merge "[rkpd] Move security level to RPC name conversion out of rkpd_client" into main am: 5f70d89999
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2817839

Change-Id: I467a61afa45cfd5f10e11286eee3951c33c0c47c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-08 09:35:01 +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
f001f6c7ea Merge "[refactor] Split watchdog in a standalone library for reuse" into main am: 9e89235bf1
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2817564

Change-Id: I27a7b8166fe86d4bbbaf529372f9c2ccffe2546b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-07 12:45:44 +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
f05f5ca2d3 Merge "Update needed for Rust v1.73.0" into main am: 0e4c1c4129
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2817885

Change-Id: Ibf8a3267641b542ffacdc8318f6f9104afc3eea0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-07 00:34:23 +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
d22ca185e0 Merge "Adding 'static bound on binder Interface implementation" into main am: c0e1f3589b
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2811277

Change-Id: I6e945f0c2252e3a9b7d13e34f479fa794b238e61
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-06 19:27:55 +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
703e6f78d5 Merge "Add getLastAuthTime() to IKeystoreAuthorization" into main am: 855f233004
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2770182

Change-Id: Id80d18310cfe807e468dfe7d5a7b7ed759e743da
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-11-02 21:39:59 +00:00
Eric Biggers
698922b0a6 keystore2: link to android.security flags library
Make it possible for keystore2 to check android.security flags.

Bug: 296464083
Test: Build
Change-Id: I263945093ed9c76d914018b7ae24bf6151157c0c
2023-11-02 21:19:42 +00:00
Eric Biggers
6745f53b46 keystore2: log super key creation
Log an informational message when creating each of a user's super keys,
as these are significant events.

Bug: 296464083
Test: atest -p --include-subdirs system/security/keystore2
Flag: exempt, just adds a log message
Change-Id: I9d76a0ec06fae208412f4c6cf1b7dd739b023a61
2023-11-02 21:19:31 +00:00
Eric Biggers
456a3a6974 keystore2: factor out create_super_key()
Currently the UnlockedDeviceRequired super keys are created by
get_or_create_super_key(), while the AfterFirstUnlock super key is
created by separate code in init_user().  The super key creation code in
get_or_create_super_key() is generic enough to work for all super keys,
however.  This CL factors this code out into a new function
create_super_key(), which a later CL will use for the AfterFirstUnlock
super key.  No change in behavior.

Bug: 296464083
Test: atest -p --include-subdirs system/security/keystore2
Flag: exempt, mechanical refactoring
Change-Id: I88779273efef6cb925152381c07549e1f49daecf
2023-11-02 21:19:31 +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
ee68b156f3 Merge "Adding tests using APPLICATION_DATA and APPLICATION_ID." into main am: 449c3b2cec
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2616129

Change-Id: I15080689250d687f66c53d7bf3984688d9e90f1c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-31 19:02:02 +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
fb1dc5db9c Merge "Add flag for deprecation of Legacy Keystore" into main am: ca3fa2b990
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2799438

Change-Id: Ie39461669d42bb9793802cc2d0c74eee9a363dea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-30 05:45:13 +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
64da3e766c Merge "Add keystore2_client_tests to VTS" into main am: c08cf0863a
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2800414

Change-Id: I04e587ad7709fab315db60f9c96653277cb6ffe8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-27 16:23:26 +00:00
Tri Vo
c08cf0863a Merge "Add keystore2_client_tests to VTS" into main 2023-10-27 16:07:38 +00:00
Eran Messeri
ae7b5aa069 Merge "Add keystore2_client_tests to TEST_MAPPING" into main am: 6b0612d62c
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2800413

Change-Id: Ie4a1139aa3ba1bdf6f20db3fb86143bc6f81bfbe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-25 19:24:21 +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
326c1f4795 Merge "The INCLUDE_UNIQUE_ID parameter is not strictly expected to be in key authorizations." into main am: f692f42327
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2793532

Change-Id: Ifbabfdc3a61a1bd3f751bc84de5a0d04c18d4cd7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-20 17:31:31 +00: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
0be4a87a19 Merge changes I98f7716d,I9b16934f,I78f15e21 into main am: 6ec35f4461
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2795484

Change-Id: I46c283d858f26147117cab7d2e2990f27d4890a7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-10-19 16:48:26 +00:00