Commit graph

7698 commits

Author SHA1 Message Date
Seth Moore
29fd461ceb Include challenge in test_rkpd_attestation_key_upgrade
KeyMint.generateKey requires a challenge to be passed when a key
blob is also passed. The test missed this, and was thus failing on
compliant HALs.

Bug: 301223273
Test: keystore2_test
Change-Id: Icf7a32683c85d87fddd7d05ba07a110bb4e38c79
2023-09-26 10:45:43 -07:00
Devin Moore
a764eb9f45 Merge "keystore2 compat: stop crashing without hwservicemanager" into main 2023-09-06 17:33:15 +00:00
Tri Vo
0140d4b523 Merge "Updated to use shared library instead of static library." into main 2023-09-01 21:01:54 +00:00
Rajesh Nyamagoud
42276da855 Updated to use shared library instead of static library.
Removed `libkeymint_vts_test_utils` and its dependent libs from static
libs list and added only `libkeymint_vts_test_utils` in shared libs
list.

Test: m libkeystore2_test_utils; atest keystore2_client_tests; atest keystore2_test_utils_test;
atest keystore2_test
Bug: 194359114

Change-Id: Iab4b8c174af81a8c64a9f44fcd634d54f78773da
2023-09-01 16:50:01 +00:00
Tri Vo
8ace735b6e Merge "Remove IRPC error handling" into main 2023-08-31 22:18:06 +00:00
Devin Moore
bf520df50e keystore2 compat: stop crashing without hwservicemanager
New devices will no longer have hwservicemanager installed as part of
HIDL deprecation. So this service must not crash when it's not found.
From keystore2's perspective, this is the same as not having the HIDL
Keymaster HALs installed.

Test: remove hwservicemanager from
device/google/cuttlefish/shared/device.mk && launch_cvd
Bug: 298454031

Change-Id: I4c7cefd388936aff821cff572a8af1b6f69f82d1
2023-08-31 21:43:03 +00:00
Seth Moore
daff0e6c64 Merge "Static link libcrypto into rkp_factory_extraction_tool" into main 2023-08-31 19:00:54 +00:00
Tri Vo
dc8d6c06bb Remove IRPC error handling
Keystore no longer talks to IRPC directly. Remove corresponding error
handling code.

Test: m
Change-Id: I47ce41a0f48a30b994b18e794b1dd94fdbf9aa52
2023-08-30 17:00:12 -04:00
Eran Messeri
19e80fc8a0 Merge "Re-structured keystore test-utils module." into main 2023-08-30 15:11:43 +00:00
Rajesh Nyamagoud
10f02e705a Re-structured keystore test-utils module.
- Created separate build file.
- Moved ffi-utils from keystore2-client-tests to test-utils.
- Updated calling apis.

Test: atest keystore2_client_tests; atest keystore2_test_utils_test;
atest keystore2_test
Bug: 194359114

Change-Id: Ia2404218b7d13a9ae43b3fc4e481899576d24e63
2023-08-29 17:03:35 +00:00
David Drysdale
6f7a9b6bbc Merge "keystore2: add more logging" into main 2023-08-25 09:48:36 +00:00
David Drysdale
e85523f34a keystore2: add more logging
Also remove benign logging when there are multiple strong
biometrics.

Test: adb logcat on CF while adding/removing user/pwd
Change-Id: I777404d566990a4a604554133c0d87abba2200bc
2023-08-23 14:41:59 +01:00
Alan Stokes
07ef2a8b15 Merge "Better API for creating a DICE config descriptor" into main 2023-08-22 15:26:41 +00:00
Alan Stokes
82b1239acc Better API for creating a DICE config descriptor
Instead of listing all the possible parameters, put them in a struct
(as the C API does).

This means callers only have to list the ones they use, and a new
parameter doesn't require all clients to change.

Bug: 291241882
Test: atest -p in diced
Change-Id: I7c4925385e30ba9fcec0dc188747a23d7df614d7
2023-08-22 15:16:04 +01:00
Andrew Scull
81fcb6170d Merge "Migrate to new open-dice API for Android" into main 2023-08-21 16:16:14 +00:00
Hasini Gunasinghe
7d690da73b Merge "Adding an OWNERS file as requested in b/288143537" into main 2023-08-18 21:45:07 +00:00
Andrew Scull
0275aa5d1a Migrate to new open-dice API for Android
Symbols for Android in open-dice now use the DiceAndroid* prefix rather
than the Bcc* prefix. This does not migrate the whole library away from
the legacy BCC nomencalture.

