Commit graph

682 commits

Author SHA1 Message Date
Automerger Merge Worker
dfa3fcb3ae Merge "Stop reading fs-verity certificate from keystore" am: 21b6c38fa0 am: d26b301d8b
Change-Id: I119a34e7c9365862ee37687222e8ecfbe20df719
2020-03-09 20:31:55 +00:00
Automerger Merge Worker
00142e2ee2 Merge "Revert "Make keystore a core service"" am: 4b6865baa0 am: 181826633e
Change-Id: Ie3c1209012b787c7364843c8b00b13de5b61746a
2020-03-09 20:31:42 +00:00
Victor Hsieh
2bcd5376ec Stop reading fs-verity certificate from keystore
We punting support for extra certificate to S.

Test: boot
Bug: 112038744
Change-Id: I3bc342a7df0c47c02494ef6fdae24e7ad00a8507
2020-02-26 12:39:15 -08:00
Victor Hsieh
19f1caefba Revert "Make keystore a core service"
This reverts commit 7fd8e853e9.

Test: still see keystore process running
Bug: 112038744
Bug: 150267620
Change-Id: I4fe3c6aeecf960377671d11be0a4dc9fa60dfb18
2020-02-26 12:37:41 -08:00
Automerger Merge Worker
9851ffaa2e Merge "Revert "Making software km implementation both backup and default"" am: 24dce34ad5 am: 4f0fd48c01 am: a970ec3877
Change-Id: I030c7905cd6aac5a24429b1c719ce8b8507a8a8c
2020-02-20 14:46:08 +00:00
Wale Ogunwale
24dce34ad5 Merge "Revert "Making software km implementation both backup and default"" 2020-02-20 14:05:52 +00:00
Wale Ogunwale
ba61bbbc0b Revert "Making software km implementation both backup and default"
This reverts commit cfc8b73b67.

Reason for revert: Causing pre-submit failure with window manager
Bug: 148773266
Bug: 149892576

Change-Id: I1acd288aa1a1cb004d1118b7db775511a2cda344
2020-02-20 12:35:36 +00:00
Automerger Merge Worker
8210743f12 Merge "Making software km implementation both backup and default" am: 67be8d72bf am: 803b6971a7 am: 81ff06ea77
Change-Id: I702b1742f8a970b8f1a779b87534e150315f3e89
2020-02-19 19:49:55 +00:00
Treehugger Robot
67be8d72bf Merge "Making software km implementation both backup and default" 2020-02-19 18:20:06 +00:00
Max Bires
cfc8b73b67 Making software km implementation both backup and default
If there were no secure keymasters on a device, but software keymasters
offered, then keystore would shuffle the software keymaster to the
TRUSTED_ENVIRONMENT securityLevel keymaster slot and generate a software
fallback keymaster. This change lets the software keymaster slot occupy
both the default and software slot. A fallback keymaster implementation
should only be invoked if there actually is no other keymaster
implementation.

Bug: 148773266
Test: atest KeyChainTests:com.android.keychain.tests.BasicKeyChainServiceTest#testAttestKeySucceedsOnGeneratedKey -- --abi x86
Change-Id: Ia845b6d8be85dcd6dfd3aecbb1dbda972e9cfff2
2020-02-16 15:24:34 -08:00
Shawn Willden
a97aea4040 Update keystore to use KM4.1.
This is the first part of the update, adjusting keystore to use the
KM4.1 interface, but not call any of the new methods.  That will come
in a subsequent CL.

Test: CtsKeystoreTestCases
Change-Id: Ib7486aad46c144471a1607eec31b8df1059a511d
Merged-In: Ib7486aad46c144471a1607eec31b8df1059a511d
2020-02-11 15:51:04 -07:00
Automerger Merge Worker
d9925d5294 Merge "Factor keystore_attestation_id into library and also use this in credstore." am: fc1fc88195 am: 4097e10a1c am: d3d3ad3313
Change-Id: I497c9c97663bdd159f2b29fe0818818d27342456
2020-02-04 22:22:38 +00:00
Treehugger Robot
fc1fc88195 Merge "Factor keystore_attestation_id into library and also use this in credstore." 2020-02-04 21:31:31 +00:00
David Zeuthen
f2a28671b0 Factor keystore_attestation_id into library and also use this in credstore.
This was needed because credstore needs to generate and pass the
generated AttestationApplicationId to the Identity Credential HAL.

