summaryrefslogtreecommitdiffstats
path: root/src/dfu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dfu.c')
-rw-r--r--src/dfu.c33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/dfu.c b/src/dfu.c
index 5cea9ad..df9379e 100644
--- a/src/dfu.c
+++ b/src/dfu.c
@@ -231,11 +231,13 @@ int dfu_get_cpid(struct idevicerestore_client_t* client, unsigned int* cpid) {
}
}
- dfu_error = irecv_get_cpid(client->dfu->client, cpid);
- if (dfu_error != IRECV_E_SUCCESS) {
+ const struct irecv_device_info *device_info = irecv_get_device_info(client->dfu->client);
+ if (!device_info) {
return -1;
}
+ *cpid = device_info->cpid;
+
return 0;
}
@@ -248,11 +250,21 @@ int dfu_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** non
}
}
- dfu_error = irecv_get_nonce_with_tag(client->dfu->client, "NONC", nonce, nonce_size);
- if (dfu_error != IRECV_E_SUCCESS) {
+
+ const struct irecv_device_info *device_info = irecv_get_device_info(client->dfu->client);
+ if (!device_info) {
return -1;
}
+ if (device_info->ap_nonce && device_info->ap_nonce_size > 0) {
+ *nonce = (unsigned char*)malloc(device_info->ap_nonce_size);
+ if (!*nonce) {
+ return -1;
+ }
+ *nonce_size = device_info->ap_nonce_size;
+ memcpy(*nonce, device_info->ap_nonce, *nonce_size);
+ }
+
return 0;
}
@@ -265,11 +277,20 @@ int dfu_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** no
}
}
- dfu_error = irecv_get_nonce_with_tag(client->dfu->client, "SNON", nonce, nonce_size);
- if (dfu_error != IRECV_E_SUCCESS) {
+ const struct irecv_device_info *device_info = irecv_get_device_info(client->dfu->client);
+ if (!device_info) {
return -1;
}
+ if (device_info->sep_nonce && device_info->sep_nonce_size > 0) {
+ *nonce = (unsigned char*)malloc(device_info->sep_nonce_size);
+ if (!*nonce) {
+ return -1;
+ }
+ *nonce_size = device_info->sep_nonce_size;
+ memcpy(*nonce, device_info->sep_nonce, *nonce_size);
+ }
+
return 0;
}