Commit graph

4486 commits

Author SHA1 Message Date
Paul Crowley
52f017ff19 Use P521 curve instead of P256
Certification may require the use of a larger elliptic curve.

Devices that took a dogfood/beta version of Android S without this
change will experience two problems:

* old P256 keys will be present unused in the database
* in the unlikely event that a screen-lock bound key was created
  while the device was locked before taking the update with this change
  and then not used until after, the key won't be decryptable.

Since these problems don't affect production users, I don't think
the significant complexity that would be needed to fix them is worth it.

Bug: 191759985
Test: keystore2_test
Test: atest android.keystore.cts.CipherTest#
    testEmptyPlaintextEncryptsAndDecryptsWhenUnlockedRequired
Merged-In: If1938bb8eddc148c7f8888006e7eb7c8e9a5a806
Change-Id: If1938bb8eddc148c7f8888006e7eb7c8e9a5a806
2021-07-01 11:21:19 -07:00
Janis Danisevskis
5f3a057010 Keystore 2.0: Remove Asp.
With binder::Strong being Sync now. Asp is obsolete.

Test: atest CtsKeystoreTestCases
Merged-In: I55a593f26bc6097122d2bab789aaaf90ee55cacc
Change-Id: I55a593f26bc6097122d2bab789aaaf90ee55cacc
2021-07-01 10:23:24 -07:00
Seth Moore
e44aad2e67 Add JSON output to the RKP factory tool
The JSON format is suitable for uploading as test data. It also
includes the build fingerprint, which is required by the backend
to associate the CSR with a particular device family.

Bug: 191301285
Test: Manually run the tool with various --output_format flags
Change-Id: I1d787271c52a25df2d16a6d88dd7b278407ff4b7
Merged-In: I1d787271c52a25df2d16a6d88dd7b278407ff4b7
2021-07-01 10:18:42 -07:00
Seth Moore
ac3b597515 [automerger skipped] Merge "Keystore 2.0 km_compat: Fix getKeyCharacteristics / SecLevel::SOFTWARE" am: e444d5cb83 am: da7de5c3cc -s ours
am skip reason: Merged-In Ia6cdeb427132946450929ccaf8a9d56f2da5cb43 with SHA-1 8c7eef9fb3 is already in history

Original change: https://android-review.googlesource.com/c/platform/system/security/+/1727583

Change-Id: I7853a3af872a666a98f25d2837cc56d284ee3e81
2021-07-01 15:52:18 +00:00
Hasini Gunasinghe
a3444f867b Log metrics related to Remote Key Provisioning (RKP).
This CL adds metrics related to attestation pool status and out of key
error, from keystore side.

Ignore-AOSP-First: No mergepath to AOSP.
Bug: 184301651
Test: Statsd test drive script.
Change-Id: I7025c897449e050dda42e2b290dea336c5ad0d52
2021-07-01 15:51:31 +00:00
Seth Moore
da7de5c3cc Merge "Keystore 2.0 km_compat: Fix getKeyCharacteristics / SecLevel::SOFTWARE" am: e444d5cb83
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1727583

Change-Id: I058105149979277d6d766769268afdc0ddf3ca26
2021-07-01 15:33:20 +00:00
Seth Moore
e444d5cb83 Merge "Keystore 2.0 km_compat: Fix getKeyCharacteristics / SecLevel::SOFTWARE" 2021-07-01 15:16:48 +00:00
Max Bires
fa1f7cf142 [automerger skipped] Merge "Only fetch an attestation key if challenge present" am: 0d2fef4bd9 am: d3781d62a8 -s ours
am skip reason: Merged-In Ibf9d31ca6519477c1aba6ab4a8dfe98b4f1f0d81 with SHA-1 31b42b486d is already in history

Original change: https://android-review.googlesource.com/c/platform/system/security/+/1747937

Change-Id: I2038a13dd76b808b3b97291f7fe1acb7beaa44d6
2021-07-01 14:06:59 +00:00
Max Bires
d3781d62a8 Merge "Only fetch an attestation key if challenge present" am: 0d2fef4bd9
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1747937

