Commit graph

7640 commits

Author SHA1 Message Date
Tri Vo
b8f7444495 Update system/security owners
Test: n/a
Change-Id: I197d2350eac5de29eac2e37ff7dae2a5814bc3df
2023-07-18 14:51:14 -04:00
Treehugger Robot
60021566d5 Merge "Fix errors from rustc 1.71.0" into main 2023-07-13 05:24:19 +00:00
Treehugger Robot
3b2ded4544 Merge "rkp_factory_extraction_tool: append drm CSRs" into main 2023-07-13 00:33:30 +00:00
Chris Wailes
53a22af8e1 Fix errors from rustc 1.71.0
Bug: 288268986
Test: m rust
Change-Id: If972c3856297978663642c60d162fcc504eb659d
2023-07-12 17:02:47 -07:00
Robert Shih
d3c1f7c202 rkp_factory_extraction_tool: append drm CSRs
Bug: 286556950
Test: rkp_factory_extraction_tool
Change-Id: I9fe2898c53012c6cd640e4504ca4d882481ea2a9
2023-07-12 15:55:13 -07:00
Treehugger Robot
47617c1c0b Merge "credstore: remove unused variable" into main 2023-07-10 20:21:01 +00:00
Treehugger Robot
51b4e481ed Merge "Standardise safety comments for unsafe blocks." into main 2023-07-07 13:58:04 +00:00
Andrew Walbran
7f30e54158 Standardise safety comments for unsafe blocks.
These will soon be required by a lint.

Bug: 290018030
Test: m pvmfw_bin
Change-Id: I4faf7eb14eb8825af542c2da886d93c096068cb6
2023-07-07 13:42:25 +01:00
Eric Biggers
7eb4bf7c37 credstore: remove unused variable
Test: mmm system/security
Change-Id: I50f80bd823c9039eaa05cc724077f297af550462
2023-07-06 17:45:32 +00:00
Eric Biggers
6055d11ab9 Merge changes Id970743f,I50643f5d
* changes:
  ondevice-signing: merge createCertificate() into createSelfSignedCertificate()
  ondevice-signing: remove unused cert and signature code
2023-07-06 16:44:39 +00:00
Eric Biggers
1ee88c7a3f ondevice-signing: merge createCertificate() into createSelfSignedCertificate()
Since createSelfSignedCertificate() is now the only caller of
createCertificate(), merge createCertificate() into it.

Bug: 290064770
Test: atest odsign_e2e_tests_full
Change-Id: Id970743f1a3f3a3b7dd8a81da56c1e7b40959423
2023-07-05 22:14:36 +00:00
Eric Biggers
17d4ec3973 ondevice-signing: remove unused cert and signature code
Remove code that became unused due to the following commits:

- https://r.android.com/1988348
  ("Switch from compos_verify_key to compos_verify").

- https://r.android.com/2362310
  ("Stop adding cert of early boot key to fs-verity keyring")

Bug: 290064770
Test: atest odsign_e2e_tests_full
Change-Id: I50643f5ddf570d7185c577ec1d6bb8cd81c7af45
2023-07-05 22:14:01 +00:00
Ludovic Barman
d6f1ea3344 Merge "Update fsverity+odsign protos to protobuf3." 2023-07-04 14:41:51 +00:00
Robert Shih
919e4eb8b8 Merge "Export rkp_factory_extraction_tool on ci" 2023-06-30 07:51:01 +00:00
Robert Shih
5b2d983609 Export rkp_factory_extraction_tool on ci
Bug: 288957546
Test: TreeHugger
Change-Id: I1ef20e1e89dbec6d9b4807652b9fd8e009903aaf
2023-06-29 19:18:40 +00:00
Matthew Maurer
36accbd957 Merge "Bindgen 0.65.1 no longer supports size_t-is-usize" 2023-06-28 18:48:34 +00:00
Ludovic Barman
91907ce6b1 Update fsverity+odsign protos to protobuf3.
Test: manual atest
Bug: 286984317
Change-Id: I9bcc1ad858b9076c1a08e9df06e15a599c28f92c
2023-06-28 08:05:10 +00:00
Matthew Maurer
91a9763c5f Bindgen 0.65.1 no longer supports size_t-is-usize
The flag has been a default, and now is not accepted.

