From b85b3dea48cf99b5bc784ab663f01377f84f3eaf Mon Sep 17 00:00:00 2001 From: Enginex0 Date: Wed, 15 Apr 2026 13:52:39 +0100 Subject: [PATCH] wip(keystore): add F1 Phase A diagnostic logs in updateAad path Instrumentation-only. Logs entry (primitive class, callingUid, input size) and throwable propagation (class, SSE error code, message, stack top) in both SoftwareOperation.updateAad and SoftwareOperationBinder.updateAad. Intended to distinguish F1 hypotheses H1 (binder swallows SSE) vs H3 (AIDL signature drift) once duck's probe key is routed through our simulator instead of the real TEE. --- .../keystore/shim/SoftwareOperation.kt | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/matrix/TEESimulator/interception/keystore/shim/SoftwareOperation.kt b/app/src/main/java/org/matrix/TEESimulator/interception/keystore/shim/SoftwareOperation.kt index cf5ea9e..3f99db4 100644 --- a/app/src/main/java/org/matrix/TEESimulator/interception/keystore/shim/SoftwareOperation.kt +++ b/app/src/main/java/org/matrix/TEESimulator/interception/keystore/shim/SoftwareOperation.kt @@ -254,10 +254,18 @@ class SoftwareOperation( } fun updateAad(aadInput: ByteArray?) { - SystemLogger.debug("[SoftwareOp TX_ID: $txId] updateAad() inputSize=${aadInput?.size ?: 0}") + SystemLogger.info("[SoftwareOp TX_ID: $txId] updateAad() ENTRY inputSize=${aadInput?.size ?: 0} primitive=${primitive::class.simpleName}") checkActive() checkInputLength(aadInput) - primitive.updateAad(aadInput) + try { + primitive.updateAad(aadInput) + SystemLogger.info("[SoftwareOp TX_ID: $txId] updateAad() RETURNED_NORMALLY (unexpected for non-AEAD)") + } catch (throwable: Throwable) { + val top = throwable.stackTrace.firstOrNull()?.toString() ?: "" + val code = (throwable as? ServiceSpecificException)?.errorCode + SystemLogger.info("[SoftwareOp TX_ID: $txId] updateAad() THREW class=${throwable::class.java.name} code=$code msg=${throwable.message} top=$top") + throw throwable + } } fun update(data: ByteArray?): ByteArray? { @@ -387,7 +395,15 @@ class SoftwareOperationBinder(private val operation: SoftwareOperation) : @Synchronized override fun updateAad(aadInput: ByteArray?) { - operation.updateAad(aadInput) + SystemLogger.info("[SoftwareOpBinder] updateAad() ENTRY callingUid=${android.os.Binder.getCallingUid()} size=${aadInput?.size ?: 0}") + try { + operation.updateAad(aadInput) + SystemLogger.info("[SoftwareOpBinder] updateAad() RETURNED_NORMALLY") + } catch (throwable: Throwable) { + val code = (throwable as? ServiceSpecificException)?.errorCode + SystemLogger.info("[SoftwareOpBinder] updateAad() PROPAGATING class=${throwable::class.java.name} code=$code msg=${throwable.message}") + throw throwable + } } @Synchronized