Change-Id: I4f39d6ab5fc07655420765b16d28262cde3a1a76
2021-07-01 13:48:54 +00:00
Max Bires
0d2fef4bd9 Merge "Only fetch an attestation key if challenge present" 2021-07-01 13:36:56 +00:00
TreeHugger Robot
ff280bcfc4 Merge "Use P521 curve instead of P256" into sc-dev am: 664ea465c2
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/security/+/15160990

Change-Id: Id989d33bd052ce619b9843ad297c10149d593955
2021-07-01 13:19:55 +00:00
Max Bires
34aa005553 Merge "Only fetch an attestation key if challenge present" into sc-dev am: 43a43af46a
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/security/+/15143707

Change-Id: Ic8a0432e4487fdb3e2237cd3b6f63d20b2cecba0
2021-07-01 13:18:35 +00:00
TreeHugger Robot
664ea465c2 Merge "Use P521 curve instead of P256" into sc-dev 2021-07-01 13:18:00 +00:00
Max Bires
43a43af46a Merge "Only fetch an attestation key if challenge present" into sc-dev 2021-07-01 13:07:55 +00:00
Treehugger Robot
717dfb48f3 [automerger skipped] Merge "Keystore 2.0: Fix misinterpretation of the versionNumber." am: 1a457096d0 am: 386aa7bdb2 -s ours
am skip reason: Merged-In I392d4ec3c00f22f11920abe44cc3375b7266508e with SHA-1 46ad055684 is already in history

Original change: https://android-review.googlesource.com/c/platform/system/security/+/1731923

Change-Id: I508619fa4aecc15f20a42913497fb02b3c7cd586
2021-07-01 02:13:00 +00:00
Treehugger Robot
2affb7addd [automerger skipped] Merge "Keystore 2.0: Extend the functionality of the Vpn profile store." am: 275e6cd326 am: 96c51ca3c5 -s ours
am skip reason: Merged-In Iaf81e7ccaee3c09a465dcec0fd5899b781c31db5 with SHA-1 7f65223b4e is already in history

Original change: https://android-review.googlesource.com/c/platform/system/security/+/1737993

Change-Id: I3cf4c041c6a34b9135f30e85c4fd175552356dcf
2021-07-01 02:12:38 +00:00
Treehugger Robot
386aa7bdb2 Merge "Keystore 2.0: Fix misinterpretation of the versionNumber." am: 1a457096d0
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1731923

Change-Id: Ia8c6e5a61bcada47bf6a1b70d8152cd653fecdbc
2021-07-01 01:57:40 +00:00
Treehugger Robot
96c51ca3c5 Merge "Keystore 2.0: Extend the functionality of the Vpn profile store." am: 275e6cd326
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1737993

Change-Id: I8c46f20b5d2398358ed0168abf6dc2d52c3c33ad
2021-07-01 01:47:36 +00:00
Treehugger Robot
1a457096d0 Merge "Keystore 2.0: Fix misinterpretation of the versionNumber." 2021-07-01 01:13:15 +00:00
Janis Danisevskis
f2477a81cf Keystore 2.0 km_compat: Fix getKeyCharacteristics / SecLevel::SOFTWARE
Fix getKeyCharacteristics when the security level is SOFTWARE.

Test: keystore2_km_compat_test
Test: com.android.tests.odsign.OnDeviceSigningHostTest
Bug: 189973657
Change-Id: Ia6cdeb427132946450929ccaf8a9d56f2da5cb43
Merged-In: Ia6cdeb427132946450929ccaf8a9d56f2da5cb43
2021-06-30 17:24:20 -07:00
Janis Danisevskis
bf855c0b6d Keystore 2.0: Fix misinterpretation of the versionNumber.
Keystore 2.0 assumed that the version number in the HWInfo struct
corresponds to the HAL version. This is actually not the case as per the
KeyMint spec. The legacy wrapper sets the version number as expected but
genuine Keymint implementations might not. This match ignores the
versionNumber filed of genuine KeyMint implementations and replaces it
with the HAL version.

