summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2013-11-19 21:39:10 +0100
committerGravatar Nikias Bassen2013-11-19 21:39:10 +0100
commit7308198824b795d15ea8d2f2b67ab03b8d7bbb57 (patch)
tree41ed8c70cf7535ff4ad8498d6b0aa49c7500a366
parent3f8dea9bd12c4b4c52224b1a84835fa56df53fb2 (diff)
downloadidevicerestore-7308198824b795d15ea8d2f2b67ab03b8d7bbb57.tar.gz
idevicerestore-7308198824b795d15ea8d2f2b67ab03b8d7bbb57.tar.bz2
add get_sep_nonce helper function
-rw-r--r--src/idevicerestore.c43
-rw-r--r--src/idevicerestore.h1
2 files changed, 44 insertions, 0 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index a0f5a87..c799bc6 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -1274,6 +1274,49 @@ int get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce,
return 0;
}
+int get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size) {
+ *nonce = NULL;
+ *nonce_size = 0;
+
+ info("Getting SepNonce ");
+
+ switch (client->mode->index) {
+ case MODE_NORMAL:
+ info("in normal mode... ");
+ if (normal_get_sep_nonce(client, nonce, nonce_size) < 0) {
+ info("failed\n");
+ return -1;
+ }
+ break;
+ case MODE_DFU:
+ info("in dfu mode... ");
+ if (dfu_get_sep_nonce(client, nonce, nonce_size) < 0) {
+ info("failed\n");
+ return -1;
+ }
+ break;
+ case MODE_RECOVERY:
+ info("in recovery mode... ");
+ if (recovery_get_sep_nonce(client, nonce, nonce_size) < 0) {
+ info("failed\n");
+ return -1;
+ }
+ break;
+
+ default:
+ error("ERROR: Device is in an invalid state\n");
+ return -1;
+ }
+
+ int i = 0;
+ for (i = 0; i < *nonce_size; i++) {
+ info("%02x ", (*nonce)[i]);
+ }
+ info("\n");
+
+ return 0;
+}
+
plist_t build_manifest_get_build_identity(plist_t build_manifest, uint32_t identity) {
// fetch build identities array from BuildManifest
plist_t build_identities_array = plist_dict_get_item(build_manifest, "BuildIdentities");
diff --git a/src/idevicerestore.h b/src/idevicerestore.h
index f646d4a..742d7f9 100644
--- a/src/idevicerestore.h
+++ b/src/idevicerestore.h
@@ -77,6 +77,7 @@ const char* check_product_type(struct idevicerestore_client_t* client);
int get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid);
int is_image4_supported(struct idevicerestore_client_t* client);
int get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
+int get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int get_shsh_blobs(struct idevicerestore_client_t* client, plist_t build_identity, plist_t* tss);
void fixup_tss(plist_t tss);
int build_manifest_get_identity_count(plist_t build_manifest);