Test: Treehugger, m rust
Bug: 279198502
Bug: 276464273
Change-Id: I71ebcdbd3606c5dc55bf3454acfba9cc55ad85dd
2023-06-26 22:38:57 +00:00
Treehugger Robot
152dd52ee6 Merge "Added tests to attest keys with attestation id." 2023-06-26 17:46:13 +00:00
Rajesh Nyamagoud
a42dee61ce Added tests to attest keys with attestation id.
- Generate an RSA/EC attested keys with attestation of the device's
  identifiers. Test should succeed in generatating a attested key with
  attestation of device identifier. Test might fail on devices which
  doesn't support device id attestation with error response code
  `CANNOT_ATTEST_IDS or INVALID_TAG`.

- Try to generate an attested key with attestation of invalid device's
  identifiers. Test should fail with error response `CANNOT_ATTEST_IDS`

- Test to make sure `CANNOT_ATTEST_IDS` error code is returned while
  trying to generate a key on a device which doesn't support
  `FEATURE_DEVICE_ID_ATTESTATION`.

Bug: 194359114
Test: atest keystore2_client_test
Change-Id: Ib57c58d3ea89279eb69db342c3343b8d99ddc639
2023-06-20 19:07:27 +00:00
David Drysdale
7bb448fa2b Merge "keystore: log receipt of auth tokens" am: cdeb7302af
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2628119

Change-Id: I606835e31c4c2c23101188442bcf5cc543f75428
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-16 05:48:07 +00:00
David Drysdale
cdeb7302af Merge "keystore: log receipt of auth tokens" 2023-06-16 05:22:30 +00:00
Marcin Radomski
69bfd9e86a Merge "audit_log.rs: handle Results in LogContext handling" am: 402750dae1
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2625929

Change-Id: I2204328271c3f6aab4ec003a7dfe51fc6fd35532
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-15 15:05:01 +00:00
Marcin Radomski
402750dae1 Merge "audit_log.rs: handle Results in LogContext handling" 2023-06-15 14:29:35 +00:00
David Drysdale
bf2d72f6e4 keystore: log receipt of auth tokens
Various recent bugs would have been easier to investigate if the auth
tokens received by keystore were logged.

Test: adb logcat while lock/unlock
Bug: 285328437
Bug: 284802403
Change-Id: Ia955d344a2bb47820c0616cc1b9784f5fcbecb0a
2023-06-15 13:38:36 +01:00
Marcin Radomski
b948e92b70 audit_log.rs: handle Results in LogContext handling
The Rust liblog_event_list API used to silently ignore any errors
reported by liblog. aosp/2617613 attempts to make the operations
propagate the failure instead.

Note that this introduces a subtle behavior change: when *creating the
log record* fails, the API with Results does not allow submitting a
partially constructed log. Otherwise, the result of the write operation
is ignored as it was before.

Bug: 282691103
Test: m
Test: atest keystore2_test
Change-Id: I7c43100149b4ca831050af0a9229b95d2f7f8392
2023-06-14 13:44:04 +00:00
Pawan Wagh
086d548832 Merge "Adding AIDL Service fuzzer for identity service" am: 4468e1458a
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2619161

Change-Id: I76f38628f1bd95b7af162676f44569ec413b9cc1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-13 16:39:25 +00:00
Pawan Wagh
4468e1458a Merge "Adding AIDL Service fuzzer for identity service" 2023-06-13 15:30:53 +00:00
Pawan Wagh
c14ae0d81f Adding AIDL Service fuzzer for identity service
Test: m credstore_service_fuzzer && adb sync data && adb shell /data/fuzz/x86_64/credstore_service_fuzzer/credstore_service_fuzzer
Test: atest android.security.identity.cts
Bug: 232439428
Change-Id: I57494ad6a17e1a4a9dcb80d778edfd77a892790a
2023-06-12 20:31:57 +00:00
Treehugger Robot
ebc0be13aa Merge "Adding tests to verify EVP_PKEY_from_keystore2 API [Keystore2-engine]." am: 96947c9d89
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2518307

