-
-
Save nikias/aadb2aed43b80710618e3fdef9b72601 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/restore.c b/src/restore.c | |
index 69e5191..8368029 100644 | |
--- a/src/restore.c | |
+++ b/src/restore.c | |
@@ -107,6 +107,7 @@ | |
#define INSTALLING_RECOVERY_OS_IMAGE 71 | |
#define REQUESTING_EAN_DATA 74 | |
#define SEALING_SYSTEM_VOLUME 77 | |
+#define UPDATING_APPLETCON 81 | |
static int restore_finished = 0; | |
@@ -625,6 +626,8 @@ const char* restore_progress_string(unsigned int operation) | |
return "Requesting EAN Data"; | |
case SEALING_SYSTEM_VOLUME: | |
return "Sealing System Volume"; | |
+ case UPDATING_APPLETCON: | |
+ return "Updating AppleTCON"; | |
default: | |
return "Unknown operation"; | |
} | |
@@ -2602,6 +2605,77 @@ static plist_t restore_get_veridian_firmware_data(restored_client_t restore, str | |
return response; | |
} | |
+static plist_t restore_get_tcon_firmware_data(restored_client_t restore, struct idevicerestore_client_t* client, plist_t build_identity, plist_t p_info) | |
+{ | |
+ char *comp_name = "Baobab,TCON"; | |
+ char *comp_path = NULL; | |
+ plist_t comp_node = NULL; | |
+ unsigned char* component_data = NULL; | |
+ unsigned int component_size = 0; | |
+ plist_t parameters = NULL; | |
+ plist_t request = NULL; | |
+ plist_t response = NULL; | |
+ plist_t node = NULL; | |
+ int ret; | |
+ | |
+ /* create Veridian request */ | |
+ request = tss_request_new(NULL); | |
+ if (request == NULL) { | |
+ error("ERROR: Unable to create Veridian TSS request\n"); | |
+ free(component_data); | |
+ return NULL; | |
+ } | |
+ | |
+ parameters = plist_new_dict(); | |
+ | |
+ /* add manifest for current build_identity to parameters */ | |
+ tss_parameters_add_from_manifest(parameters, build_identity); | |
+ | |
+ /* add BMU,* tags from info dictionary to parameters */ | |
+ plist_dict_merge(¶meters, p_info); | |
+ | |
+ /* add required tags for Baobab TSS request */ | |
+ tss_request_add_tcon_tags(request, parameters, NULL); | |
+ | |
+ plist_free(parameters); | |
+ | |
+ info("Sending Baobab TSS request...\n"); | |
+ response = tss_request_send(request, client->tss_url); | |
+ plist_free(request); | |
+ if (response == NULL) { | |
+ error("ERROR: Unable to fetch Baobab ticket\n"); | |
+ free(component_data); | |
+ return NULL; | |
+ } | |
+ | |
+ if (plist_dict_get_item(response, "Baobab,Ticket")) { | |
+ info("Received Baobab ticket\n"); | |
+ } else { | |
+ error("ERROR: No 'Baobab,Ticket' in TSS response, this might not work\n"); | |
+ } | |
+ | |
+ if (build_identity_get_component_path(build_identity, comp_name, &comp_path) < 0) { | |
+ error("ERROR: Unable to get path for '%s' component\n", comp_name); | |
+ return NULL; | |
+ } | |
+ | |
+ /* now get actual component data */ | |
+ ret = extract_component(client->ipsw, comp_path, &component_data, &component_size); | |
+ free(comp_path); | |
+ comp_path = NULL; | |
+ if (ret < 0) { | |
+ error("ERROR: Unable to extract '%s' component\n", comp_name); | |
+ return NULL; | |
+ } | |
+ | |
+ plist_dict_set_item(response, "FirmwareData", plist_new_data((char *)component_data, (uint64_t)component_size)); | |
+ free(component_data); | |
+ component_data = NULL; | |
+ component_size = 0; | |
+ | |
+ return response; | |
+} | |
+ | |
static int restore_send_firmware_updater_data(restored_client_t restore, struct idevicerestore_client_t* client, plist_t build_identity, plist_t message) | |
{ | |
plist_t arguments; | |
@@ -2689,6 +2763,12 @@ static int restore_send_firmware_updater_data(restored_client_t restore, struct | |
error("ERROR: %s: Couldn't get Veridian firmware data\n", __func__); | |
goto error_out; | |
} | |
+ } else if (strcmp(s_updater_name, "AppleTCON") == 0) { | |
+ fwdict = restore_get_tcon_firmware_data(restore, client, build_identity, p_info); | |
+ if (fwdict == NULL) { | |
+ error("ERROR: %s: Couldn't get AppleTCON firmware data\n", __func__); | |
+ goto error_out; | |
+ } | |
} else { | |
error("ERROR: %s: Got unknown updater name '%s'.\n", __func__, s_updater_name); | |
goto error_out; | |
diff --git a/src/tss.c b/src/tss.c | |
index 069e5ed..84470cd 100644 | |
--- a/src/tss.c | |
+++ b/src/tss.c | |
@@ -1699,6 +1699,12 @@ int tss_request_add_veridian_tags(plist_t request, plist_t parameters, plist_t o | |
return 0; | |
} | |
+int tss_request_add_tcon_tags(plist_t request, plist_t parameters, plist_t overrides) | |
+{ | |
+ // TODO FIXME | |
+ return 0; | |
+} | |
+ | |
static size_t tss_write_callback(char* data, size_t size, size_t nmemb, tss_response* response) { | |
size_t total = size * nmemb; | |
if (total != 0) { | |
diff --git a/src/tss.h b/src/tss.h | |
index 86dce42..3590aed 100644 | |
--- a/src/tss.h | |
+++ b/src/tss.h | |
@@ -47,6 +47,7 @@ int tss_request_add_yonkers_tags(plist_t request, plist_t parameters, plist_t ov | |
int tss_request_add_vinyl_tags(plist_t request, plist_t parameters, plist_t overrides); | |
int tss_request_add_rose_tags(plist_t request, plist_t parameters, plist_t overrides); | |
int tss_request_add_veridian_tags(plist_t request, plist_t parameters, plist_t overrides); | |
+int tss_request_add_tcon_tags(plist_t request, plist_t parameters, plist_t overrides); | |
int tss_request_add_ap_img4_tags(plist_t request, plist_t parameters); | |
int tss_request_add_ap_img3_tags(plist_t request, plist_t parameters); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment