summaryrefslogtreecommitdiffstats
path: root/src/idevicerestore.c
diff options
context:
space:
mode:
authorGravatar Joshua Hill2010-05-23 03:53:02 -0400
committerGravatar Joshua Hill2010-05-23 03:53:02 -0400
commitab1f7cb3c283b468235562b0b85db498b0a93766 (patch)
tree8a75406d3433afaa80eb3a037bc6b218f7137def /src/idevicerestore.c
parentead23ad2b1bcfff151fd7f476fa32f949d509c6a (diff)
downloadidevicerestore-ab1f7cb3c283b468235562b0b85db498b0a93766.tar.gz
idevicerestore-ab1f7cb3c283b468235562b0b85db498b0a93766.tar.bz2
More work on img3.c/h done, implemented basic img3 file parsing and img3 element parsing
Diffstat (limited to 'src/idevicerestore.c')
-rw-r--r--src/idevicerestore.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 0b294b9..0a5e7f1 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -260,8 +260,25 @@ int main(int argc, char* argv[]) {
plist_free(ibec_entry);
irecv_close(recovery);
ipsw_close(archive);
+ recovery = NULL;
+ return -1;
}
plist_get_string_val(ibec_path_node, &ibec_path);
+
+ char* ibec_blob = NULL;
+ uint64_t ibec_blob_size = 0;
+ plist_t ibec_blob_node = plist_dict_get_item(ibec_entry, "Blob");
+ if(!ibec_blob_node || plist_get_node_type(ibec_blob_node) != PLIST_DATA) {
+ error("ERROR: Unable to find iBEC blob in entry\n");
+ plist_free(tss_response);
+ plist_free(ibec_entry);
+ irecv_close(recovery);
+ ipsw_close(archive);
+ recovery = NULL;
+ return -1;
+ }
+ plist_get_data_val(ibec_blob_node, &ibec_blob, &ibec_blob_size);
+ plist_free(ibec_blob_node);
plist_free(ibec_entry);
ipsw_file* ibec = ipsw_extract_file(archive, ibec_path);
@@ -269,6 +286,7 @@ int main(int argc, char* argv[]) {
error("ERROR: Unable to extract %s from IPSW\n", ibec_path);
irecv_close(recovery);
ipsw_close(archive);
+ recovery = NULL;
return -1;
}
ipsw_close(archive);
@@ -278,16 +296,19 @@ int main(int argc, char* argv[]) {
error("ERROR: Unable to parse IMG3: %s\n", ibec_path);
irecv_close(recovery);
ipsw_free_file(ibec);
+ recovery = NULL;
return -1;
}
ipsw_free_file(ibec);
- tss_stitch_img3(tss_response, &ibec_img3);
- recovery_error = irecv_send_file(recovery, ibec_img3->data);
+ img3_replace_signature(ibec_img3, ibec_blob);
+ recovery_error = irecv_send_file(recovery, img3_get_data(ibec_img3));
if(recovery_error != IRECV_E_SUCCESS) {
error("ERROR: Unable to send IMG3: %s\n", ibec_path);
irecv_close(recovery);
img3_free(ibec_img3);
+ recovery = NULL;
+ return -1;
}
irecv_close(recovery);