diff options
author | Martin Szulecki | 2012-09-20 22:10:04 +0200 |
---|---|---|
committer | Martin Szulecki | 2012-11-07 22:24:00 +0100 |
commit | 7015910f621eabce5a4b2d2105b74ac301aefd7b (patch) | |
tree | c785e4419277efbfe168cd8ca9f50df1d36814c5 /src/idevicerestore.c | |
parent | eaa265ea5eb45ab2a8b8aad6e756e083b1aef23c (diff) | |
download | idevicerestore-7015910f621eabce5a4b2d2105b74ac301aefd7b.tar.gz idevicerestore-7015910f621eabce5a4b2d2105b74ac301aefd7b.tar.bz2 |
idevicerestore: Attempt to get nonce from device early on
Diffstat (limited to 'src/idevicerestore.c')
-rw-r--r-- | src/idevicerestore.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 42a1faf..76a9521 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -536,7 +536,35 @@ int idevicerestore_start(struct idevicerestore_client_t* client) } info("Found ECID " FMT_qu "\n", (long long unsigned int)client->ecid); - if (get_shsh_blobs(client, client->ecid, NULL, 0, build_identity, &client->tss) < 0) { + if (client->build_major > 8) { + unsigned char* nonce = NULL; + int nonce_size = 0; + int nonce_changed = 0; + if (get_nonce(client, &nonce, &nonce_size) < 0) { + error("ERROR: Unable to get nonce from device!\n"); + return -2; + } + + if (!client->nonce || (nonce_size != client->nonce_size) || (memcmp(nonce, client->nonce, nonce_size) != 0)) { + nonce_changed = 1; + if (client->nonce) { + free(client->nonce); + } + client->nonce = nonce; + client->nonce_size = nonce_size; + } else { + free(nonce); + } + + info("Nonce: "); + int i; + for (i = 0; i < client->nonce_size; i++) { + info("%02x ", client->nonce[i]); + } + info("\n"); + } + + if (get_shsh_blobs(client, client->ecid, client->nonce, client->nonce_size, build_identity, &client->tss) < 0) { error("ERROR: Unable to get SHSH blobs for this device\n"); return -1; } |