Commit Graph

419 Commits

Author SHA1 Message Date
Janis Danisevskis
14a82f7983 Merge "Keystore 2.0 SPI: Add CERTIFICATE_* tags." 2021-02-08 16:52:16 +00:00
Qi Wu
cca3d81204 Add limited use keys related API into Keystore 2.0 SPI.
Bug: b/174140443
Test: atest CtsKeystoreTestCases

The new CTS tests for this feature is introduced in aosp/1556464

Change-Id: I9620c4a3e5d2c10ed8a50d494e63eb2fb19dabef
Merged-In: I9620c4a3e5d2c10ed8a50d494e63eb2fb19dabef
2021-02-03 07:17:04 +00:00
Janis Danisevskis
f5c1e0433d Keystore 2.0 SPI: Add CERTIFICATE_* tags.
Certificate subject, serial, not before and not after information is now
passed to keystore/keymint for certificate generation.
Also makeDate accepts negative time values for dates predating Jan 1970
because the CTS tests likes to generate historic certificates.

Test: Keystore CTS tests.
Change-Id: I7ce664b010222298bda8049aad48f7db155a836d
2021-01-31 20:40:20 -08:00
Bram Bonné
b3c666454e ECDH SPI interface
Test: atest KeyAgreementTest
Bug: 171847641
Change-Id: I7cb0c713e3797bb738a6134c690824e762346d4f
2021-01-27 10:54:47 +01:00
Janis Danisevskis
81d75b4c52 Keystore 2.0: Android Protected Confirmation
Bug: 160930927
Test: CtsVerifier
Change-Id: I9cc325eafbee2aa4257a3ccbe525091a1cae806d
2020-12-16 10:47:56 -08:00
Janis Danisevskis
fb68656a99 Add owners for Protected Confirmation implementation.
Test: N/A
Change-Id: Ib10884acd284a243d2898fc5a1eeedca5e8c4551
2020-12-16 09:57:11 -08:00
Shawn Willden
f5a002c222 Revert "Revert "Keystore 2.0 SPI: Move keymint spec to security ..."
Revert "Revert "Keystore 2.0: Move keymint spec to security name..."

Revert "Revert "Keystore 2.0: Move keymint spec to security name..."

Revert^2 "Remove references to keymint1"

34536a352803a08776cc4f373d93a94e1fcbf98e

Bug: 175345910
Bug: 171429297
Change-Id: I694e677e4e20419440f12cb7981f0c0c4ca29e08
2020-12-11 20:36:10 +00:00
Orion Hodson
6acd9c63e7 Revert "Keystore 2.0 SPI: Move keymint spec to security namespace."
Revert "Keystore 2.0: Move keymint spec to security namespace."

Revert "Keystore 2.0: Move keymint spec to security namespace."

Revert "Move keymint to android.hardware.security."

Revert "Configure CF to start KeyMint service by default."

Revert "Move keymint to android.hardware.security."

Revert "Move keymint to android.hardware.security."

Revert submission 1522123-move_keymint

Reason for revert: Build breakage
Bug: 175345910
Bug: 171429297
Reverted Changes:
Ief0e9884a:Keystore 2.0: Move keymint spec to security namesp...
Idb54e8846:Keystore 2.0: Move keymint spec to security namesp...
I9f70db0e4:Remove references to keymint1
I2b4ce3349:Keystore 2.0 SPI: Move keymint spec to security na...
I2498073aa:Move keymint to android.hardware.security.
I098711e7d:Move keymint to android.hardware.security.
I3ec8d70fe:Configure CF to start KeyMint service by default.
Icbb373c50:Move keymint to android.hardware.security.
I86bccf40e:Move keymint to android.hardware.security.

Change-Id: Icd279f358db2387bf2bf232b0548762fab51e67d
2020-12-11 10:45:43 +00:00
Janis Danisevskis
8954dfa092 Keystore 2.0 SPI: Move keymint spec to security namespace.
Test: N/A
Change-Id: I2b4ce3349baf29eb67a31f0c436b964d69d70b02
2020-12-09 13:53:32 -08:00
Jeff Sharkey
fab0ab3c9c Improve OWNERS coverage across frameworks/base/.
As general background, OWNERS files expedite code reviews by helping
code authors quickly find relevant reviewers, and they also ensure
that stakeholders are involved in code changes in their areas.