Bug: 187862706
Test: N/A
Merged-In: I392d4ec3c00f22f11920abe44cc3375b7266508e
Change-Id: I392d4ec3c00f22f11920abe44cc3375b7266508e
2021-06-30 17:10:43 -07:00
Treehugger Robot
275e6cd326 Merge "Keystore 2.0: Extend the functionality of the Vpn profile store." 2021-06-30 23:51:11 +00:00
Treehugger Robot
307a2067bf [automerger skipped] Merge changes from topic "rkp-factory-tool" am: 7c4c55dbba am: 41d3e34898 -s ours
am skip reason: Merged-In I68e7d86259c67d40ecbb0c9e4ecac22954757dd3 with SHA-1 1aa82dadc0 is already in history

Original change: https://android-review.googlesource.com/c/platform/system/security/+/1748447

Change-Id: Icb44625c080c27e13b1b0aa1505e498120d35fb3
2021-06-30 21:12:10 +00:00
Seth Moore
11266171b6 [automerger skipped] Add prod GEEK to rkp_factory_extraction_tool am: 01688560f9 am: 4fce5e7d8b -s ours
am skip reason: Merged-In I62d6251610aab10b91661eda3ae801f1bb6ff5dc with SHA-1 f71501fa36 is already in history

Original change: https://android-review.googlesource.com/c/platform/system/security/+/1748446

Change-Id: Ie1d26a6c2974ed03efb95522d33cedbd511e0eac
2021-06-30 21:12:08 +00:00
Seth Moore
b7b0cf62b4 [automerger skipped] Remove duplicate generateEekChain routine am: 6dfb02a3f9 am: 6654f0255c -s ours
am skip reason: Merged-In I7e1695e3a512be01e24f681aa0a369d3482ad383 with SHA-1 dfce5dbb66 is already in history

Original change: https://android-review.googlesource.com/c/platform/system/security/+/1748445

Change-Id: Iea6051ae470c72defcc3dc7a6031db25b46d66fd
2021-06-30 21:12:07 +00:00
Treehugger Robot
41d3e34898 Merge changes from topic "rkp-factory-tool" am: 7c4c55dbba
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1748447

Change-Id: I43889b885684a64efc9b19bb6e2d31609e6643ae
2021-06-30 20:57:35 +00:00
Seth Moore
4fce5e7d8b Add prod GEEK to rkp_factory_extraction_tool am: 01688560f9
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1748446

Change-Id: I7baa1c4624591664d9cc5212ca5ced7ebf4d5777
2021-06-30 20:57:33 +00:00
Seth Moore
6654f0255c Remove duplicate generateEekChain routine am: 6dfb02a3f9
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1748445

Change-Id: Ice2673060fbe9646901d96fd28e931ec6e540baa
2021-06-30 20:57:28 +00:00
Treehugger Robot
7c4c55dbba Merge changes from topic "rkp-factory-tool"
* changes:
  Generate random challenge in RKP factory tool
  Add prod GEEK to rkp_factory_extraction_tool
  Remove duplicate generateEekChain routine
2021-06-30 20:39:53 +00:00
Janis Danisevskis
f2b797854f Merge "Keystore 2.0: Extend the functionality of the Vpn profile store." into sc-dev am: 0855263453
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/security/+/14968529

Change-Id: I2d53cde8f1d529965fb7cb962e617a0eeaac0047
2021-06-30 19:57:21 +00:00
Janis Danisevskis
0855263453 Merge "Keystore 2.0: Extend the functionality of the Vpn profile store." into sc-dev 2021-06-30 19:42:27 +00:00
Paul Crowley
31eebb3d0a Use P521 curve instead of P256
Certification may require the use of a larger elliptic curve.

Devices that took a dogfood/beta version of Android S without this
change will experience two problems:

* old P256 keys will be present unused in the database
* in the unlikely event that a screen-lock bound key was created
  while the device was locked before taking the update with this change
  and then not used until after, the key won't be decryptable.

Since these problems don't affect production users, I don't think
the significant complexity that would be needed to fix them is worth it.

Bug: 191759985
Test: keystore2_test
Test: atest android.keystore.cts.CipherTest#
    testEmptyPlaintextEncryptsAndDecryptsWhenUnlockedRequired
