From d37b4c3740acfbfda28b334498d01fd56be0ff38 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Wed, 2 Oct 2013 17:19:30 +0200 Subject: tss: make sure buffers are of type unsigned char* --- src/restore.c | 16 ++++++++-------- src/tss.c | 20 ++++++++++---------- src/tss.h | 6 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/restore.c b/src/restore.c index d9694c0..1a01582 100644 --- a/src/restore.c +++ b/src/restore.c @@ -728,7 +728,7 @@ int restore_send_root_ticket(restored_client_t restore, struct idevicerestore_cl restored_error_t restore_error; plist_t dict; unsigned char* data = NULL; - uint32_t len = 0; + unsigned int len = 0; info("About to send RootTicket...\n"); @@ -744,7 +744,7 @@ int restore_send_root_ticket(restored_client_t restore, struct idevicerestore_cl dict = plist_new_dict(); if (data && (len > 0)) { - plist_dict_insert_item(dict, "RootTicketData", plist_new_data(data, (uint64_t)len)); + plist_dict_insert_item(dict, "RootTicketData", plist_new_data((char*)data, len)); } else { info("NOTE: not sending RootTicketData (no data present)\n"); } @@ -764,7 +764,7 @@ int restore_send_root_ticket(restored_client_t restore, struct idevicerestore_cl } int restore_send_kernelcache(restored_client_t restore, struct idevicerestore_client_t* client, plist_t build_identity) { - int size = 0; + unsigned int size = 0; char* data = NULL; char* path = NULL; plist_t blob = NULL; @@ -815,14 +815,14 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* char* llb_filename = NULL; char firmware_path[256]; char manifest_file[256]; - int manifest_size = 0; + unsigned int manifest_size = 0; char* manifest_data = NULL; char firmware_filename[256]; - int llb_size = 0; + unsigned int llb_size = 0; char* llb_data = NULL; plist_t dict = NULL; char* filename = NULL; - int nor_size = 0; + unsigned int nor_size = 0; char* nor_data = NULL; plist_t norimage_array = NULL; restored_error_t ret = RESTORE_E_SUCCESS; @@ -944,7 +944,7 @@ static const char* restore_get_bbfw_fn_for_element(const char* elem) return NULL; } -static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const char* bb_nonce) +static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const unsigned char* bb_nonce) { int res = -1; @@ -1383,7 +1383,7 @@ int restore_send_baseband_data(restored_client_t restore, struct idevicerestore_ res = -1; - unsigned char* buffer = NULL; + char* buffer = NULL; size_t sz = 0; if (read_file(bbfwtmp, (void**)&buffer, &sz) < 0) { error("ERROR: could not read updated bbfw archive\n"); diff --git a/src/tss.c b/src/tss.c index ed18561..b6a0260 100644 --- a/src/tss.c +++ b/src/tss.c @@ -111,7 +111,7 @@ plist_t tss_create_request(plist_t build_identity, uint64_t ecid, unsigned char* plist_dict_insert_item(tss_request, "ApChipID", plist_new_uint(chip_id)); plist_dict_insert_item(tss_request, "ApECID", plist_new_string(ecid_string)); if (nonce && (nonce_size > 0)) { - plist_dict_insert_item(tss_request, "ApNonce", plist_new_data(nonce, nonce_size)); + plist_dict_insert_item(tss_request, "ApNonce", plist_new_data((char*)nonce, nonce_size)); } plist_dict_insert_item(tss_request, "ApProductionMode", plist_new_bool(1)); plist_dict_insert_item(tss_request, "ApSecurityDomain", plist_new_uint(security_domain)); @@ -279,7 +279,7 @@ plist_t tss_create_baseband_request(plist_t build_identity, uint64_t ecid, uint6 plist_dict_insert_item(tss_request, "BbGoldCertId", plist_new_uint(bb_cert_id)); if (bb_nonce && (bb_nonce_size > 0)) { - plist_dict_insert_item(tss_request, "BbNonce", plist_new_data(bb_nonce, bb_nonce_size)); + plist_dict_insert_item(tss_request, "BbNonce", plist_new_data((char*)bb_nonce, bb_nonce_size)); } bb_node = plist_dict_get_item(build_identity, "BbProvisioningManifestKeyHash"); @@ -291,7 +291,7 @@ plist_t tss_create_baseband_request(plist_t build_identity, uint64_t ecid, uint6 bb_node = NULL; if (bb_snum && bb_snum_size > 0) { - plist_dict_insert_item(tss_request, "BbSNUM", plist_new_data(bb_snum, bb_snum_size)); + plist_dict_insert_item(tss_request, "BbSNUM", plist_new_data((char*)bb_snum, bb_snum_size)); } plist_dict_insert_item(tss_request, "UniqueBuildID", plist_new_data(unique_build_data, unique_build_size)); @@ -462,7 +462,7 @@ plist_t tss_send_request(plist_t tss_request, const char* server_url_string) { return tss_response; } -int tss_get_ticket(plist_t tss, unsigned char** ticket, uint32_t* tlen) { +int tss_get_ticket(plist_t tss, unsigned char** ticket, unsigned int* 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"); @@ -472,8 +472,8 @@ int tss_get_ticket(plist_t tss, unsigned char** ticket, uint32_t* tlen) { uint64_t len = 0; plist_get_data_val(entry_node, &data, &len); if (data) { - *tlen = (uint32_t)len; - *ticket = data; + *tlen = (unsigned int)len; + *ticket = (unsigned char*)data; return 0; } else { error("ERROR: Unable to get APTicket data from TSS response\n"); @@ -505,7 +505,7 @@ int tss_get_entry_path(plist_t tss, const char* entry, char** path) { return 0; } -int tss_get_blob_by_path(plist_t tss, const char* path, char** blob) { +int tss_get_blob_by_path(plist_t tss, const char* path, unsigned char** blob) { int i = 0; uint32_t tss_size = 0; uint64_t blob_size = 0; @@ -554,11 +554,11 @@ int tss_get_blob_by_path(plist_t tss, const char* path, char** blob) { return -1; } - *blob = blob_data; + *blob = (unsigned char*)blob_data; return 0; } -int tss_get_blob_by_name(plist_t tss, const char* entry, char** blob) { +int tss_get_blob_by_name(plist_t tss, const char* entry, unsigned char** blob) { uint64_t blob_size = 0; char* blob_data = NULL; plist_t blob_node = NULL; @@ -579,6 +579,6 @@ int tss_get_blob_by_name(plist_t tss, const char* entry, char** blob) { } plist_get_data_val(blob_node, &blob_data, &blob_size); - *blob = blob_data; + *blob = (unsigned char*)blob_data; return 0; } diff --git a/src/tss.h b/src/tss.h index 77958d4..b5b322a 100644 --- a/src/tss.h +++ b/src/tss.h @@ -32,10 +32,10 @@ extern "C" { plist_t tss_send_request(plist_t request, const char* server_url_string); plist_t tss_create_request(plist_t build_identity, uint64_t ecid, unsigned char* nonce, int nonce_size); plist_t tss_create_baseband_request(plist_t build_identity, uint64_t ecid, uint64_t bb_cert_id, unsigned char* bb_snum, uint64_t bb_snum_size, unsigned char* bb_nonce, int bb_nonce_size); -int tss_get_ticket(plist_t tss, unsigned char** ticket, uint32_t* tlen); +int tss_get_ticket(plist_t tss, unsigned char** ticket, unsigned int* 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); +int tss_get_blob_by_path(plist_t tss, const char* path, unsigned char** blob); +int tss_get_blob_by_name(plist_t tss, const char* entry, unsigned char** blob); #ifdef __cplusplus -- cgit v1.1-32-gdbae