From 482268c18b1f45364ea505a687704586f4f1017b Mon Sep 17 00:00:00 2001
From: Nikias Bassen
Date: Thu, 2 Feb 2012 20:17:37 +0100
Subject: recovery: add recovery_get_nonce() function

---
 src/recovery.c | 17 +++++++++++++++++
 src/recovery.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/src/recovery.c b/src/recovery.c
index dd544c1..51d2d1a 100644
--- a/src/recovery.c
+++ b/src/recovery.c
@@ -383,6 +383,23 @@ int recovery_get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid) {
 	return 0;
 }
 
+int recovery_get_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size) {
+	irecv_error_t recovery_error = IRECV_E_SUCCESS;
+
+	if(client->recovery == NULL) {
+		if (recovery_client_new(client) < 0) {
+			return -1;
+		}
+	}
+
+	recovery_error = irecv_get_nonce(client->recovery->client, nonce, nonce_size);
+	if (recovery_error != IRECV_E_SUCCESS) {
+		return -1;
+	}
+
+	return 0;
+}
+
 int recovery_get_cpid(struct idevicerestore_client_t* client, uint32_t* cpid) {
 	irecv_error_t recovery_error = IRECV_E_SUCCESS;
 
diff --git a/src/recovery.h b/src/recovery.h
index 118ed4f..9018351 100644
--- a/src/recovery.h
+++ b/src/recovery.h
@@ -51,6 +51,7 @@ int recovery_send_devicetree(struct idevicerestore_client_t* client, plist_t bui
 int recovery_send_ramdisk(struct idevicerestore_client_t* client, plist_t build_identity);
 int recovery_send_kernelcache(struct idevicerestore_client_t* client, plist_t build_identity);
 int recovery_get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid);
+int recovery_get_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
 int recovery_get_cpid(struct idevicerestore_client_t* client, uint32_t* cpid);
 int recovery_get_bdid(struct idevicerestore_client_t* client, uint32_t* bdid);
 
-- 
cgit v1.1-32-gdbae