diff options
author | Martin Szulecki | 2013-11-18 18:17:31 +0100 |
---|---|---|
committer | Martin Szulecki | 2013-11-18 18:17:31 +0100 |
commit | 8407a14a1884c386cf5277dec53ecb067c34fac2 (patch) | |
tree | 288b2ffe52f51b878335b2aac3d591329a3abedc /src/normal.c | |
parent | e12bd5fc5c9b59e01288dbf0e8e1edc32aa03bf0 (diff) | |
download | idevicerestore-8407a14a1884c386cf5277dec53ecb067c34fac2.tar.gz idevicerestore-8407a14a1884c386cf5277dec53ecb067c34fac2.tar.bz2 |
normal: Split normal_get_nonce() into ApNonce and SEPNonce getters
Diffstat (limited to 'src/normal.c')
-rw-r--r-- | src/normal.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/normal.c b/src/normal.c index 2c31b4e..b7f0f45 100644 --- a/src/normal.c +++ b/src/normal.c @@ -336,7 +336,7 @@ int normal_enter_recovery(struct idevicerestore_client_t* client) { return 0; } -int normal_get_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size) { +static normal_get_nonce_by_key(struct idevicerestore_client_t* client, const char* key, unsigned char** nonce, int* nonce_size) { idevice_t device = NULL; plist_t nonce_node = NULL; lockdownd_client_t lockdown = NULL; @@ -355,16 +355,16 @@ int normal_get_nonce(struct idevicerestore_client_t* client, unsigned char** non return -1; } - lockdown_error = lockdownd_get_value(lockdown, NULL, "ApNonce", &nonce_node); + lockdown_error = lockdownd_get_value(lockdown, NULL, key, &nonce_node); if (lockdown_error != LOCKDOWN_E_SUCCESS) { - error("ERROR: Unable to get ApNonce from lockdownd\n"); + error("ERROR: Unable to get %s from lockdownd\n", key); lockdownd_client_free(lockdown); idevice_free(device); return -1; } if (!nonce_node || plist_get_node_type(nonce_node) != PLIST_DATA) { - error("ERROR: Unable to get nonce\n"); + error("ERROR: Unable to get %s\n", key); lockdownd_client_free(lockdown); idevice_free(device); return -1; @@ -379,9 +379,18 @@ int normal_get_nonce(struct idevicerestore_client_t* client, unsigned char** non idevice_free(device); lockdown = NULL; device = NULL; + return 0; } +int normal_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size) { + return normal_get_nonce_by_key(client, "ApNonce", nonce, nonce_size); +} + +int normal_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size) { + return normal_get_nonce_by_key(client, "SEPNonce", nonce, nonce_size); +} + int normal_get_cpid(struct idevicerestore_client_t* client, uint32_t* cpid) { return 0; } |