Ignore-AOSP-First: problem in sc-dev, no merge path from AOSP
Change-Id: If1938bb8eddc148c7f8888006e7eb7c8e9a5a806
2021-06-30 12:41:12 -07:00
Janis Danisevskis
3eb829da4d Keystore 2.0: Extend the functionality of the Vpn profile store.
It turns out there are more clients that use Keystore in a creative
way. This patch renames the VpnProfileStore to LegacyKeystore and
extends the functionality such that it allows access to all blobs with
alias prefixes that were not known to Keystore. It also brings back the
option to specify a uid argument. Specifically, for AID_SYSTEM to
manipulate the WIFI namespace.

Test: TBD
Bug: 191373871
Merged-In: Iaf81e7ccaee3c09a465dcec0fd5899b781c31db5
Change-Id: Iaf81e7ccaee3c09a465dcec0fd5899b781c31db5
2021-06-30 12:37:12 -07:00
TreeHugger Robot
472d8d77d4 Merge "Add JSON output to the RKP factory tool" into sc-dev am: 90a2b2780f
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/security/+/15113949

Change-Id: I05d7be1c035d661f16abc37913a78cadf7f5d73b
2021-06-30 19:29:28 +00:00
TreeHugger Robot
90a2b2780f Merge "Add JSON output to the RKP factory tool" into sc-dev 2021-06-30 19:14:12 +00:00
Hasini Gunasinghe
fc1a89bca1 Merge "Add keystore API for metrics re-routing." into sc-dev am: ff8321a2ef
Original change: https://googleplex-android-review.googlesource.com/c/platform/system/security/+/14937650

Change-Id: I44d057c9331ac32b0716ed80977c40a2794b995e
2021-06-30 13:32:33 +00:00
Hasini Gunasinghe
ff8321a2ef Merge "Add keystore API for metrics re-routing." into sc-dev 2021-06-30 13:07:21 +00:00
Janis Danisevskis
7f65223b4e Keystore 2.0: Extend the functionality of the Vpn profile store.
It turns out there are more clients that use Keystore in a creative
way. This patch renames the VpnProfileStore to LegacyKeystore and
extends the functionality such that it allows access to all blobs with
alias prefixes that were not known to Keystore. It also brings back the
option to specify a uid argument. Specifically, for AID_SYSTEM to
manipulate the WIFI namespace.

Ignore-AOSP-First: No mergepath from AOSP

Test: TBD
Bug: 191373871
Change-Id: Iaf81e7ccaee3c09a465dcec0fd5899b781c31db5
2021-06-29 13:20:19 -07:00
Hasini Gunasinghe
8dc9d42c83 Add keystore API for metrics re-routing.
Keystore2 atoms need to be routed to statsd via a proxy.
The proxy needs to call this API in order to pull metrics from
keystore.

Ignore-AOSP-First: No mergepath to AOSP.
Bug: 188590587
Test: Statsd Testdrive script
Change-Id: I28f8675fe5467b0760418c4d2d87808e45657be1
2021-06-29 18:05:22 +00:00
Martijn Coenen
c96ef53c0b [automerger skipped] On-device signing: reject everything that's not a regular file/dir. am: 15b7f67665 -s ours
am skip reason: Merged-In I1be9dfd7982d543a8979ac3a34551bd5449004f7 with SHA-1 0f760d7d54 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/system/security/+/15132999

Change-Id: I513ced0c45d3aad10470f00002b54f6734cc89a2
2021-06-29 16:18:23 +00:00
Max Bires
31b42b486d Only fetch an attestation key if challenge present
Currently, KS2 will always fetch and provide an attestation key for a
key being generated. This behavior is currently hidden by the fact that
for a factory provisioned KM, the behavior to just generate or generate
and attest to a key is the same from the KS2 perspective. KM figures out
if it should actually attest to the key by checking if an
ATTESTATION_CHALLENGE tag is present.