Change-Id: I59daff060d7c022506eec79caed59ed0286a5702
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-09 18:08:53 +00:00
Treehugger Robot
96947c9d89 Merge "Adding tests to verify EVP_PKEY_from_keystore2 API [Keystore2-engine]." 2023-06-09 17:23:00 +00:00
Treehugger Robot
91a058df4e Merge "Fix keystore2 crash counting" am: 1600dc1a47
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2610327

Change-Id: I91918051c28f343689beca06a45dd7cb4ac46aa3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-05 17:10:17 +00:00
Nathan Huckleberry
f72bab5cf6 Merge changes from topic "super-key-cleanups" am: efb59be97a
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2585605

Change-Id: I1364f6fdd3727d1a5b0f6e13a4539cf5cbb61f91
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-06-05 17:09:49 +00:00
Treehugger Robot
1600dc1a47 Merge "Fix keystore2 crash counting" 2023-06-05 16:43:23 +00:00
Nathan Huckleberry
efb59be97a Merge changes from topic "super-key-cleanups"
* changes:
  Add tests for super_key.rs
  Simplify control flow for user unlocking.
  Remove unlock_user_key function
  Separate logic for user reset, remove, and init
  Separate hybrid key logic into a helper function.
  Make super_encrypt_on_key_init inline
2023-06-05 16:24:38 +00:00
Eric Biggers
9f9ab18bc6 Fix keystore2 crash counting
https://r.android.com/1971319 changed the return type of
rustutils::system_properties::read() from Result<String> to
Result<Option<String>>.  But, read_keystore_crash_count() was not
correctly updated to handle the Ok(None) case.  Consequently, the case
of "property doesn't exist" started being considered an error, and the
code intended to handle this case stopped being executed.  Fix this by
correctly handling the return value.

Bug: 284163087
Test: Verified that the read_keystore_crash_count() error message is no
      longer present in logcat at boot time, and
      'getprop keystore.crash_count' shows 0.
Change-Id: I4b9ff16cba9e7500623dab7c3bc888cba0daf997
2023-06-01 02:30:28 +00:00
Treehugger Robot
dcdbd79d3f Merge "Enable self-testing by default in rkp factory tool" am: 63e3a2b0df
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2609433

Change-Id: Ib5b4c5eb23e29e3f3f3558a871fa7c64b5d4dcf1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-31 21:27:57 +00:00
Treehugger Robot
63e3a2b0df Merge "Enable self-testing by default in rkp factory tool" 2023-05-31 20:49:25 +00:00
Nathan Huckleberry
95dca01f5f Add tests for super_key.rs
The new tests are focused on unlocking, resetting and removing a user.
The tests verify that keys are deleted when necessary and that the user
state transitions properly.

Bug: 280502317
Test: atest keystore2_test on cuttlefish
Change-Id: Idae5d99fb289045bb277ba6c93ab62cfd9aed6fb
2023-05-31 19:51:26 +00:00
Nathan Huckleberry
7dfe818bb2 Simplify control flow for user unlocking.
Keystore2 super key handling is being refactored in preparation for
Unlocked-Only Storage.

Currently, super_key.rs exposes two functions to authorization.rs for
key unlocking:
- unlock_screen_lock_bound_key
- unlock_and_get_user_state

This change simplifies the key_unlocking logic to a single function,
unlock_user. This new function handles all of the unlocking logic and
functions more like a state machine than the previous code.

This change mainly improves readability. It tries not to change
functionality.

Bug: 280502317
Bug: 277798192
Test: Wiped device. Setup user with PIN. Ensured unlock works. Remove
    PIN. Ensured unlock works. Added pin and biometric. Ensured unlock
    works.  Rebooted device. Ensured unlock works.
Change-Id: Ib9a3e907cd40d34c5ecf2a869a65e403deda0254
2023-05-31 19:51:26 +00:00
Nathan Huckleberry
1afc660952 Remove unlock_user_key function
Keystore2 super key handling is being refactored in preparation for
Unlocked-Only Storage.

This function is dead code. It has no callers.

