From e5fb27c8f9cc06beb80e4817eff41d9c212201fd Mon Sep 17 00:00:00 2001 From: Enginex0 Date: Mon, 9 Mar 2026 20:00:14 +0100 Subject: [PATCH] fix(attestation): null out all-zero verifiedBootHash from TEE cache Matches the existing verifiedBootKey null-zero guard. When the TEE returns a zeroed hash, fall through to the system property or random fallback instead of embedding a detectable all-zero value. --- .../TEESimulator/attestation/DeviceAttestationService.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/java/org/matrix/TEESimulator/attestation/DeviceAttestationService.kt b/app/src/main/java/org/matrix/TEESimulator/attestation/DeviceAttestationService.kt index f6451bc..114ad3d 100644 --- a/app/src/main/java/org/matrix/TEESimulator/attestation/DeviceAttestationService.kt +++ b/app/src/main/java/org/matrix/TEESimulator/attestation/DeviceAttestationService.kt @@ -249,6 +249,10 @@ object DeviceAttestationService { verifiedBootKey = null } + if (verifiedBootHash?.all { it == 0.toByte() } == true) { + verifiedBootHash = null + } + SystemLogger.info( "Successfully extracted attestation data: version=$attestVersion, osVersion=$osVersion, osPatch=$osPatchLevel, vendorPatch=$vendorPatchLevel, bootPatch=$bootPatchLevel, moduleHash=${moduleHash?.toHex()}, bootKey=${verifiedBootKey?.toHex()}, bootHash=${verifiedBootHash?.toHex()}" )