From 74e5dc0006ba53e38dff11774f5a71444aceb23d Mon Sep 17 00:00:00 2001 From: Eran Messeri Date: Tue, 12 May 2020 10:18:53 +0100 Subject: [PATCH] Revert "Added check for misprovisioned Pixel 2 device." Revert "Minor changes to check for misprovisioned Pixel 2 devices" This reverts commits f1bbe75ede256ffccecbdf9929422dadfe246e60 and e238d589f1e212c81cd5f3b3453b361e99538fed. This code is no longer needed as Pixel 2 devices are not supported on master. Bug: 156316516 Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement Change-Id: Ia32b1712b53d4bc72118507c5177ff5db5fa6cdc --- .../security/keystore/AttestationUtils.java | 35 +------------------ 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/keystore/java/android/security/keystore/AttestationUtils.java b/keystore/java/android/security/keystore/AttestationUtils.java index f82d8b62e21e8..c8d4be319babd 100644 --- a/keystore/java/android/security/keystore/AttestationUtils.java +++ b/keystore/java/android/security/keystore/AttestationUtils.java @@ -22,14 +22,12 @@ import android.annotation.RequiresPermission; import android.annotation.SystemApi; import android.annotation.TestApi; import android.content.Context; -import android.content.res.Resources; import android.os.Build; import android.security.KeyStore; import android.security.keymaster.KeymasterArguments; import android.security.keymaster.KeymasterCertificateChain; import android.security.keymaster.KeymasterDefs; import android.telephony.TelephonyManager; -import android.text.TextUtils; import android.util.ArraySet; import java.io.ByteArrayInputStream; @@ -126,37 +124,6 @@ public abstract class AttestationUtils { @NonNull public static KeymasterArguments prepareAttestationArguments(Context context, @NonNull int[] idTypes, @NonNull byte[] attestationChallenge) throws DeviceIdAttestationException { - return prepareAttestationArguments(context, idTypes,attestationChallenge, Build.BRAND); - } - - /** - * Prepares Keymaster Arguments with attestation data for misprovisioned Pixel 2 device. - * See http://go/keyAttestationFailure and http://b/69471841 for more info. - * @hide should only be used by KeyChain. - */ - @NonNull public static KeymasterArguments prepareAttestationArgumentsIfMisprovisioned( - Context context, @NonNull int[] idTypes, @NonNull byte[] attestationChallenge) throws - DeviceIdAttestationException { - Resources resources = context.getResources(); - String misprovisionedBrand = resources.getString( - com.android.internal.R.string.config_misprovisionedBrandValue); - if (!TextUtils.isEmpty(misprovisionedBrand) && !isPotentiallyMisprovisionedDevice(context)){ - return null; - } - return prepareAttestationArguments( - context, idTypes, attestationChallenge, misprovisionedBrand); - } - - @NonNull private static boolean isPotentiallyMisprovisionedDevice(Context context) { - Resources resources = context.getResources(); - String misprovisionedModel = resources.getString( - com.android.internal.R.string.config_misprovisionedDeviceModel); - return (Build.MODEL.equals(misprovisionedModel)); - } - - @NonNull private static KeymasterArguments prepareAttestationArguments(Context context, - @NonNull int[] idTypes, @NonNull byte[] attestationChallenge, String brand) throws - DeviceIdAttestationException { // Check method arguments, retrieve requested device IDs and prepare attestation arguments. if (attestationChallenge == null) { throw new NullPointerException("Missing attestation challenge"); @@ -213,7 +180,7 @@ public abstract class AttestationUtils { } } attestArgs.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_BRAND, - brand.getBytes(StandardCharsets.UTF_8)); + Build.BRAND.getBytes(StandardCharsets.UTF_8)); attestArgs.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_DEVICE, Build.DEVICE.getBytes(StandardCharsets.UTF_8)); attestArgs.addBytes(KeymasterDefs.KM_TAG_ATTESTATION_ID_PRODUCT,