From 429e033b7f79e4f9dedb102c75e26fdcc4e0a68d Mon Sep 17 00:00:00 2001 From: Enginex0 Date: Tue, 19 May 2026 05:15:51 +0100 Subject: [PATCH] fix(interception): emit KEY_SIZE for EC keys Revert 59dfb2e. AOSP 15 KeyMint reference TA at system/keymint/common/src/tag/info.rs:61-89 lists both Tag::EcCurve and Tag::KeySize in KEYMINT_ENFORCED_CHARACTERISTICS, and check_ec_params at common/src/tag.rs:632 says "Key size is not needed, but if present should match the curve" -- the TA passes through whatever the caller supplies and keystore2 supplies both for EC keys per KeyMintBenchmark.cpp:234,259. Omitting KEY_SIZE made the simulator's characteristics list shorter than real hardware, a detection fingerprint. --- .../keystore/shim/KeyMintSecurityLevelInterceptor.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/org/matrix/TEESimulator/interception/keystore/shim/KeyMintSecurityLevelInterceptor.kt b/app/src/main/java/org/matrix/TEESimulator/interception/keystore/shim/KeyMintSecurityLevelInterceptor.kt index 8f4d266..a1117f3 100644 --- a/app/src/main/java/org/matrix/TEESimulator/interception/keystore/shim/KeyMintSecurityLevelInterceptor.kt +++ b/app/src/main/java/org/matrix/TEESimulator/interception/keystore/shim/KeyMintSecurityLevelInterceptor.kt @@ -1068,9 +1068,7 @@ private fun KeyMintAttestation.toAuthorizations( this.blockMode.forEach { authList.add(createAuth(Tag.BLOCK_MODE, KeyParameterValue.blockMode(it))) } this.digest.forEach { authList.add(createAuth(Tag.DIGEST, KeyParameterValue.digest(it))) } this.padding.forEach { authList.add(createAuth(Tag.PADDING, KeyParameterValue.paddingMode(it))) } - if (this.algorithm != Algorithm.EC || this.ecCurve == null) { - authList.add(createAuth(Tag.KEY_SIZE, KeyParameterValue.integer(this.keySize))) - } + authList.add(createAuth(Tag.KEY_SIZE, KeyParameterValue.integer(this.keySize))) if (this.rsaPublicExponent != null) { authList.add(createAuth(Tag.RSA_PUBLIC_EXPONENT, KeyParameterValue.longInteger(this.rsaPublicExponent.toLong()))) }