Alternatively, KS2 provides a user provided attestation key, which
should only be used if an attestation challenge is present. This would
also fail, probably expectedly, if the user provided their own
attestation key during key generation and didn't specify a challenge.
The issue arrises when RKP is enabled, as KS2 will always assign and
fetch an RKP key for a process that's generating a key, even if
attestation isn't requested. This causes key generation to fail for
non-attested keys.

This patch first checks to see if an ATTESTATION_CHALLENGE is present
before attempting to attest to the key.

Ignore-AOSP-First: CP from AOSP
Fixes: 191951059
Test: atest com.android.keychain.tests.BasicKeyChainServiceTest
Change-Id: Ibf9d31ca6519477c1aba6ab4a8dfe98b4f1f0d81
2021-06-29 08:31:22 -07:00
Max Bires
18b1db5ba7 Only fetch an attestation key if challenge present
Currently, KS2 will always fetch and provide an attestation key for a
key being generated. This behavior is currently hidden by the fact that
for a factory provisioned KM, the behavior to just generate or generate
and attest to a key is the same from the KS2 perspective. KM figures out
if it should actually attest to the key by checking if an
ATTESTATION_CHALLENGE tag is present.

Alternatively, KS2 provides a user provided attestation key, which
should only be used if an attestation challenge is present. This would
also fail, probably expectedly, if the user provided their own
attestation key during key generation and didn't specify a challenge.
The issue arrises when RKP is enabled, as KS2 will always assign and
fetch an RKP key for a process that's generating a key, even if
attestation isn't requested. This causes key generation to fail for
non-attested keys.

This patch first checks to see if an ATTESTATION_CHALLENGE is present
before attempting to attest to the key.

Fixes: 191951059
Test: atest com.android.keychain.tests.BasicKeyChainServiceTest
Change-Id: Ibf9d31ca6519477c1aba6ab4a8dfe98b4f1f0d81
Merged-In: Ibf9d31ca6519477c1aba6ab4a8dfe98b4f1f0d81
2021-06-29 15:29:47 +00:00
Martijn Coenen
d1ed14b0cb Merge "On-device signing: reject everything that's not a regular file/dir." am: 30257fa908 am: 36ef057910
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1751220

Change-Id: I0dc40347cf21bb920c4f635f8db4642f745ee89f
2021-06-29 15:03:57 +00:00
Martijn Coenen
36ef057910 Merge "On-device signing: reject everything that's not a regular file/dir." am: 30257fa908
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1751220

Change-Id: If41aba7810a4ff4deecd9161d013ed8b7a984bef
2021-06-29 14:52:48 +00:00
Martijn Coenen
15b7f67665 On-device signing: reject everything that's not a regular file/dir.
We shouldn't allow anything else in the artifacts output directory.

Bug: 192061595
Test: TEST_MAPPING
Change-Id: I1be9dfd7982d543a8979ac3a34551bd5449004f7
Merged-In: I1be9dfd7982d543a8979ac3a34551bd5449004f7
2021-06-29 16:38:31 +02:00
Martijn Coenen
30257fa908 Merge "On-device signing: reject everything that's not a regular file/dir." 2021-06-29 14:37:29 +00:00
Martijn Coenen
0f760d7d54 On-device signing: reject everything that's not a regular file/dir.
We shouldn't allow anything else in the artifacts output directory.

Bug: 192061595
Test: TEST_MAPPING
Change-Id: I1be9dfd7982d543a8979ac3a34551bd5449004f7
2021-06-29 14:51:46 +02:00
Martijn Coenen
f615afd2a1 Merge "On-device signing: Use correct deleteKey() instance." am: d2dede4e7b am: 61872e9245
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1748471

Change-Id: I3a6d09e988bc918ed695b02e159f535146051981
2021-06-29 12:47:01 +00:00
Martijn Coenen
61872e9245 Merge "On-device signing: Use correct deleteKey() instance." am: d2dede4e7b
Original change: https://android-review.googlesource.com/c/platform/system/security/+/1748471

Change-Id: I8b39c59d5720f1558614b546f165e1e6bc7174c9
2021-06-29 12:00:12 +00:00
Martijn Coenen
d2dede4e7b Merge "On-device signing: Use correct deleteKey() instance." 2021-06-29 11:29:24 +00:00