@@ -151,6 +151,7 @@ class AttestationProtocol {
151
151
// short autoRebootMinutes (-1 for unknown)
152
152
// byte portSecurityMode (-1 for unknown)
153
153
// byte userCount (-1 for unknown)
154
+ // byte oemUnlockAllowed (-1 for unknown)
154
155
// }
155
156
// byte[] signature (rest of message)
156
157
//
@@ -159,6 +160,7 @@ class AttestationProtocol {
159
160
// 6: autoRebootMinutes added
160
161
// 6: portSecurityMode added
161
162
// 6: userCount added
163
+ // 6: oemUnlockAllowed added
162
164
//
163
165
// n/a
164
166
//
@@ -214,7 +216,7 @@ class AttestationProtocol {
214
216
private static final int OS_ENFORCED_FLAGS_ENROLLED_BIOMETRICS = 1 << 5 ;
215
217
private static final int OS_ENFORCED_FLAGS_DENY_NEW_USB = 1 << 6 ; // obsolete since version 86
216
218
private static final int OS_ENFORCED_FLAGS_DEVICE_ADMIN_NON_SYSTEM = 1 << 7 ;
217
- private static final int OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED = 1 << 8 ;
219
+ private static final int OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED = 1 << 8 ; // obsolete since version 89
218
220
private static final int OS_ENFORCED_FLAGS_SYSTEM_USER = 1 << 9 ;
219
221
private static final int OS_ENFORCED_FLAGS_ALL =
220
222
OS_ENFORCED_FLAGS_USER_PROFILE_SECURE |
@@ -961,7 +963,7 @@ private static VerificationResult verify(final Context context, final byte[] fin
961
963
final boolean accessibility , final boolean deviceAdmin ,
962
964
final boolean deviceAdminNonSystem , final boolean adbEnabled ,
963
965
final boolean addUsersWhenLocked , final boolean enrolledBiometrics ,
964
- final boolean oemUnlockAllowed , final boolean systemUser )
966
+ final boolean systemUser )
965
967
throws GeneralSecurityException {
966
968
final String fingerprintHex = BaseEncoding .base16 ().encode (fingerprint );
967
969
final byte [] currentFingerprint = getFingerprint (attestationCertificates [0 ]);
@@ -1132,8 +1134,6 @@ private static VerificationResult verify(final Context context, final byte[] fin
1132
1134
toYesNoString (context , adbEnabled )));
1133
1135
osEnforced .append (context .getString (R .string .add_users_when_locked ,
1134
1136
toYesNoString (context , addUsersWhenLocked )));
1135
- osEnforced .append (context .getString (R .string .oem_unlock_allowed ,
1136
- toYesNoString (context , oemUnlockAllowed )));
1137
1137
osEnforced .append (context .getString (R .string .system_user ,
1138
1138
toYesNoString (context , systemUser )));
1139
1139
@@ -1227,7 +1227,6 @@ static VerificationResult verifySerialized(final Context context, final byte[] a
1227
1227
final boolean adbEnabled = (osEnforcedFlags & OS_ENFORCED_FLAGS_ADB_ENABLED ) != 0 ;
1228
1228
final boolean addUsersWhenLocked = (osEnforcedFlags & OS_ENFORCED_FLAGS_ADD_USERS_WHEN_LOCKED ) != 0 ;
1229
1229
final boolean enrolledBiometrics = (osEnforcedFlags & OS_ENFORCED_FLAGS_ENROLLED_BIOMETRICS ) != 0 ;
1230
- final boolean oemUnlockAllowed = (osEnforcedFlags & OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED ) != 0 ;
1231
1230
final boolean systemUser = (osEnforcedFlags & OS_ENFORCED_FLAGS_SYSTEM_USER ) != 0 ;
1232
1231
1233
1232
if (deviceAdminNonSystem && !deviceAdmin ) {
@@ -1238,6 +1237,7 @@ static VerificationResult verifySerialized(final Context context, final byte[] a
1238
1237
final short autoRebootMinutes = deserializer .getShort ();
1239
1238
final byte portSecurityMode = deserializer .get ();
1240
1239
final byte userCount = deserializer .get ();
1240
+ final byte oemUnlockAllowed = deserializer .get ();
1241
1241
}
1242
1242
1243
1243
final int signatureLength = deserializer .remaining ();
@@ -1250,7 +1250,7 @@ static VerificationResult verifySerialized(final Context context, final byte[] a
1250
1250
final byte [] challenge = Arrays .copyOfRange (challengeMessage , 1 + RANDOM_TOKEN_LENGTH , 1 + RANDOM_TOKEN_LENGTH * 2 );
1251
1251
return verify (context , fingerprint , challenge , deserializer .asReadOnlyBuffer (), signature ,
1252
1252
certificates , userProfileSecure , accessibility , deviceAdmin , deviceAdminNonSystem ,
1253
- adbEnabled , addUsersWhenLocked , enrolledBiometrics , oemUnlockAllowed , systemUser );
1253
+ adbEnabled , addUsersWhenLocked , enrolledBiometrics , systemUser );
1254
1254
}
1255
1255
1256
1256
record AttestationResult (boolean pairing , byte [] serialized ) {}
@@ -1430,9 +1430,6 @@ static AttestationResult generateSerialized(final Context context, final byte[]
1430
1430
final boolean addUsersWhenLocked = Settings .Global .getInt (context .getContentResolver (),
1431
1431
ADD_USERS_WHEN_LOCKED , 0 ) != 0 ;
1432
1432
1433
- final String oemUnlockAllowedValue = SystemProperties .get ("sys.oem_unlock_allowed" , "0" );
1434
- final boolean oemUnlockAllowed = oemUnlockAllowedValue .equals ("1" );
1435
-
1436
1433
final UserManager userManager = context .getSystemService (UserManager .class );
1437
1434
final boolean systemUser = userManager .isSystemUser ();
1438
1435
@@ -1480,9 +1477,6 @@ static AttestationResult generateSerialized(final Context context, final byte[]
1480
1477
if (enrolledBiometrics ) {
1481
1478
osEnforcedFlags |= OS_ENFORCED_FLAGS_ENROLLED_BIOMETRICS ;
1482
1479
}
1483
- if (oemUnlockAllowed ) {
1484
- osEnforcedFlags |= OS_ENFORCED_FLAGS_OEM_UNLOCK_ALLOWED ;
1485
- }
1486
1480
if (systemUser ) {
1487
1481
osEnforcedFlags |= OS_ENFORCED_FLAGS_SYSTEM_USER ;
1488
1482
}
@@ -1497,6 +1491,9 @@ static AttestationResult generateSerialized(final Context context, final byte[]
1497
1491
1498
1492
final byte userCount = 0 ;
1499
1493
serializer .put (userCount );
1494
+
1495
+ final byte oemUnlockAllowed = 0 ;
1496
+ serializer .put (oemUnlockAllowed );
1500
1497
}
1501
1498
1502
1499
final ByteBuffer message = serializer .duplicate ();
0 commit comments