diff options
author | Nikias Bassen | 2012-02-02 10:39:08 +0100 |
---|---|---|
committer | Nikias Bassen | 2012-02-02 10:39:08 +0100 |
commit | 0f1764d69aad6befec56de7ecd221a413ed363db (patch) | |
tree | e100d4495b839bb5802baec14100277ff23ac248 | |
parent | 78416a40c8d9b6e54c345959d0afdaa17e245472 (diff) | |
download | idevicerestore-0f1764d69aad6befec56de7ecd221a413ed363db.tar.gz idevicerestore-0f1764d69aad6befec56de7ecd221a413ed363db.tar.bz2 |
tss: add tss_get_ticket() function
-rw-r--r-- | src/tss.c | 23 | ||||
-rw-r--r-- | src/tss.h | 1 |
2 files changed, 22 insertions, 2 deletions
@@ -206,7 +206,7 @@ plist_t tss_send_request(plist_t tss_request) { error("ERROR: TSS request failed\n"); if (response->length > 0) { error("TSS server returned: %s\n", response->content); - } + } free(response->content); free(response); return NULL; @@ -234,6 +234,25 @@ plist_t tss_send_request(plist_t tss_request) { return tss_response; } +int tss_get_ticket(plist_t tss, unsigned char** ticket, uint32_t* tlen) { + plist_t entry_node = plist_dict_get_item(tss, "APTicket"); + if (!entry_node || plist_get_node_type(entry_node) != PLIST_DATA) { + error("ERROR: Unable to find APTicket entry in TSS response\n"); + return -1; + } + char *data = NULL; + uint64_t len = 0; + plist_get_data_val(entry_node, &data, &len); + if (data) { + *tlen = (uint32_t)len; + *ticket = data; + return 0; + } else { + error("ERROR: Unable to get APTicket data from TSS response\n"); + return -1; + } +} + int tss_get_entry_path(plist_t tss, const char* entry, char** path) { char* path_string = NULL; plist_t path_node = NULL; @@ -249,7 +268,7 @@ int tss_get_entry_path(plist_t tss, const char* entry, char** path) { path_node = plist_dict_get_item(entry_node, "Path"); if (!path_node || plist_get_node_type(path_node) != PLIST_STRING) { - error("ERROR: Unable to find %s path in entry\n", path_string); + debug("NOTE: Unable to find %s path in TSS entry\n", entry); return -1; } plist_get_string_val(path_node, &path_string); @@ -30,6 +30,7 @@ extern "C" { plist_t tss_send_request(plist_t request); plist_t tss_create_request(plist_t build_identity, uint64_t ecid, unsigned char* nonce, int nonce_size); +int tss_get_ticket(plist_t tss, unsigned char** ticket, uint32_t* tlen); int tss_get_entry_path(plist_t tss, const char* entry, char** path); int tss_get_blob_by_path(plist_t tss, const char* path, char** blob); int tss_get_blob_by_name(plist_t tss, const char* entry, char** blob); |