Some teams under frameworks/base/ have been using OWNERS files
successfully for many years, and we're ready to expand them to cover
more areas.  Here's the historical coverage statistics for the last
two years of changes before these new OWNERS changes land:

-- 56% of changes are fully covered by OWNERS
-- 17% of changes are partially covered by OWNERS
-- 25% of changes have no OWNERS coverage

Working closely with team leads, we've now identified clear OWNERS on
a per-package basis, and we're using "include" directives whenever
possible to to simplify future maintenance.  With this extensive
effort, we've now improved our coverage as follows:

-- 98% of changes are fully covered by OWNERS
-- 1% of changes are partially covered by OWNERS
-- 1% of changes have no OWNERS coverage

This specific change is automatically generated by a script from
detailed ownership information confirmed by team leads.

Bug: 174932174
Test: manual
Exempt-From-Owner-Approval: refactoring with team leads buy-in
Merged-In: I9789c97c1de8e5d962b48c29c57d82fe83729eba
Change-Id: I9789c97c1de8e5d962b48c29c57d82fe83729eba
2020-12-08 08:36:27 -07:00
Janis Danisevskis
96a0716a8a Revert "Revert "Keystore SPI: Initialize KeymasterDefs contants with AIDL generated enums""
This reverts commit efec091bcb.

Reason for revert: aosp/1513473 fixed the underlying issue That make this revert necessary.

Change-Id: Ic99a6d080b4b1140924cb89d44b1f650f283a28d
2020-11-30 16:30:02 +00:00
Louis Chang
efec091bcb Revert "Keystore SPI: Initialize KeymasterDefs contants with AIDL generated enums"
This reverts commit 2a66fc6144.

Reason for revert: b/174445211

Change-Id: I286327d8db19d50d3dd9602a2d0bd368d331c0c4
2020-11-30 07:36:55 +00:00
Janis Danisevskis
2a66fc6144 Keystore SPI: Initialize KeymasterDefs contants with AIDL generated enums
Test: None
Change-Id: Ic6b776a3bc0b7eea7a84ef9ec54258eb0a160864
2020-11-23 22:02:45 -08:00
Bram Bonné
b60861b281 Adds two missing Keymaster definitions.
Adds KM_TAG_BOOT_PATCHLEVEL and KM_TAG_VENDOR_PATCHLEVEL.

Bug: 173681969
Test: atest KeyAttestationTest
Change-Id: I4e94376241b37fd57c183e7865ae99a4770658c9
2020-11-19 10:15:02 +01:00
Mathew Inwood
f8abe13db4 Merge "Add maxTargetSdk restriction to unused APIs." 2020-11-09 14:41:20 +00:00
Janis Danisevskis
d2c944bc4d Keystore SPI: Add SecurityLevelEnum to KeyProperties
This patch adds the SecurityLevelEnum to KeyProperties. This enum can be
used by the public API surface to express levels of enforcements of key
properties. And to select a designated residence for a newly generated
or imported key.

The values UNKNOWN and UNKNOWN_SECURE are used to convey to older target
APIs API levels that have not been defined when they where published.

Test: None
Change-Id: I88681f21b8a8ea9a383d32ba99f3ab7d7c8909c3
2020-11-05 13:11:12 -08:00
Mathew Inwood
5d123b6775 Add maxTargetSdk restriction to unused APIs.
These are APIs that have @UnsupportedAppUsage but for which we don't
have any evidence of them currently being used, so should be safe to
remove from the unsupported list.

Bug: 170729553
Test: Treehugger
Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a
Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
2020-11-04 09:45:53 +00:00
Janis Danisevskis
8232c585ec Add KM_ERROR_HARDWARE_TYPE_UNAVAILABLE to KeymasterDefs
This flag was missing from KeymasterDefs.