Test: TH
Change-Id: I878de15f663ee2bcb678db12475cae6c45fc8b87
2023-08-18 18:42:10 +00:00
Tri Vo
dc4d64daff Merge "Generate certificates for importWrappedKey" into main 2023-08-18 18:37:47 +00:00
Tri Vo
3b0d703da8 Generate certificates for importWrappedKey
Bug: 291671113
Test: atest android.keystore.cts.ImportWrappedKeyTest
Change-Id: Ie195ac3931c4c79c738d583bfe272eb6a9314f8f
2023-08-17 13:57:01 -04:00
Treehugger Robot
e6dfdf59af Merge "keystore2_unsafe_fuzzer: Bug Fix" into main 2023-08-17 15:45:27 +00:00
Treehugger Robot
dd3664fa98 Merge "Changes for Rust 1.72" into main 2023-08-17 15:08:58 +00:00
Treehugger Robot
3be54faa4a Merge "Use String8/16 c_str" into main 2023-08-17 14:40:04 +00:00
James Farrell
2899721a5e Changes for Rust 1.72
Remove useless calls to vec!

Test: toolchain/android_rust/test_compiler.py
Bug: 295883071
Change-Id: Ie6cc07df6d27c522daf24f85d9fbaf673bdb413f
2023-08-17 04:37:05 +00:00
James Farrell
fdd6245e88 Merge "Changes for Rust 1.72" into main 2023-08-16 14:51:53 +00:00
James Farrell
d77b97f0b6 Changes for Rust 1.72
Replace fold with try_fold

Bug: 295883071
Change-Id: I2b0b102d673f051ec52f6ba8caa6bd73030100b0
2023-08-15 20:03:38 +00:00
Seth Moore
9b0fb4573a Static link libcrypto into rkp_factory_extraction_tool
We publish a prebuilt rkp_factory_extraction_tool online, so we should
only dynamically load the libraries that we cannot avoid (e.g. libdl)

Test: built and ran tool
Change-Id: Id109e12dde841797169f0a4e54fa2ede558da252
2023-08-11 13:34:39 -07:00
Tomasz Wasilczyk
102d33af23 Use String8/16 c_str
Bug: 295394788
Test: make checkbuild
Change-Id: I5f61f412c117e5121a7026dc3e364826577f2e55
2023-08-11 16:10:37 +00:00
Shaquille Johnson
39d70965bc Merge "[Keystore]Fix abort unsafe check in keystore fuzz" into main 2023-08-11 15:47:07 +00:00
Shaquille Johnson
718036a8ad [Keystore]Fix abort unsafe check in keystore fuzz
Fuzzer finds issue when checking return message after response code
fails.

```
m -j$(nproc) keystore2_unsafe_fuzzer
adb sync data
adb shell /data/fuzz/${TARGET_ARCH}/keystore2_unsafe_fuzzer/keystore2_unsafe_fuzzer
```

Test: description
Bug: 292231203
Change-Id: I27bdcb91fa05a75239aeeb34d817e4f04387b41f
2023-08-10 15:16:43 +01:00
Seth Moore
b39efe2469 Merge "Move rkp_factory_extraction_tool dist dir to "rkp"" into main 2023-08-03 19:44:51 +00:00
Seth Moore
ab493724db Move rkp_factory_extraction_tool dist dir to "rkp"
We will be publishing more tools for partners, and they should live
together. With that in mind, move the rkp_factory_extraction_tool dist
to "rkp/" instead of "rkp_factory_extraction_tool/".

Test: Built it
Change-Id: Ic86fe555a75dfe12a4cae1b4be48c33bae95ecbb
2023-08-02 13:00:53 -07:00
Treehugger Robot
b00c8ef0c5 Merge "Add safety comments." into main 2023-07-31 11:09:41 +00:00
Treehugger Robot
9c38948bc5 Merge "Add, standardise or temporarily opt out of safety comments for keystore2." into main 2023-07-28 10:20:42 +00:00
Andrew Walbran
a47698a88f Add, standardise or temporarily opt out of safety comments for keystore2.
These will soon be required by a lint.

Some functions were incorrectly marked as safe which were not actually
safe, so I've fixed those too.

