summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-02-02 22:40:52 +0100
committerGravatar Nikias Bassen2012-02-02 22:40:52 +0100
commit137acdcb938aaad3892f4f0748aadc4e756211b2 (patch)
tree88549a6015c16c64accc3d15dd51a1705b7e6f10 /src
parentea36c9e71c1f945a01e292bc4de95216be869814 (diff)
downloadidevicerestore-137acdcb938aaad3892f4f0748aadc4e756211b2.tar.gz
idevicerestore-137acdcb938aaad3892f4f0748aadc4e756211b2.tar.bz2
restore: send root ticket
Diffstat (limited to 'src')
-rw-r--r--src/restore.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/restore.c b/src/restore.c
index aefaa25..f960570 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -459,6 +459,43 @@ int restore_send_filesystem(idevice_t device, const char* filesystem) {
return 0;
}
+int restore_send_root_ticket(restored_client_t restore, struct idevicerestore_client_t* client)
+{
+ restored_error_t restore_error;
+ plist_t dict;
+ unsigned char* data = NULL;
+ uint32_t len = 0;
+
+ if (!client->tss && !(client->flags & FLAG_CUSTOM)) {
+ error("ERROR: Cannot send RootTicket without TSS\n");
+ return -1;
+ }
+
+ if (!(client->flags & FLAG_CUSTOM) && (tss_get_ticket(client->tss, &data, &len) < 0)) {
+ error("ERROR: Unable to get ticket from TSS\n");
+ return -1;
+ }
+
+ dict = plist_new_dict();
+ if (data && (len > 0)) {
+ plist_dict_insert_item(dict, "RootTicketData", plist_new_data(data, (uint64_t)len));
+ } else {
+ info("NOTE: not sending RootTicketData (no data present)\n");
+ }
+
+ restore_error = restored_send(restore, dict);
+ if (restore_error != RESTORE_E_SUCCESS) {
+ error("ERROR: Unable to send RootTicket (%d)\n", restore_error);
+ plist_free(dict);
+ return -1;
+ }
+
+ info("Done sending RootTicket\n");
+ plist_free(dict);
+ free(data);
+ return 0;
+}
+
int restore_send_kernelcache(restored_client_t restore, struct idevicerestore_client_t* client, plist_t build_identity) {
int size = 0;
char* data = NULL;
@@ -622,6 +659,14 @@ int restore_handle_data_request_msg(struct idevicerestore_client_t* client, idev
}
}
+ // send RootTicket (== APTicket from the TSS request)
+ else if (!strcmp(type, "RootTicket")) {
+ if (restore_send_root_ticket(restore, client) < 0) {
+ error("ERROR: Unable to send RootTicket\n");
+ return -1;
+ }
+ }
+ // send KernelCache
else if (!strcmp(type, "KernelCache")) {
if(restore_send_kernelcache(restore, client, build_identity) < 0) {
error("ERROR: Unable to send kernelcache\n");