summaryrefslogtreecommitdiffstats
path: root/src/dfu.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2013-11-18 22:51:28 +0100
committerGravatar Martin Szulecki2013-11-18 22:51:28 +0100
commit78a239bf2c64c9e37c21b2ddabbc0d76ec599afb (patch)
tree46597ee9b86be20f315d6b271fbd79ccdc835594 /src/dfu.c
parent5a6dcf255deb905e23fbedbb6dcd1e3eeabd5825 (diff)
downloadidevicerestore-78a239bf2c64c9e37c21b2ddabbc0d76ec599afb.tar.gz
idevicerestore-78a239bf2c64c9e37c21b2ddabbc0d76ec599afb.tar.bz2
Split nonce retrieval into ApNonce and SepNonce for DFU and Recovery modes
Diffstat (limited to 'src/dfu.c')
-rw-r--r--src/dfu.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/dfu.c b/src/dfu.c
index 9393fe8..5cea9ad 100644
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -239,7 +239,7 @@ int dfu_get_cpid(struct idevicerestore_client_t* client, unsigned int* cpid) {
return 0;
}
-int dfu_get_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size) {
+int dfu_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size) {
irecv_error_t dfu_error = IRECV_E_SUCCESS;
if(client->dfu == NULL) {
@@ -248,7 +248,24 @@ int dfu_get_nonce(struct idevicerestore_client_t* client, unsigned char** nonce,
}
}
- dfu_error = irecv_get_nonce(client->dfu->client, nonce, nonce_size);
+ dfu_error = irecv_get_nonce_with_tag(client->dfu->client, "NONC", nonce, nonce_size);
+ if (dfu_error != IRECV_E_SUCCESS) {
+ return -1;
+ }
+
+ return 0;
+}
+
+int dfu_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size) {
+ irecv_error_t dfu_error = IRECV_E_SUCCESS;
+
+ if(client->dfu == NULL) {
+ if (dfu_client_new(client) < 0) {
+ return -1;
+ }
+ }
+
+ dfu_error = irecv_get_nonce_with_tag(client->dfu->client, "SNON", nonce, nonce_size);
if (dfu_error != IRECV_E_SUCCESS) {
return -1;
}
@@ -300,8 +317,8 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide
unsigned char* nonce = NULL;
int nonce_size = 0;
int nonce_changed = 0;
- if (dfu_get_nonce(client, &nonce, &nonce_size) < 0) {
- error("ERROR: Unable to get nonce from device!\n");
+ if (dfu_get_ap_nonce(client, &nonce, &nonce_size) < 0) {
+ error("ERROR: Unable to get ApNonce from device!\n");
return -1;
}