From 641d5ddcae673f8511578258f8ab5b5f0add90dc Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 19 Nov 2013 22:39:32 +0100 Subject: tss: Make ApNonce parameter optional to fix restore on iPhone 3GS and older --- src/idevicerestore.c | 4 +++- src/tss.c | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 3b35ba8..c1c91ac 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -1409,7 +1409,9 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident /* populate parameters */ plist_t parameters = plist_new_dict(); plist_dict_insert_item(parameters, "ApECID", plist_new_uint(client->ecid)); - plist_dict_insert_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size)); + if (client->nonce) { + plist_dict_insert_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size)); + } plist_dict_insert_item(parameters, "ApProductionMode", plist_new_bool(1)); /* create basic request */ diff --git a/src/tss.c b/src/tss.c index 3b0d478..66e09ce 100644 --- a/src/tss.c +++ b/src/tss.c @@ -134,12 +134,14 @@ int tss_request_add_ap_img3_tags(plist_t request, plist_t parameters) { /* ApNonce */ node = plist_dict_get_item(parameters, "ApNonce"); - if (!node || plist_get_node_type(node) != PLIST_DATA) { - error("ERROR: Unable to find required ApNonce in parameters\n"); - return -1; + if (node) { + if (plist_get_node_type(node) != PLIST_DATA) { + error("ERROR: Unable to find required ApNonce in parameters\n"); + return -1; + } + plist_dict_insert_item(request, "ApNonce", plist_copy(node)); + node = NULL; } - plist_dict_insert_item(request, "ApNonce", plist_copy(node)); - node = NULL; /* @APTicket */ plist_dict_insert_item(request, "@APTicket", plist_new_bool(1)); -- cgit v1.1-32-gdbae