Test: None
Change-Id: I7c17ab513df695f510ec1ba41b7c1b059902b040
2020-10-27 12:09:38 -07:00
Xin Li
628590d7ec Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I3d92a6de21a938f6b352ec26dc23420c0fe02b27
Change-Id: Ifdb80563ef042738778ebb8a7581a97c4e3d96e2
2020-08-31 21:21:38 -07:00
Joel Galenson
4143080a6d Update comment to use inclusive language
See https://source.android.com/setup/contribute/respectful-code for reference.

#inclusivefixit

Bug: 161896447
Test: None
Change-Id: I1b24350f4e4528ff40ef8d9065a2c5c4251c5059
2020-07-28 17:02:22 +00:00
Victor Hsieh
b07f4854b5 Respect app-ops permission in FileIntegrityService
Previous permission doesn't consider REQUEST_INSTALL_PACKAGES permission
as an app-ops permission.

Bug: 152009905
Test: atest GtsPlayFsiTestCases
Test: remove appops setup from AndroidTest.xml, the same test failed
Change-Id: Icdbf6bb35fe146c5be8a97e29c4c554b3ce91b5d
2020-03-27 09:23:41 -07:00
Ashwini Oruganti
9330d5e32b Resolve conflicting values of usesCleartextTraffic for shared processes
Bug: 148240416
Test: Manually tested by installing two apps running in a shared process
and starting their shared process activities in various orders. The
value of usesCleartextTraffic gets set as expected.
Change-Id: Ib350c09c42d5524734fb259a2ab787790f2d8e30
2020-02-21 09:52:58 -08:00
David Su
1ac48fd8d6 Merge "Move cacerts_wfa from system to Wifi APEX" 2020-01-28 18:54:29 +00:00
Janis Danisevskis
f2dd2fbd4c Merge "ConfirmationPrompt: Use default values for UIOptions" 2020-01-23 19:10:49 +00:00
Janis Danisevskis
227dddf910 ConfirmationPrompt: Use default values for UIOptions
ConfirmationPrompt passes magnified and inverted options to the keystore
service. While gathering the accessibility_display_inversion_enabled
setting, the implementation would throw an exception if this setting was
never set by the user. This causes the font scaling property to be
ignored. This patch uses default values in case the system setting is
not set.

Test: Run CTSVerifier Protected Confirmation test with increased font
      size.

Merged-In: I03a3ef56209c73ca7d2b2527a5f145f744148e38
Change-Id: I03a3ef56209c73ca7d2b2527a5f145f744148e38
2020-01-23 08:17:39 -08:00
Janis Danisevskis
4ff0964128 ConfirmationPrompt: Use default values for UIOptions
ConfirmationPrompt passes magnified and inverted options to the keystore
service. While gathering the accessibility_display_inversion_enabled
setting, the implementation would throw an exception if this setting was
never set by the user. This causes the font scaling property to be
ignored. This patch uses default values in case the system setting is
not set.

Test: Run CTSVerifier Protected Confirmation test with increased font
      size.

Change-Id: I03a3ef56209c73ca7d2b2527a5f145f744148e38
2020-01-22 16:03:09 -08:00
David Su
4a08a1d37e Move cacerts_wfa from system to Wifi APEX
Bug: 145199837
Test: atest android.security.cts.CertificateTest
Change-Id: I16a6376a01491455f3a2ce69ab57763c99353952
2020-01-22 14:04:04 -08:00
Artur Satayev
2d330f6fa8 Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
Merged-In: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
2020-01-09 15:08:18 +00:00
Artur Satayev
df4395991f Use new UnsupportedAppUsage annotation.
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library.

Bug: 145132366
Test: m && diff unsupportedappusage_index.csv
Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
2020-01-07 13:29:50 +00:00
TreeHugger Robot
3f7ef32b9f Merge "New API for query trust of a fs-verity certificate" 2019-12-23 20:18:40 +00:00
Victor Hsieh
20fe1f6f22 New API for query trust of a fs-verity certificate
The corresponding service is also added.

The API can be used by a store to know whether their certificate is
trusted on the device. As optimization, they only need to download
.fsv_sig signature file if it will be used.

