Clarification on Master Key Encryption Key (MKEK) stored in OTP memory in RP2350 FIDO2 firmware #179

Open
opened 2025-08-13 17:02:09 +08:00 by devi1207 · 2 comments
devi1207 commented 2025-08-13 17:02:09 +08:00 (Migrated from github.com)

I’m working with the FIDO2 firmware on the RP2350 and need clarification on the difference between using the Master Key Encryption Key (MKEK) from OTP memory versus from the file system.

From my observations, the firmware generates both the MKEK and the device key, stores them in the OTP memory region, and then locks the OTP page.
In the fido.c file, however, the firmware also generates the MKEK value and stores it in the file system. This file system MKEK is then used throughout the code for encryption and decryption, based on my debug data.

Could you clarify at which stage of the FIDO2 workflow the MKEK and device key stored in OTP memory are actually used?
Am I missing any steps required to enable the firmware to use the MKEK and device key from OTP memory instead of the file system?

I’m working with the FIDO2 firmware on the RP2350 and need clarification on the difference between using the Master Key Encryption Key (MKEK) from OTP memory versus from the file system. From my observations, the firmware generates both the MKEK and the device key, stores them in the OTP memory region, and then locks the OTP page. In the fido.c file, however, the firmware also generates the MKEK value and stores it in the file system. This file system MKEK is then used throughout the code for encryption and decryption, based on my debug data. Could you clarify at which stage of the FIDO2 workflow the MKEK and device key stored in OTP memory are actually used? Am I missing any steps required to enable the firmware to use the MKEK and device key from OTP memory instead of the file system?
polhenarejos commented 2025-08-25 07:53:20 +08:00 (Migrated from github.com)

MKEK is the key used for encrypting the keys. At the same time, MKEK is also encrypted with a hash of the PIN. Therefore, without the PIN, it is not possible encrypt any key without brute force. Additionally, for OTP boards (RP2350 and ESP32), MKEK is xored with an OTP key to add an extra layer of security (for instance, it will avoid dumping in case someone knows your PIN, albeit this is only for RP2350 and ESP32).

You don't need to "enable the firmware". This runs smoothly on the first boot without user intervention.

MKEK is the key used for encrypting the keys. At the same time, MKEK is also encrypted with a hash of the PIN. Therefore, without the PIN, it is not possible encrypt any key without brute force. Additionally, for OTP boards (RP2350 and ESP32), MKEK is xored with an OTP key to add an extra layer of security (for instance, it will avoid dumping in case someone knows your PIN, albeit this is only for RP2350 and ESP32). You don't need to "enable the firmware". This runs smoothly on the first boot without user intervention.
dyyxxhh commented 2025-10-05 07:16:31 +08:00 (Migrated from github.com)

MKEK 是用于加密密钥的密钥。同时,MKEK 也用 PIN 的哈希值加密。因此,如果没有 PIN 码,就不可能在不使用暴力的情况下加密任何密钥。此外,对于 OTP 板(RP2350 和 ESP32),MKEK 与 OTP 密钥进行异或化,以增加额外的安全层(例如,如果有人知道您的 PIN,它将避免转储,尽管这仅适用于 RP2350 和 ESP32)。

您不需要“启用固件”。这在第一次启动时运行顺畅,无需用户干预。

you mean that i needn`t enable secure boot

> MKEK 是用于加密密钥的密钥。同时,MKEK 也用 PIN 的哈希值加密。因此,如果没有 PIN 码,就不可能在不使用暴力的情况下加密任何密钥。此外,对于 OTP 板(RP2350 和 ESP32),MKEK 与 OTP 密钥进行异或化,以增加额外的安全层(例如,如果有人知道您的 PIN,它将避免转储,尽管这仅适用于 RP2350 和 ESP32)。 > > 您不需要“启用固件”。这在第一次启动时运行顺畅,无需用户干预。 you mean that i needn`t enable secure boot
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dearsky/pico-fido#179