Bug: 290018030
Test: m rust
Change-Id: I38df6a8162d430617f123ab1aace38b741458fce
2023-07-28 10:32:08 +01:00
Pierre-Clément Tosi
88e1231c3a Merge "diced: Limit availability of no_std libraries" into main 2023-07-28 09:08:28 +00:00
Tri Vo
f814e4a24f Merge "Verify key characteristics of generated/imported keys." into main 2023-07-27 18:45:16 +00:00
Pierre-Clément Tosi
da662b0bf0 diced: Limit availability of no_std libraries
Rework the defaults to avoid enabling vendor_available, apex_available,
or host_supported in the "_nostd" libraries, where they shouldn't be
used as the static libraries built from these modules aren't distributed
through APEXes or vendor code and are not expected to be compatible with
the host.

Bug: 293260907
Test: mmma external/open-dice
Change-Id: Ia922ed6b8d525c89724a5dc70bbd0d9621f1ba92
2023-07-27 17:17:36 +01:00
Rajesh Nyamagoud
d0213ef0e6 Verify key characteristics of generated/imported keys.
Changes made in keystore2-client-tests to verify the key characteristics
of generated and imported keys.

Bug: 279721870
Test: atest keystore2_client_tests
Change-Id: I30c1fb2bdb1d69d321d356453d895db73347acde
2023-07-27 15:51:41 +00:00
Eric Biggers
20b7b90f40 Merge "Revert "Remove fsverity_init"" into main 2023-07-26 18:06:52 +00:00
Yunkai Lim
0d850139b6 Revert "Remove fsverity_init"
Revert submission 2662658-fsverity-init-cleanup

Reason for revert: Culprit for test breakage b/293232766

Reverted changes: /q/submissionid:2662658-fsverity-init-cleanup

Change-Id: Ib29f082e5a48cacc726a5228029ec3a1b6561cb1
2023-07-26 06:21:30 +00:00
Tri Vo
dbeb6aaa7d Merge "keystore: Fix ID rotation window" into main 2023-07-25 23:55:46 +00:00
Eric Biggers
50805a8b25 Merge "Remove fsverity_init" into main 2023-07-25 22:49:09 +00:00
Tri Vo
74997ed800 keystore: Fix ID rotation window
KeyMint spec requires unique ID rotation to happen every 30 days (or
more precisely 2592000000 milliseconds) starting at UNIX epoch time.

Keystore is also supposed to set the RESET_SINCE_ID_ROTATION to indicate
"whether the device has been factory reset since the last unique ID
rotation".

However, instead Keystore sets RESET_SINCE_ID_ROTATION if there has been
a factory reset in the last 30 days counting back from now, which is
different and will give one extra UNIQUE_ID value in a subsequent
period:

For example, if there's a factory reset (marked as :) in the 3rd period
(periods delimited by |), the first half of the 4th period will have
RESET_SINCE_ID_ROTATION set and get a different UNIQUE_ID value than it
should:

Want = |   A    |   B    | C : C2 |   D    | ...
Get  = |   A    |   B    | C : C2 | D2 : D | ...

Bug: 289774200
Test: keystore2_test
Change-Id: I156de902931915cd1ae7ad2eba63fd0276f15ae0
2023-07-25 16:40:31 -04:00
Andrew Walbran
6e9f564dd6 Merge "Fix soundness issue in keystore2." into main 2023-07-25 16:05:11 +00:00
Andrew Walbran
7036c2b48c Fix soundness issue in keystore2.
Sync was incorrectly implemented for AuthRequest, allowing simultaneous
access to a Receiver from multiple threads despite it not being
threadsafe. Use a Mutex instead to do this safely.

Bug: 290018030
Test: m rust
Change-Id: I6f43f13d5f36bdbafc9bd910a1ebadbb1366009d
2023-07-25 17:04:45 +01:00
Andrew Walbran
937084f590 Merge "Add safety comments to prng_seeder." into main 2023-07-24 10:41:53 +00:00
Andrew Walbran
c768733f76 Add safety comments to prng_seeder.
These will soon be required by a lint.

Bug: 290018030
Test: m rust
Change-Id: I93db8ce5285714c182a6dcdf9464e5ff4656dc36
2023-07-24 11:41:27 +01:00
Tri Vo
fa6e5a734c Merge "Update system/security owners" into main 2023-07-19 15:17:54 +00:00
Eric Biggers
997fd3392a Remove fsverity_init
Now that fsverity_init is no longer used, it can be removed.
For more details, see https://r.android.com/2662658.

Bug: 290064770
Test: presubmit
Change-Id: I9a90a7141d708ea8aaeefc54288083ee5a0f52ff
2023-07-19 01:13:40 +00:00
Tri Vo
14faaa4665 Merge "Keystore: Use waitForService() instead of getService()" into main 2023-07-18 19:56:09 +00:00