diff options
| author | 2012-09-26 13:04:38 +0200 | |
|---|---|---|
| committer | 2012-11-07 22:25:24 +0100 | |
| commit | 4dbd4c210e6a78216fdd0339c5a5e1850c1e3e58 (patch) | |
| tree | f0787a37076e6c2c73cefca40e58abdfab514e32 /src | |
| parent | 448c022bf009a42f63783ca0f4310fd143118f11 (diff) | |
| download | idevicerestore-4dbd4c210e6a78216fdd0339c5a5e1850c1e3e58.tar.gz idevicerestore-4dbd4c210e6a78216fdd0339c5a5e1850c1e3e58.tar.bz2 | |
idevicerestore: Move nonce reporting into get_nonce() to avoid code duplication
Diffstat (limited to 'src')
| -rw-r--r-- | src/idevicerestore.c | 29 | 
1 files changed, 14 insertions, 15 deletions
| diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 1bdd769..d22b36a 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -555,13 +555,6 @@ int idevicerestore_start(struct idevicerestore_client_t* client)  			} 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) { @@ -815,13 +808,6 @@ int idevicerestore_start(struct idevicerestore_client_t* client)  			free(nonce);  		} -		info("Nonce: "); -		int i; -		for (i = 0; i < client->nonce_size; i++) { -			info("%02x ", client->nonce[i]); -		} -		info("\n"); -  		if (nonce_changed && !(client->flags & FLAG_CUSTOM)) {  			// Welcome iOS5. We have to re-request the TSS with our nonce.  			plist_free(client->tss); @@ -1417,19 +1403,27 @@ int get_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int  	*nonce = NULL;  	*nonce_size = 0; +	info("Getting nonce "); +  	switch (client->mode->index) {  	case MODE_NORMAL: +		info("in normal mode... ");  		if (normal_get_nonce(client, nonce, nonce_size) < 0) { +			info("failed\n");  			return -1;  		}  		break;  	case MODE_DFU: +		info("in dfu mode... ");  		if (dfu_get_nonce(client, nonce, nonce_size) < 0) { +			info("failed\n");  			return -1;  		}  		break;  	case MODE_RECOVERY: +		info("in recovery mode... ");  		if (recovery_get_nonce(client, nonce, nonce_size) < 0) { +			info("failed\n");  			return -1;  		}  		break; @@ -1439,10 +1433,15 @@ int get_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int  		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"); | 
