Skip to content

Commit e82fd13

Browse files
Android HW Trust Teamcopybara-github
authored andcommitted
Add deviceLocked to VerificationResult.Success
PiperOrigin-RevId: 905126495
1 parent f39ec0d commit e82fd13

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/kotlin/Verifier.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ sealed interface VerificationResult {
4848
val challenge: ByteString,
4949
val securityLevel: SecurityLevel,
5050
val verifiedBootState: VerifiedBootState,
51+
val deviceLocked: Boolean,
5152
val deviceInformation: ProvisioningInfoMap?,
5253
val attestedDeviceIds: DeviceIdentity,
5354
) : VerificationResult
@@ -305,12 +306,14 @@ constructor(
305306
minOf(keyDescription.attestationSecurityLevel, keyDescription.keyMintSecurityLevel)
306307
val rootOfTrust = keyDescription.hardwareEnforced.rootOfTrust
307308
val verifiedBootState = rootOfTrust?.verifiedBootState ?: VerifiedBootState.UNVERIFIED
309+
val deviceLocked = rootOfTrust?.deviceLocked ?: false
308310

309311
return VerificationResult.Success(
310312
pathValidationResult.publicKey,
311313
keyDescription.attestationChallenge,
312314
securityLevel,
313315
verifiedBootState,
316+
deviceLocked,
314317
deviceInformation,
315318
DeviceIdentity.parseFrom(keyDescription),
316319
)

src/test/kotlin/VerifierTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ class VerifierTest {
8282
assertThat(result.securityLevel).isEqualTo(json.attestationSecurityLevel)
8383
assertThat(result.verifiedBootState)
8484
.isEqualTo(json.hardwareEnforced.rootOfTrust?.verifiedBootState)
85+
assertThat(result.deviceLocked)
86+
.isEqualTo(json.hardwareEnforced.rootOfTrust?.deviceLocked ?: false)
8587
}
8688

8789
enum class TestCase(val path: String, val timestamp: Instant) {

0 commit comments

Comments
 (0)