Bug: 111446262
Test: atest android.security.identity.cts
Test: VtsHalIdentityCredentialTargetTest
Test: android.hardware.identity-support-lib-test
Change-Id: Id22b85ca083e23c7e1fbd3459910fba37a5db137
2020-01-31 16:23:30 -05:00
Automerger Merge Worker
22ef94433b Merge "Fixed bug in APC rate limiting fix." am: a3c549fe9c am: b3f237c8a8 am: 705058ac06
Change-Id: I3cea2fce6e2f15b6a2ad3c428f667f68fcefd325
2020-01-31 00:24:55 +00:00
Janis Danisevskis
16ae65c2ab Fixed bug in APC rate limiting fix.
Cancelling an APC request from the app side must lead to a callback to
unblock the caller.

Bug: 138655142
Bug: 148411844
Test: atest confirmationui_invocation_test
Change-Id: If71ffc7d3d75dde6f0217ccdb003569149947ec8
2020-01-30 13:39:36 -08:00
Treehugger Robot
2d5b18b9b7 Merge "Confirmationui Rate Limiting App Abort Bug Fix" 2020-01-24 17:37:58 +00:00
Cindy Zhou
b3bf30bb1f Confirmationui Rate Limiting App Abort Bug Fix
Increment the rate limiting counter when the application sends an abort
message.

Bug: 138655142
Test: Ran keystore_unit_tests and manually checked behavior of
keystore application with confimrationui.
Merged-In: I5f3af166391a32748a26f7709d30a5ac718499c0
Change-Id: I5f3af166391a32748a26f7709d30a5ac718499c0
2020-01-24 08:47:36 -08:00
TreeHugger Robot
500bba2c3b Merge "Confirmationui Rate Limiting App Abort Bug Fix" 2020-01-24 16:40:40 +00:00
Automerger Merge Worker
7db4b1203b Merge "Revert "Fixing security vuln by tightening race condition window."" am: fbe01199cb am: 7664a53479 am: fc325ddb46
Change-Id: I03857fe48f7ac3a9b52f7dfcd7bd330d7406f094
2020-01-23 19:33:58 +00:00
Treehugger Robot
fbe01199cb Merge "Revert "Fixing security vuln by tightening race condition window."" 2020-01-23 19:00:24 +00:00
Cindy Zhou
efe6ad0b83 Confirmationui Rate Limiting App Abort Bug Fix
Increment the rate limiting counter when the application sends an abort
message.

Bug: 138655142
Test: Ran keystore_unit_tests and manually checked behavior of
keystore application with confimrationui.

Change-Id: I5f3af166391a32748a26f7709d30a5ac718499c0
2020-01-23 10:41:59 -08:00
Janis Danisevskis
21f452c372 Add permission check on onKeyguardVisibilityChanged
Without this permission check any app can toggle the locked state of
keymaster once it has been unlocked for the first time.

Bug: 144285084
Test: Manually tested with debugger that the requred code paths are
      run.

Change-Id: Idb8a200dc2963e1085e9fddd0c565c5172465e65
2020-01-21 14:49:25 -08:00
Shawn Willden
611f090cd1 Update keystore to use KM4.1.
This is the first part of the update, adjusting keystore to use the
KM4.1 interface, but not call any of the new methods.  That will come
in a subsequent CL.

Test: CtsKeystoreTestCases
Change-Id: Ib7486aad46c144471a1607eec31b8df1059a511d
2020-01-21 02:25:01 -07:00
David Zeuthen
ab3e565511 Add credstore system daemon.
The credstore system daemon is sitting below the Identity Credential
Framework APIs and on top of the Identity Credential HALs. Its main
job is to store credential data and provide a way for applications to
communicate with the secure hardware abstracted by the HAL.

This daemon runs as an unprivileged user, credstore.

The auth-tokens needed by credstore are supplied by keystore and this
CL includes the requisite changes to keystore for this to work.

Bug: 111446262
Test: CTS tests for Framework APIs
Change-Id: Ieb4d59852a143482436a1c418c25ed96e25c0047
2020-01-16 13:05:48 -05:00
Janis Danisevskis
c2f1f722a6 Keymaster worker threads stick around for 30s
This patch makes keymaster worker threads linger for 30s in anticipation
of more incomming requests.

