mirror of
https://github.com/Decscots/Lockpick_RCM.git
synced 2024-11-25 17:46:55 +01:00
Retry tsec keygen on failure
This commit is contained in:
parent
705bb7c066
commit
e041330ed9
@ -95,13 +95,17 @@ static int _run_ams_keygen(key_derivation_ctx_t *keys) {
|
|||||||
tsec_ctxt.fw = tsec_keygen;
|
tsec_ctxt.fw = tsec_keygen;
|
||||||
tsec_ctxt.size = sizeof(tsec_keygen);
|
tsec_ctxt.size = sizeof(tsec_keygen);
|
||||||
tsec_ctxt.type = TSEC_FW_TYPE_NEW;
|
tsec_ctxt.type = TSEC_FW_TYPE_NEW;
|
||||||
int res = tsec_query(keys->temp_key, &tsec_ctxt);
|
|
||||||
|
|
||||||
if (res) {
|
u32 retries = 0;
|
||||||
EPRINTFARGS("ERROR %d running keygen.\n", res);
|
while (tsec_query(keys->temp_key, &tsec_ctxt) < 0) {
|
||||||
|
retries++;
|
||||||
|
if (retries > 15) {
|
||||||
|
EPRINTF("Failed to run keygen.");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _derive_master_keys_from_latest_key(key_derivation_ctx_t *keys, bool is_dev) {
|
static void _derive_master_keys_from_latest_key(key_derivation_ctx_t *keys, bool is_dev) {
|
||||||
@ -799,7 +803,6 @@ static void _derive_keys() {
|
|||||||
} else {
|
} else {
|
||||||
int res = _run_ams_keygen(keys);
|
int res = _run_ams_keygen(keys);
|
||||||
if (res) {
|
if (res) {
|
||||||
EPRINTF("Unable to run keygen.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user