Bug: 280502317
Bug: 277798192
Test: Wiped device. Setup user with PIN. Ensured unlock works. Remove
    PIN. Ensured unlock works. Added pin and biometric. Ensured unlock
    works.  Rebooted device. Ensured unlock works.
Change-Id: I4c7791f6944afb621afb2d67f4b7b7d4690ddd78
2023-05-31 19:51:26 +00:00
Nathan Huckleberry
204a044209 Separate logic for user reset, remove, and init
Keystore2 super key handling is being refactored in preparation for
Unlocked-Only Storage.

This does not change the behavior of keystore2. It is a readability
change.

Currently, super_key.rs exposes one function for resetting, removing,
and initializing users:
- reset_or_init_user_and_get_user_state

This change breaks this function into smaller parts:
- reset_user
- init_user
- remove_user
- get_user_state

This simplifies the code in super_key.rs and allows it to act more like
a state machine.

Bug: 280502317
Bug: 277798192
Test: Wiped device. Setup user with PIN. Ensured unlock works. Remove
    PIN. Ensured unlock works. Added pin and biometric. Ensured unlock
    works.  Rebooted device. Ensured unlock works.
Change-Id: I4e27b41a76a8b45ca2bae6daabe51f2a985c2efe
2023-05-31 19:51:21 +00:00
Seth Moore
dff09d0b47 Enable self-testing by default in rkp factory tool
This way, we run the self test when extracting a CSR on the factory
line by default. This will ensure that devices producing bad payloads
will be more likely to be caught earlier in the manufacturing flow.

Test: ran tool devices with V2 and V3 HALs
Bug: 284098419
Change-Id: I79b50da7f86da50ebcfe18caf06046f1a39c6e81
2023-05-31 10:37:55 -07:00
Nathan Huckleberry
f9494d172b Separate hybrid key logic into a helper function.
Keystore2 super key handling is being refactored in preparation for
Unlocked-Only Storage.

This code is complicated and should be moved to its own function.

Bug: 280502317
Bug: 277798192
Test: Wiped device. Setup user with PIN. Ensured unlock works. Remove
    PIN. Ensured unlock works. Added pin and biometric. Ensured unlock
    works.  Rebooted device. Ensured unlock works.
Change-Id: I0602a8229cdd149d4f9b42a96f446d2a17df1321
2023-05-31 17:13:23 +00:00
Nathan Huckleberry
a405d0efb5 Make super_encrypt_on_key_init inline
Keystore2 super key handling is being refactored in preparation for
Unlocked-Only Storage.

There's no reason to separate this function.  It doesn't handle any
complicated logic and makes control flow more difficult to understand.

Bug: 280502317
Bug: 277798192
Test: Wiped device. Setup user with PIN. Ensured unlock works. Remove
    PIN. Ensured unlock works. Added pin and biometric. Ensured unlock
    works.  Rebooted device. Ensured unlock works.
Change-Id: Iafd31ae79a722910effaba98ac216d5b912dd348
2023-05-31 17:13:17 +00:00
Treehugger Robot
3ec25a1e75 Merge "Update for rusqlite 0.29.0." am: e6f1931a70
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2607091

Change-Id: Ie3d254eaadc9d090dc8566b2fa342b6de934ed3b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-30 19:20:11 +00:00
Treehugger Robot
e6f1931a70 Merge "Update for rusqlite 0.29.0." 2023-05-30 18:28:51 +00:00
Andrew Walbran
78abb1e0e2 Update for rusqlite 0.29.0.
Test: atest keystore2_test_utils_test keystore2_test
Change-Id: Ib613f9e11523f16060e4fb473b849203ff26ee2d
2023-05-30 16:20:56 +00:00
Devin Moore
6d4a365387 Merge "Remove libvintf from credstore" am: e6d927309e
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2602709

Change-Id: I6dd25cf30e0a00d96b9fd077b37161103e37f585
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-24 22:28:40 +00:00
Devin Moore
1aeae633cd Merge "credstore: move some libs from shared to static" am: 058ec2c24c
Original change: https://android-review.googlesource.com/c/platform/system/security/+/2601668

Change-Id: Iff8da4ba19d6b7e07749933a3e52a2fe5ca7dd60
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-05-24 22:28:26 +00:00