Change-Id: I76069c74d7f013482a777dfcf279d55aeb8e1c00
2019-12-19 14:23:35 -08:00
Peter Collingbourne
eeacea504f Link libvndksupport dynamically instead of statically.
Bug: 146456667
Change-Id: Ie63ecd1d24aee31f92e10d00b7d593764c8f1897
2019-12-17 20:19:47 -08:00
Roshan Pius
58c34c21c2 Merge "Revert "keystore: Allow network_stack uid to use AID_WIFI""
am: be24e3f390

Change-Id: Iceeecd170c1b5069f6052b21a7591687c54cd18b
2019-11-26 13:41:41 -08:00
Treehugger Robot
be24e3f390 Merge "Revert "keystore: Allow network_stack uid to use AID_WIFI"" 2019-11-26 21:37:49 +00:00
Roshan Pius
2bc07e0505 Revert "keystore: Allow network_stack uid to use AID_WIFI"
This reverts commit 286c4b0532.

Reason for revert: Wifi services no longer plan to be a separate
APK/process for mainline. Will instead become a jar loaded from Apex.

Bug: 144722612
Change-Id: Ie6c8265f36cd358a87e88e293158df01d262d8cc
Test: Device boots up & connects to wifi networks
2019-11-25 22:46:35 +00:00
Xin Li
9222cc684e Merge QQ1A.191205.011 into stage-aosp-master
Bug: 144955631
Merged-In: Ie6ce8f381affe89137c911b3964412a1c16fdb80
Change-Id: I53cad5f2e532ef4e7745df6e7cd55d17504ba62b
2019-11-22 14:05:35 -08:00
Max Bires
36ae17f8dc Revert "Fixing security vuln by tightening race condition window."
This reverts commit ef4f067c03.

Reason for revert: The underlying system support required to properly fix this bug has been implemented. This patch-over is no longer necessary. Patches listed in b/25646100
Test: atest keystore_unit_tests
Change-Id: I8e3e78f1440a81e60ab4986c5bb07df205a60062
2019-11-21 00:52:57 +00:00
Treehugger Robot
44f4d85dcf Merge "Don't clear kesytore after 5 auth failures." 2019-11-20 20:55:39 +00:00
Treehugger Robot
5a053ab455 Merge "Removing unused function reset()" 2019-11-20 01:40:28 +00:00
Rob Barnes
3af223fde0 Allow for input_data on finish.
Test: Keystore CTS tests

Change-Id: I22e69079e3ad5462ded2c7b71274c29ba5ef58d0
2019-11-14 16:43:12 -07:00
Shawn Willden
688d3ab299 Don't clear kesytore after 5 auth failures.
Keystore's security originally derived from encrypting keys with a key
derived from the user's password.  To avoid making keystore into a
password brute force oracle, keystore cleared itself after five
incorrect presentations.  All of this has been superseded by moving
keystore's security into Keymaster, and by moving password security
into Gatekeeper/Weaver, and further by implmenting the synthetic
password model.

This CL removes the now-useless and occasionally-dangerous keystore
self-destruct.

Test: Manual
Change-Id: Id85c1c39769701bbc0dcfcb76511faf9eeb65496
2019-11-13 06:30:13 -07:00
Max Bires
989662056c Removing unused function reset()
reset is being deprecated. There is no real use case for it anymore. It
was exposed in binder, but that has been fixed. This commit removes any
portions of reset that were associated with handling the binder call.

Bug: 143309987
Test: android builds
Change-Id: Ie9dd53b66244dd47e31a37763152a0db14eca5ed
2019-11-11 17:10:12 -08:00
Artur Satayev
abbb2bf51a Add @UnsupportedAppUsage annotations for greylist.
go/cleanup-greylist-txt

These have already been greylisted, however due to bugs/omissions in the tooling have been kept in go/greylist-txt instead of being annotated in the code.

Bug: 137350495
Test: m
Change-Id: If694cc885291c0c0cf14d8b880fc7ac4948dbe1b
2019-11-05 16:07:21 +00:00
Roshan Pius
2c62e2b83e Merge "keystore: Move wifi keystore HAL service out" 2019-10-29 23:09:12 +00:00
Roshan Pius
2650acc912 keystore: Move wifi keystore HAL service out
Also, removed the mutex added to protect keystore service internals
from synchronous HIDL calls.

