This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] SK-AM62P-LP:OP-TEE KeyMint HAL 版本不匹配 (v3.0 与 v4.0) 导致 AAOS 16 上的 Android Keystore 密钥生成失败

Guru**** 2812305 points

Other Parts Discussed in Thread: AM62P

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1623961/sk-am62p-lp-op-tee-keymint-hal-version-mismatch-v3-0-vs-v4-0-causing-android-keystore-key-generation-failure-on-aaos-16

器件型号: SK-AM62P-LP
主题: AM62P 中讨论的其他器件

尊敬的 TI 团队:

我正在处理  运行的 SK AM62P LP AAOS 16 (Android 16、Linux 内核 6.12.23-android16) 并面临 Android 密钥库密钥生成的关键问题。 OP-TEE KeyMint HAL 版本与 AAOS 16 的 Keystore2 预期不匹配、导致所有密钥对生成都失败。

环境:

  • 板:SK AM62P LP  
  • 操作系统: AaOS 16 (Android Automotive OS 16)
  • 内核: 6.12.23-android16-5
  • OP-TEE 版本:4.7 (86846f4fdf14f25b)(从引导日志)
  • KeyMint HAL:  android.hardware.security.keymint-service.optee

问题:

当我KeyPairGenerator.generateKeyPair()使用AndroidKeyStore Java 中的提供程序调用时、它始终失败、原因是:

java.security.ProviderException: Failed to construct key object from newly generated key pair.
Caused by: java.security.UnrecoverableKeyException:
           Failed to obtain X.509 form of public key. Keystore has no public certificate stored.

确定的根本原因:

从启动日志中、我可以清楚地看到 A 版本不匹配

# OP-TEE KeyMint HAL reports itself as version 3.0:
optee_keymaster_hal: Initializing OpteeKeymaster as KmVersion: 300

# But AAOS 16 Keystore2 registers it as version 4.0:
keystore2: KeyMint device is current version (Some(400)) for security level: TRUSTED_ENVIRONMENT

OP-TEE KeyMint Trusted Application (TA) 将作为运行 KM 版本 300 (KeyMint 3.0) 、但 AAOS 16 的 Keystore2 预期 KeyMint 4.0(版本 400) 。 由于这种不匹配、Keystore2 无法正确解析 OP-TEE 的密钥生成响应—X.509 证书永远不会存储、并且密钥对构建失败。

此外、在初始启动期间、我们观察到密钥生成请求达到看门狗超时(超过 5 秒)、并且 OP-TEE IPC 层出现以下错误:

OpteeKeymaster_ipc: Request too big: 4622  Max size: 4076
optee_keymaster_hal: Cmd 88 returned error: -21
keystore2: Error::Km(r#INVALID_INPUT_LENGTH)

这表明 4076 字节的 OP-TEE IPC 缓冲区大小也不足以满足此 BSP 构建上的密钥生成请求有效载荷。

  1. 建议的方法 如果使用 Android Keystore(提供程序)AndroidKeyStore在配备 AAOS 16 的 AM62P 上生成硬件支持的密钥、
  2. 有官员吗  提供 该 KeyMint 版本不匹配问题是否已解决?
  3. 是否有更新  KeyMint TA 处理器系列 KeyMint 4.0 (KM 版本 400) 与 AAOS 16 兼容