diff options
author | Nikias Bassen | 2022-08-29 03:52:54 +0200 |
---|---|---|
committer | Nikias Bassen | 2022-08-29 03:52:54 +0200 |
commit | d0921e4b468500874773561a341cd662e3fb73fa (patch) | |
tree | 419e30173c9c65867cbe179497c6cae5050e31a3 /src | |
parent | 65f170986d03fb536e48967cf3ffc5fb91f57a2d (diff) | |
download | idevicerestore-d0921e4b468500874773561a341cd662e3fb73fa.tar.gz idevicerestore-d0921e4b468500874773561a341cd662e3fb73fa.tar.bz2 |
restore: Add support for Cryptex1LocalPolicy firmware updater
Diffstat (limited to 'src')
-rw-r--r-- | src/restore.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/restore.c b/src/restore.c index 1a15959..30fccbe 100644 --- a/src/restore.c +++ b/src/restore.c @@ -2860,10 +2860,22 @@ static plist_t restore_get_cryptex1_firmware_data(restored_client_t restore, str plist_t request = NULL; plist_t response = NULL; - /* create Timer request */ + plist_t p_updater_name = plist_dict_get_item(arguments, "MessageArgUpdaterName"); + const char* s_updater_name = plist_get_string_ptr(p_updater_name, NULL); + + plist_t device_generated_tags = plist_access_path(arguments, 2, "DeviceGeneratedTags", "ResponseTags"); + const char* response_ticket = "Cryptex1,Ticket"; + if (PLIST_IS_ARRAY(device_generated_tags)) { + plist_t tag0 = plist_array_get_item(device_generated_tags, 0); + if (tag0) { + response_ticket = plist_get_string_ptr(tag0, NULL); + } + } + + /* create Cryptex1 request */ request = tss_request_new(NULL); if (request == NULL) { - error("ERROR: Unable to create Cryptex1 TSS request\n"); + error("ERROR: Unable to create %s TSS request\n", s_updater_name); return NULL; } @@ -2875,7 +2887,7 @@ static plist_t restore_get_cryptex1_firmware_data(restored_client_t restore, str plist_dict_set_item(parameters, "ApProductionMode", plist_new_bool(1)); plist_dict_set_item(parameters, "ApSecurityMode", plist_new_bool(1)); - /* add Timer,* tags from info dictionary to parameters */ + /* add tags from info dictionary to parameters */ plist_t device_generated_request = plist_dict_get_item(arguments, "DeviceGeneratedRequest"); if (!device_generated_request) { error("ERROR: Could not find DeviceGeneratedRequest in arguments dictionary\n"); @@ -2894,18 +2906,19 @@ static plist_t restore_get_cryptex1_firmware_data(restored_client_t restore, str plist_free(parameters); - info("Sending Cryptex1 TSS request...\n"); + info("Sending %s TSS request...\n", s_updater_name); response = tss_request_send(request, client->tss_url); plist_free(request); if (response == NULL) { - error("ERROR: Unable to fetch Cryptex1\n"); + error("ERROR: Unable to fetch %s ticket\n", s_updater_name); return NULL; } - if (plist_dict_get_item(response, "Cryptex1,Ticket")) { - info("Received Cryptex1,Ticket\n"); + if (plist_dict_get_item(response, response_ticket)) { + info("Received %s\n", response_ticket); } else { - error("ERROR: No 'Cryptex1,Ticket' in TSS response, this might not work\n"); + error("ERROR: No '%s' in TSS response, this might not work\n", response_ticket); + debug_plist(response); } return response; @@ -3034,10 +3047,10 @@ static int restore_send_firmware_updater_data(restored_client_t restore, struct error("ERROR: %s: Couldn't get AppleTypeCRetimer firmware data\n", __func__); goto error_out; } - } else if (strcmp(s_updater_name, "Cryptex1") == 0) { + } else if ((strcmp(s_updater_name, "Cryptex1") == 0) || (strcmp(s_updater_name, "Cryptex1LocalPolicy") == 0)) { fwdict = restore_get_cryptex1_firmware_data(restore, client, build_identity, p_info, arguments); if (fwdict == NULL) { - error("ERROR: %s: Couldn't get AppleTypeCRetimer firmware data\n", __func__); + error("ERROR: %s: Couldn't get %s firmware data\n", __func__, s_updater_name); goto error_out; } } else { |