Bug: 142969896
Test: Verified connecting to passpoint networks.
Change-Id: Iffb7dc6bbde6d205519ffdafeb0bd53fbc5611b1
Merged-In: Iffb7dc6bbde6d205519ffdafeb0bd53fbc5611b1
2019-10-28 14:03:16 -07:00
Shawn Willden
c9349a5bf0 Encrypt AES-256 keystore master keys.
ag/5984229 that added support for AES-256 master keys inadvertently
caused them not to be encyrpted by the user's password.  This is less
damaging to security than it might appear because these keys are also
encrypted by Keymaster, in the TEE or StrongBox.

Bug: 141955555
Test:  Manually verify password is encryption on a userdebug build.
Change-Id: Ic5e82546df67346e4c348273cf4fe2bac382c9dc
(cherry picked from commit b951bc5317)
2019-10-11 02:35:41 +00:00
Roshan Pius
286c4b0532 keystore: Allow network_stack uid to use AID_WIFI
The wifi stack will be running inside the network_stack process for
devices which will accept wifi mainline module in R. So, add a effective
uid entry to allow calls from wifi stack inside network_stack to use
keystore blobs stored by wifi uid.

Bug: 142298627
Test: Compiles, will verify failing tests.
Change-Id: Iff19bcad134a3531934215ea4b7d975433da787d
2019-10-08 19:45:43 -07:00
Janis Danisevskis
8c4c1d6efb Fix memory leak in keystore
The operation device map needs to be cleand up on finish regardless of
whether the operations succeeds of fails. The operation lifecycle ends
in any case.

Bug: 141317862
Test: Generate key and perform repeated operations.
      Watch memory consumptoin not raise with using:
      adb shell dumpsys meminfo keystore

Change-Id: I3a25aa67f121832640848a38398c523e20a2c6df
2019-10-04 11:01:54 -07:00
Treehugger Robot
946f1d11c0 Merge "Fix handling of user password changes." 2019-10-03 17:56:12 +00:00
Treehugger Robot
e7dc464319 Merge "New APIs for a keystore client to list and get keys" 2019-10-02 16:17:47 +00:00
Shawn Willden
17b8709c67 Fix handling of user password changes.
A bug introduced in a patch intended to upgrade keystore master keys
to use AES-256 and SHA-256 instead of AES-128 and SHA1 causes the
newly-updated master key to fail to be retrievable ever again.  Making
this worse, after five successive failures, keystore decided that all
the data is bad and wipes the user's keystore.  This problem happens
on every password change if the master key is 128 bits.  Luckily,
since the introduction of synthetic passwords to support escrow
tokens, the password presented to keystore is the synthetic password,
which never changes.  So this problem only crops up in devices that
did not have synthetic passwords (launched with Android N or earlier),
were not upgraded to O DR1 (when synthetic passwords were enabled by
default), were never factory reset or had their password removed and
re-added during all of that time and were then upgraded to P or Q,
when the master key upgrade code was present.

This CL fixes the upgrade process so that updated master keys can be
used.  It doesn't change the key size, the keys stay 128 bits, but now
they're readable and usable.  Factory resetting allows an entirely
new master key to be generated, which will be AES-256.

Note that the keystore master key is not really essential to the
security of Keystore keys.  They're also encrypted by the secure
world (TEE or SE), which is their primary protection.  The master key
just provides a cryptographic dependency on the user's password, so
that in the event of a secure world break the attacker still has to
brute force the user's password to recover the key material, or use of
the protected keys.

Bug: 129970023
Test: Manual
Change-Id: I8ce2bb2359cf822039c137bb6bb1fc225da47c29
2019-10-01 17:43:43 -06:00
Colin Cross
c20dc9444e Merge "Use libcrypto_static instead of libcrypto" 2019-09-26 14:32:33 +00:00
Victor Hsieh
8b3b6fc1f7 New APIs for a keystore client to list and get keys
Test: client is able to list and get keys given sepolicy
Bug: 112038744
Change-Id: Ib7e2e9cc7cff6bdf4e4aba2499b9bf16a6db1d4f
2019-09-25 09:32:55 -07:00
Wenhao Wang
b48208f2c9 Merge "Fix memory leak in keystore" 2019-09-19 22:27:40 +00:00
Colin Cross
aebf66398a Use libcrypto_static instead of libcrypto
Replace libcrypto with libcrypto_static, which can be protected through
visibility to ensure only modules that don't affect FIPS certification
can use it.

Bug: 141248879
Test: m checkbuild
Change-Id: I4e0e287fab5d8968359dd98ad84b0a0713d93b41
2019-09-18 11:12:36 -07:00