The API can also be used to gradually switch to stronger key. The store
can query with their certificates in priority order and download the best
signature.

Test: Passed new GTS working in progress
Bug: 142573505
Change-Id: Ic788cd04aeaed35ad62113fe9e7535b8fa63b5ee
2019-12-23 09:21:19 -08:00
Daulet Zhanguzin
75519c08f1 Replace com.android.internal.util.Preconditions.checkNotNull with
java.util.Objects.requireNonNull

Bug: 126528330

Test: Treehugger
Change-Id: Id9752a8c65792e3524a712b7218325528efbf80e
2019-12-18 15:03:01 +00:00
Eran Messeri
c54507664b Wire individual attestation
Properly define the constant for requesting the use of device individual
attestation certificate and use it in AttestationUtils.

This lets callers to DevicePolicyManager.generateKeyPair request the use
of device-unique attestation certificate, on Keymaster implementations
that support this.

Bug: 140193672
Bug: 136494773
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement
Change-Id: I74de89e4c121a27b0495dcb99b0775445c3d4eaf
2019-12-13 10:58:57 +00:00
Neil Fuller
a76674f153 resolve merge conflicts of fe9b32e4be to qt-dev-plus-aosp
Bug: None
Test: I solemnly swear I tested this conflict resolution.
Exempt-From-Owner-Approval: Merge conflict resolution for approved change
Change-Id: I39bda8417f709f86b5b389a75ff34df8a28a3d8d
2019-04-11 18:09:18 +00:00
Neil Fuller
b5d1c15ec2 Switch from Byte.toHexString() to HexEncoding
Switch from Byte.toHexString() to HexEncoding equivalents.

Bug: 124232146
Test: build only
Exempt-From-Owner-Approval: Cherry-picking OWNERS approved internal version
Merged-In: Id244e5247eb87c67446cbd65eb5d320f3617b8cd
Change-Id: Id244e5247eb87c67446cbd65eb5d320f3617b8cd
2019-04-11 09:27:45 +00:00
Neil Fuller
5c3f8c6562 Switch from Byte.toHexString() to HexEncoding
Switch from Byte.toHexString() to HexEncoding equivalents.

Bug: 124232146
Test: build only
Change-Id: Id244e5247eb87c67446cbd65eb5d320f3617b8cd
2019-04-08 14:55:29 +01:00
Andrei Onea
fbc8cfdc94 Add @UnsupportedAppUsage annotations
For packages:
  android.companion
  android.filterfw
  android.hardware.camera2.utils
  android.inputmethodservice
  android.net.nsd
  android.os
  android.preference
  android.security.keymaster
  android.service.dreams
  android.telecom
  android.telephony.ims.compat.feature
  android.telephony
  android.util
  android.view.accessibility
  android.media.effect

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Merged-In: I9c2f8347952f3cc65759472b0e1a2717b285e44e
Change-Id: I14793863cf815fa3383fec6c6bf5a9365c2e17eb
2019-03-22 11:43:11 +00:00
Andrei Onea
e30e3928f9 Add @UnsupportedAppUsage annotations
For packages:
  android.companion
  android.filterfw
  android.hardware.camera2.utils
  android.inputmethodservice
  android.net.nsd
  android.os
  android.preference
  android.security.keymaster
  android.service.dreams
  android.telecom
  android.telephony.ims.compat.feature
  android.telephony
  android.util
  android.view.accessibility
  android.media.effect

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: I9c2f8347952f3cc65759472b0e1a2717b285e44e
2019-03-21 14:04:57 +00:00
Dmitry Dementyev
ebe5327a15 Add @NonNull annotation to RecoveryController Builders
Bug: 126702367
Test: builder.
Change-Id: Id7bf7799602fff6d5dd1f364fe26ef18db4f5686
2019-03-05 14:50:16 -08:00
Jeff Sharkey
9e8f83db6d All Parcelable CREATOR fields are @NonNull.
If they were null, then the Parcelable would fail to work.

