summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-11-20 11:31:43 +0100
committerGravatar Nikias Bassen2013-11-20 11:31:43 +0100
commitf034c26e87e59b96877e7434ac0757d1569906d8 (patch)
treec401ab41961b9392ccbe01ff77837ab0e5b64cfd
parent89e446d5257653cde730d493b81f9fb85077223d (diff)
downloadidevicerestore-f034c26e87e59b96877e7434ac0757d1569906d8.tar.gz
idevicerestore-f034c26e87e59b96877e7434ac0757d1569906d8.tar.bz2
get_tss_response: set required parameters for Image4 TSS request
-rw-r--r--src/idevicerestore.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 9ee8a8b..c47e805 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -1412,7 +1412,18 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident
if (client->nonce) {
plist_dict_insert_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size));
}
+ unsigned char* sep_nonce = NULL;
+ int sep_nonce_size = 0;
+ get_sep_nonce(client, &sep_nonce, &sep_nonce_size);
+
+ if (sep_nonce) {
+ plist_dict_insert_item(parameters, "ApSepNonce", plist_new_data((const char*)sep_nonce, sep_nonce_size));
+ }
+
plist_dict_insert_item(parameters, "ApProductionMode", plist_new_bool(1));
+ if (client->image4supported) {
+ plist_dict_insert_item(parameters, "ApSecurityMode", plist_new_bool(1));
+ }
/* create basic request */
request = tss_request_new(NULL);
@@ -1430,13 +1441,23 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident
return -1;
}
- /* add personalized parameters */
- if (tss_request_add_ap_img3_tags(request, parameters) < 0) {
- error("ERROR: Unable to create TSS request\n");
- plist_free(request);
- plist_free(parameters);
- return -1;
- };
+ if (client->image4supported) {
+ /* add personalized parameters */
+ if (tss_request_add_ap_img4_tags(request, parameters) < 0) {
+ error("ERROR: Unable to create TSS request\n");
+ plist_free(request);
+ plist_free(parameters);
+ return -1;
+ }
+ } else {
+ /* add personalized parameters */
+ if (tss_request_add_ap_img3_tags(request, parameters) < 0) {
+ error("ERROR: Unable to create TSS request\n");
+ plist_free(request);
+ plist_free(parameters);
+ return -1;
+ }
+ }
/* send request and grab response */
response = tss_request_send(request, client->tss_url);