1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-29 17:48:10 +00:00

feat(core): improve optiga initialization error handling

[no changelog]
This commit is contained in:
Ondřej Vejpustek 2024-07-19 13:31:54 +02:00
parent 974630897b
commit 52437b1fc8

View File

@ -228,11 +228,17 @@ int main(void) {
#endif #endif
optiga_init(); optiga_init();
optiga_open_application();
if (sectrue == secret_ok) { if (sectrue == secret_ok) {
optiga_sec_chan_handshake(secret, sizeof(secret)); // If the shielded connection cannot be established, reset Optiga and
// continue without it. In this case, OID_KEY_FIDO and OID_KEY_DEV cannot be
// used, which means device and FIDO attestation will not work.
if (optiga_sec_chan_handshake(secret, sizeof(secret)) != OPTIGA_SUCCESS) {
optiga_soft_reset();
}
} }
memzero(secret, sizeof(secret)); memzero(secret, sizeof(secret));
ensure(sectrue * (optiga_open_application() == OPTIGA_SUCCESS),
"Cannot initialize optiga.");
#endif #endif
#if !defined TREZOR_MODEL_1 #if !defined TREZOR_MODEL_1