From f61d7a2fcc388e74a0a01c08ef5abd31c456e54a Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 2 Feb 2012 19:53:32 +0100 Subject: ipsw_get_component_by_path: add 'component' parameter --- src/dfu.c | 2 +- src/idevicerestore.c | 18 +++++++++++++----- src/idevicerestore.h | 2 +- src/recovery.c | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/dfu.c b/src/dfu.c index efe0a40..b044fa6 100644 --- a/src/dfu.c +++ b/src/dfu.c @@ -128,7 +128,7 @@ int dfu_send_component(struct idevicerestore_client_t* client, plist_t build_ide if (client->tss) info("%s will be signed\n", component); - if (ipsw_get_component_by_path(client->ipsw, client->tss, path, &data, &size) < 0) { + if (ipsw_get_component_by_path(client->ipsw, client->tss, component, path, &data, &size) < 0) { error("ERROR: Unable to get component: %s\n", component); free(path); return -1; diff --git a/src/idevicerestore.c b/src/idevicerestore.c index 93c433b..bec855c 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -638,7 +638,7 @@ int ipsw_extract_filesystem(const char* ipsw, plist_t build_identity, char** fil return 0; } -int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* path, char** data, uint32_t* size) { +int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* component, const char* path, char** data, uint32_t* size) { img3_file* img3 = NULL; uint32_t component_size = 0; char* component_data = NULL; @@ -667,10 +667,18 @@ int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* path, free(component_data); /* sign the blob if required */ - if (tss_get_blob_by_path(tss, path, &component_blob) < 0) { - error("ERROR: Unable to get SHSH blob for TSS %s entry\n", component_name); - img3_free(img3); - return -1; + if (component) { + if (tss_get_blob_by_name(tss, component, &component_blob) < 0) { + error("ERROR: Unable to get SHSH blob for TSS %s entry\n", component_name); + img3_free(img3); + return -1; + } + } else { + if (tss_get_blob_by_path(tss, path, &component_blob) < 0) { + error("ERROR: Unable to get SHSH blob for TSS %s entry\n", component_name); + img3_free(img3); + return -1; + } } info("Signing %s\n", component_name); diff --git a/src/idevicerestore.h b/src/idevicerestore.h index 34d967c..a83ac5c 100644 --- a/src/idevicerestore.h +++ b/src/idevicerestore.h @@ -45,7 +45,7 @@ int build_manifest_get_build_count(plist_t build_manifest); void build_identity_print_information(plist_t build_identity); int build_identity_get_component_path(plist_t build_identity, const char* component, char** path); int ipsw_extract_filesystem(const char* ipsw, plist_t build_identity, char** filesystem); -int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* path, char** data, uint32_t* size); +int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* component, const char* path, char** data, uint32_t* size); #ifdef __cplusplus } diff --git a/src/recovery.c b/src/recovery.c index 624279d..e2e07b7 100644 --- a/src/recovery.c +++ b/src/recovery.c @@ -215,7 +215,7 @@ int recovery_send_component(struct idevicerestore_client_t* client, plist_t buil if (client->tss) info("%s will be signed\n", component); - if (ipsw_get_component_by_path(client->ipsw, client->tss, path, &data, &size) < 0) { + if (ipsw_get_component_by_path(client->ipsw, client->tss, component, path, &data, &size) < 0) { error("ERROR: Unable to get component: %s\n", component); free(path); return -1; -- cgit v1.1-32-gdbae