Bug: 126726802
Test: manual
Change-Id: I7929ffa2f20e5de1c8e68e8263cca99496e9d014
Exempt-From-Owner-Approval: Trivial API annotations
2019-02-28 23:29:04 -07:00
Max Bires
b2cc3dc227 Adding KEY_PERMANENTLY_INVALIDATED int
This is to keep it in sync with response codes in keystore.h.

This commit also adds the KeyPermanentlyInvalidatedException to all the
methods that could receive this error code out of KeyStore.

Bug: 118883532
Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/AuthBoundKeyTest.java
Change-Id: I878a628824e2eeb639ec5678b1a5d3d10428a918
Merged-In: I878a628824e2eeb639ec5678b1a5d3d10428a918
2019-02-18 21:11:48 +00:00
Max Bires
13f98ce5aa Adding KEY_PERMANENTLY_INVALIDATED int
This is to keep it in sync with response codes in keystore.h.

This commit also adds the KeyPermanentlyInvalidatedException to all the
methods that could receive this error code out of KeyStore.

Bug: 118883532
Test: atest cts/hostsidetests/appsecurity/src/android/appsecurity/cts/AuthBoundKeyTest.java
Change-Id: I878a628824e2eeb639ec5678b1a5d3d10428a918
2019-02-18 20:45:46 +00:00
Bo Zhu
c704834cb6 Add an optional metadata blob for recoverable application keys
This metadata, if present, will be authenticated (but unencrypted)
together with the application key material.

Bug: 112191661
Test: atest FrameworksCoreTests:android.security.keystore.recovery
      atest FrameworksServicesTests:com.android.server.locksettings.recoverablekeystore
      atest -m RecoveryControllerHostTest RecoverableKeyStoreEndtoEndHostTest RecoverySessionHostTest

Change-Id: I2846952758a2c1a7b1f0849e1adda1f05a3e305e
2019-01-17 17:38:19 -08:00
TreeHugger Robot
278913ae62 Merge "Update KeyStore for new biometric modalities" 2018-11-16 22:52:30 +00:00
Janis Danisevskis
463e2b0d3c Merge "Multi-threaded keystore" am: 9f248989bf am: cbd890315e
am: 444162a57c

Change-Id: I2c09961a74c7de92d85f3d2045dd065c94bc6fac
2018-11-15 06:39:39 -08:00
Janis Danisevskis
b0358e72be Multi-threaded keystore
This patch makes the framework use the asynchronous keystore api model.

Bug: 111443219
Test: Ran full keystore cts test suite
Change-Id: I8d1fdc70cb9eb501d3f22a97d1221904c2ef8f9a
2018-11-14 09:59:16 -08:00
Kevin Chyn
057b743fe9 Update KeyStore for new biometric modalities
Biometrics are now generic from KeyStore point of view

Bug: 113624536

Test: Unable to create keys when no templates enrolled
Test: Able to create keys when templates are enrolled
Test: No regression in Fingerprint
      Keys are invalidated after enrolling another FP

Change-Id: I6bdc20eb58c8a0c10a986519d4ba9e1843ebc89d
2018-11-02 18:09:25 -07:00
Dmitry Dementyev
2dfc3ae608 Clean-up removed RecoveryController API
Bug: 79604447
Test: N/A
Change-Id: If12654aa46ba3a9d018eb68c4d0bec591a22bbb9
2018-10-09 16:19:26 -07:00
Adam Vartanian
86b381be69 Merge "Inline two short methods from Conscrypt" am: 9da9b33cc2 am: 91d61ea0ed
am: 8879ee4a78

Change-Id: Iffbb91414c16b055fc3358e83fb5c23ef4998816
2018-09-25 02:33:46 -07:00
Adam Vartanian
54148c0e57 Inline two short methods from Conscrypt
We're trying to reduce unnecessary direct dependencies on Conscrypt.
These two methods are simple and the implementations can't change, so
they're good candidates for inlining directly instead of depending on
the Conscrypt implementation.

Bug: 110404540
Test: atest NetworkSecurityConfigTests (same failures pre/post)
Change-Id: I303d955e3f49885326fe75f451c06a52af745053
2018-09-24 15:34:13 +01:00