From e6d8c0b9d53e5f3c9100cfc8c88626be45c98b85 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 5 May 2024 04:01:12 +0200 Subject: Updated to use libplist 2.5.0 API --- src/ace3.c | 2 +- src/common.c | 139 ------------------ src/common.h | 8 -- src/idevicerestore.c | 56 ++++---- src/img4.c | 18 +-- src/normal.c | 12 +- src/restore.c | 88 ++++++------ src/tss.c | 392 +++++++++++++++++++++++++-------------------------- 8 files changed, 284 insertions(+), 431 deletions(-) (limited to 'src') diff --git a/src/ace3.c b/src/ace3.c index b96e6b4..d280196 100644 --- a/src/ace3.c +++ b/src/ace3.c @@ -96,7 +96,7 @@ int ace3_create_binary(const unsigned char* uarp_fw, size_t uarp_size, uint64_t plist_t p_im4m = plist_dict_get_item(tss, "USBPortController1,Ticket"); uint64_t im4m_size = 0; - const char* im4m = plist_get_data_ptr(p_im4m, &im4m_size); + const uint8_t* im4m = plist_get_data_ptr(p_im4m, &im4m_size); struct uarp_header* uarp_hdr = (struct uarp_header*)uarp_fw; uint32_t uarp_hdr_size = be32toh(uarp_hdr->header_size); diff --git a/src/common.c b/src/common.c index 499509d..e5ee07b 100644 --- a/src/common.c +++ b/src/common.c @@ -558,145 +558,6 @@ void get_user_input(char *buf, int maxlen, int secure) buf[len] = 0; } -uint64_t _plist_dict_get_uint(plist_t dict, const char *key) -{ - uint64_t uintval = 0; - char *strval = NULL; - uint64_t strsz = 0; - plist_t node = plist_dict_get_item(dict, key); - if (!node) { - return uintval; - } - switch (plist_get_node_type(node)) { - case PLIST_UINT: - plist_get_uint_val(node, &uintval); - break; - case PLIST_STRING: - plist_get_string_val(node, &strval); - if (strval) { - uintval = strtoull(strval, NULL, 0); - free(strval); - } - break; - case PLIST_DATA: - plist_get_data_val(node, &strval, &strsz); - if (strval) { - if (strsz == 8) { - uintval = le64toh(*(uint64_t*)strval); - } else if (strsz == 4) { - uintval = le32toh(*(uint32_t*)strval); - } else if (strsz == 2) { - uintval = le16toh(*(uint16_t*)strval); - } else if (strsz == 1) { - uintval = strval[0]; - } else { - error("%s: ERROR: invalid size %" PRIu64 " for data to integer conversion\n", __func__, strsz); - } - free(strval); - } - break; - default: - break; - } - return uintval; -} - -uint8_t _plist_dict_get_bool(plist_t dict, const char *key) -{ - uint8_t bval = 0; - uint64_t uintval = 0; - char *strval = NULL; - uint64_t strsz = 0; - plist_t node = plist_dict_get_item(dict, key); - if (!node) { - return 0; - } - switch (plist_get_node_type(node)) { - case PLIST_BOOLEAN: - plist_get_bool_val(node, &bval); - break; - case PLIST_UINT: - plist_get_uint_val(node, &uintval); - bval = (uint8_t)uintval; - break; - case PLIST_STRING: - plist_get_string_val(node, &strval); - if (strval) { - if (strcmp(strval, "true")) { - bval = 1; - } else if (strcmp(strval, "false")) { - bval = 0; - } - free(strval); - } - break; - case PLIST_DATA: - plist_get_data_val(node, &strval, &strsz); - if (strval) { - if (strsz == 1) { - bval = strval[0]; - } else { - error("%s: ERROR: invalid size %" PRIu64 " for data to boolean conversion\n", __func__, strsz); - } - free(strval); - } - break; - default: - break; - } - return bval; -} - -int _plist_dict_copy_uint(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key) -{ - if (plist_dict_get_item(source_dict, (alt_source_key) ? alt_source_key : key) == NULL) { - return -1; - } - uint64_t u64val = _plist_dict_get_uint(source_dict, (alt_source_key) ? alt_source_key : key); - plist_dict_set_item(target_dict, key, plist_new_uint(u64val)); - return 0; -} - -int _plist_dict_copy_bool(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key) -{ - if (plist_dict_get_item(source_dict, (alt_source_key) ? alt_source_key : key) == NULL) { - return -1; - } - uint64_t bval = _plist_dict_get_bool(source_dict, (alt_source_key) ? alt_source_key : key); - plist_dict_set_item(target_dict, key, plist_new_bool(bval)); - return 0; -} - -int _plist_dict_copy_data(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key) -{ - plist_t node = plist_dict_get_item(source_dict, (alt_source_key) ? alt_source_key : key); - if (!PLIST_IS_DATA(node)) { - return -1; - } - plist_dict_set_item(target_dict, key, plist_copy(node)); - return 0; -} - -int _plist_dict_copy_string(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key) -{ - plist_t node = plist_dict_get_item(source_dict, (alt_source_key) ? alt_source_key : key); - if (!PLIST_IS_STRING(node)) { - return -1; - } - plist_dict_set_item(target_dict, key, plist_copy(node)); - return 0; -} - -int _plist_dict_copy_item(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key) -{ - plist_t node = plist_dict_get_item(source_dict, (alt_source_key) ? alt_source_key : key); - if (!node) { - return -1; - } - plist_dict_set_item(target_dict, key, plist_copy(node)); - return 0; -} - const char* path_get_basename(const char* path) { #ifdef WIN32 diff --git a/src/common.h b/src/common.h index 9b3c1e3..766a385 100644 --- a/src/common.h +++ b/src/common.h @@ -191,14 +191,6 @@ char* realpath(const char *filename, char *resolved_name); void get_user_input(char *buf, int maxlen, int secure); -uint8_t _plist_dict_get_bool(plist_t dict, const char *key); -uint64_t _plist_dict_get_uint(plist_t dict, const char *key); -int _plist_dict_copy_uint(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key); -int _plist_dict_copy_bool(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key); -int _plist_dict_copy_data(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key); -int _plist_dict_copy_string(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key); -int _plist_dict_copy_item(plist_t target_dict, plist_t source_dict, const char *key, const char *alt_source_key); - const char* path_get_basename(const char* path); #ifdef __cplusplus diff --git a/src/idevicerestore.c b/src/idevicerestore.c index fdb340e..ece455e 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -724,12 +724,12 @@ int idevicerestore_start(struct idevicerestore_client_t* client) return -1; } - unsigned int b_pdfu_cpid = (unsigned int)_plist_dict_get_uint(build_identity, "USBPortController1,ChipID"); + unsigned int b_pdfu_cpid = (unsigned int)plist_dict_get_uint(build_identity, "USBPortController1,ChipID"); if (b_pdfu_cpid != pdfu_cpid) { error("ERROR: cpid 0x%02x doesn't match USBPortController1,ChipID in build identity (0x%02x)\n", pdfu_cpid, b_pdfu_cpid); return -1; } - unsigned int b_pdfu_bdid = (unsigned int)_plist_dict_get_uint(build_identity, "USBPortController1,BoardID"); + unsigned int b_pdfu_bdid = (unsigned int)plist_dict_get_uint(build_identity, "USBPortController1,BoardID"); if (b_pdfu_bdid != pdfu_bdid) { error("ERROR: bdid 0x%x doesn't match USBPortController1,BoardID in build identity (0x%x)\n", pdfu_bdid, b_pdfu_bdid); return -1; @@ -738,9 +738,9 @@ int idevicerestore_start(struct idevicerestore_client_t* client) plist_t parameters = plist_new_dict(); plist_dict_set_item(parameters, "@USBPortController1,Ticket", plist_new_bool(1)); plist_dict_set_item(parameters, "USBPortController1,ECID", plist_new_int(client->ecid)); - _plist_dict_copy_item(parameters, build_identity, "USBPortController1,BoardID", NULL); - _plist_dict_copy_item(parameters, build_identity, "USBPortController1,ChipID", NULL); - _plist_dict_copy_item(parameters, build_identity, "USBPortController1,SecurityDomain", NULL); + plist_dict_copy_item(parameters, build_identity, "USBPortController1,BoardID", NULL); + plist_dict_copy_item(parameters, build_identity, "USBPortController1,ChipID", NULL); + plist_dict_copy_item(parameters, build_identity, "USBPortController1,SecurityDomain", NULL); plist_dict_set_item(parameters, "USBPortController1,SecurityMode", plist_new_bool(1)); plist_dict_set_item(parameters, "USBPortController1,ProductionMode", plist_new_bool(1)); plist_t usbf = plist_access_path(build_identity, 2, "Manifest", "USBPortController1,USBFirmware"); @@ -771,7 +771,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client) usbf = plist_copy(usbf); plist_dict_remove_item(usbf, "Info"); plist_dict_set_item(parameters, "USBPortController1,USBFirmware", usbf); - plist_dict_set_item(parameters, "USBPortController1,Nonce", plist_new_data((const char*)pdfu_nonce, pdfu_nsize)); + plist_dict_set_item(parameters, "USBPortController1,Nonce", plist_new_data(pdfu_nonce, pdfu_nsize)); plist_t request = tss_request_new(NULL); if (request == NULL) { @@ -2263,14 +2263,14 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident plist_t parameters = plist_new_dict(); plist_dict_set_item(parameters, "ApECID", plist_new_uint(client->ecid)); if (client->nonce) { - plist_dict_set_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size)); + plist_dict_set_item(parameters, "ApNonce", plist_new_data(client->nonce, client->nonce_size)); } unsigned char* sep_nonce = NULL; unsigned int sep_nonce_size = 0; get_sep_nonce(client, &sep_nonce, &sep_nonce_size); if (sep_nonce) { - plist_dict_set_item(parameters, "ApSepNonce", plist_new_data((const char*)sep_nonce, sep_nonce_size)); + plist_dict_set_item(parameters, "ApSepNonce", plist_new_data(sep_nonce, sep_nonce_size)); free(sep_nonce); } @@ -2331,20 +2331,20 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident plist_t pinfo = NULL; normal_get_preflight_info(client, &pinfo); if (pinfo) { - _plist_dict_copy_data(parameters, pinfo, "BbNonce", "Nonce"); - _plist_dict_copy_uint(parameters, pinfo, "BbChipID", "ChipID"); - _plist_dict_copy_uint(parameters, pinfo, "BbGoldCertId", "CertID"); - _plist_dict_copy_data(parameters, pinfo, "BbSNUM", "ChipSerialNo"); + plist_dict_copy_data(parameters, pinfo, "BbNonce", "Nonce"); + plist_dict_copy_uint(parameters, pinfo, "BbChipID", "ChipID"); + plist_dict_copy_uint(parameters, pinfo, "BbGoldCertId", "CertID"); + plist_dict_copy_data(parameters, pinfo, "BbSNUM", "ChipSerialNo"); /* add baseband parameters */ tss_request_add_baseband_tags(request, parameters, NULL); - _plist_dict_copy_uint(parameters, pinfo, "eUICC,ChipID", "EUICCChipID"); - if (_plist_dict_get_uint(parameters, "eUICC,ChipID") >= 5) { - _plist_dict_copy_data(parameters, pinfo, "eUICC,EID", "EUICCCSN"); - _plist_dict_copy_data(parameters, pinfo, "eUICC,RootKeyIdentifier", "EUICCCertIdentifier"); - _plist_dict_copy_data(parameters, pinfo, "EUICCGoldNonce", NULL); - _plist_dict_copy_data(parameters, pinfo, "EUICCMainNonce", NULL); + plist_dict_copy_uint(parameters, pinfo, "eUICC,ChipID", "EUICCChipID"); + if (plist_dict_get_uint(parameters, "eUICC,ChipID") >= 5) { + plist_dict_copy_data(parameters, pinfo, "eUICC,EID", "EUICCCSN"); + plist_dict_copy_data(parameters, pinfo, "eUICC,RootKeyIdentifier", "EUICCCertIdentifier"); + plist_dict_copy_data(parameters, pinfo, "EUICCGoldNonce", NULL); + plist_dict_copy_data(parameters, pinfo, "EUICCMainNonce", NULL); /* add vinyl parameters */ tss_request_add_vinyl_tags(request, parameters, NULL); @@ -2387,7 +2387,7 @@ int get_recoveryos_root_ticket_tss_response(struct idevicerestore_client_t* clie /* ApNonce */ if (client->nonce) { - plist_dict_set_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size)); + plist_dict_set_item(parameters, "ApNonce", plist_new_data(client->nonce, client->nonce_size)); } unsigned char* sep_nonce = NULL; unsigned int sep_nonce_size = 0; @@ -2395,7 +2395,7 @@ int get_recoveryos_root_ticket_tss_response(struct idevicerestore_client_t* clie /* ApSepNonce */ if (sep_nonce) { - plist_dict_set_item(parameters, "ApSepNonce", plist_new_data((const char*)sep_nonce, sep_nonce_size)); + plist_dict_set_item(parameters, "ApSepNonce", plist_new_data(sep_nonce, sep_nonce_size)); free(sep_nonce); } @@ -2496,12 +2496,12 @@ int get_recovery_os_local_policy_tss_response( uint8_t digest[SHA384_DIGEST_LENGTH]; SHA384(lpol_file, lpol_file_length, digest); plist_t lpol = plist_new_dict(); - plist_dict_set_item(lpol, "Digest", plist_new_data((char*)digest, SHA384_DIGEST_LENGTH)); + plist_dict_set_item(lpol, "Digest", plist_new_data(digest, SHA384_DIGEST_LENGTH)); plist_dict_set_item(lpol, "Trusted", plist_new_bool(1)); plist_dict_set_item(parameters, "Ap,LocalPolicy", lpol); - _plist_dict_copy_data(parameters, args, "Ap,NextStageIM4MHash", NULL); - _plist_dict_copy_data(parameters, args, "Ap,RecoveryOSPolicyNonceHash", NULL); + plist_dict_copy_data(parameters, args, "Ap,NextStageIM4MHash", NULL); + plist_dict_copy_data(parameters, args, "Ap,RecoveryOSPolicyNonceHash", NULL); plist_t vol_uuid_node = plist_dict_get_item(args, "Ap,VolumeUUID"); char* vol_uuid_str = NULL; @@ -2518,7 +2518,7 @@ int get_recovery_os_local_policy_tss_response( for (i = 0; i < 16; i++) { vol_uuid[i] = (unsigned char)vuuid[i]; } - plist_dict_set_item(parameters, "Ap,VolumeUUID", plist_new_data((char*)vol_uuid, 16)); + plist_dict_set_item(parameters, "Ap,VolumeUUID", plist_new_data(vol_uuid, 16)); /* create basic request */ request = tss_request_new(NULL); @@ -2566,14 +2566,14 @@ int get_local_policy_tss_response(struct idevicerestore_client_t* client, plist_ plist_dict_set_item(parameters, "ApECID", plist_new_uint(client->ecid)); plist_dict_set_item(parameters, "Ap,LocalBoot", plist_new_bool(0)); if (client->nonce) { - plist_dict_set_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size)); + plist_dict_set_item(parameters, "ApNonce", plist_new_data(client->nonce, client->nonce_size)); } unsigned char* sep_nonce = NULL; unsigned int sep_nonce_size = 0; get_sep_nonce(client, &sep_nonce, &sep_nonce_size); if (sep_nonce) { - plist_dict_set_item(parameters, "ApSepNonce", plist_new_data((const char*)sep_nonce, sep_nonce_size)); + plist_dict_set_item(parameters, "ApSepNonce", plist_new_data(sep_nonce, sep_nonce_size)); free(sep_nonce); } @@ -2591,7 +2591,7 @@ int get_local_policy_tss_response(struct idevicerestore_client_t* client, plist_ uint8_t digest[SHA384_DIGEST_LENGTH]; SHA384(lpol_file, lpol_file_length, digest); plist_t lpol = plist_new_dict(); - plist_dict_set_item(lpol, "Digest", plist_new_data((char*)digest, SHA384_DIGEST_LENGTH)); + plist_dict_set_item(lpol, "Digest", plist_new_data(digest, SHA384_DIGEST_LENGTH)); plist_dict_set_item(lpol, "Trusted", plist_new_bool(1)); plist_dict_set_item(parameters, "Ap,LocalPolicy", lpol); @@ -2603,7 +2603,7 @@ int get_local_policy_tss_response(struct idevicerestore_client_t* client, plist_ // Hash it and add it as Ap,NextStageIM4MHash uint8_t hash[SHA384_DIGEST_LENGTH]; SHA384(ticket, ticket_length, hash); - plist_dict_set_item(parameters, "Ap,NextStageIM4MHash", plist_new_data((char*)hash, SHA384_DIGEST_LENGTH)); + plist_dict_set_item(parameters, "Ap,NextStageIM4MHash", plist_new_data(hash, SHA384_DIGEST_LENGTH)); /* create basic request */ request = tss_request_new(NULL); diff --git a/src/img4.c b/src/img4.c index 56b0496..2d1cc43 100644 --- a/src/img4.c +++ b/src/img4.c @@ -457,7 +457,7 @@ int img4_stitch_component(const char* component_name, const unsigned char* compo return -1; } uint64_t ucon_size = 0; - const char* ucon_data = plist_get_data_ptr(dt, &ucon_size); + const uint8_t* ucon_data = plist_get_data_ptr(dt, &ucon_size); if (!ucon_data) { error("ERROR: %s: Missing ucon data in %s-TBM dictionary\n", __func__, component_name); return -1; @@ -468,7 +468,7 @@ int img4_stitch_component(const char* component_name, const unsigned char* compo return -1; } uint64_t ucer_size = 0; - const char* ucer_data = plist_get_data_ptr(dt, &ucer_size); + const uint8_t* ucer_data = plist_get_data_ptr(dt, &ucer_size); if (!ucer_data) { error("ERROR: %s: Missing ucer data in %s-TBM dictionary\n", __func__, component_name); return -1; @@ -705,7 +705,7 @@ static void _manifest_write_component(unsigned char **p, unsigned int *length, c node = plist_dict_get_item(comp, "Digest"); if (node) { - char *digest = NULL; + uint8_t *digest = NULL; uint64_t digest_len = 0; plist_get_data_val(node, &digest, &digest_len); if (digest_len > 0) { @@ -740,7 +740,7 @@ static void _manifest_write_component(unsigned char **p, unsigned int *length, c node = plist_dict_get_item(comp, "TBMDigests"); if (node) { - char *data = NULL; + uint8_t *data = NULL; uint64_t datalen = 0; plist_get_data_val(node, &data, &datalen); const char *tbmtag = NULL; @@ -798,22 +798,22 @@ int img4_create_local_manifest(plist_t request, plist_t build_identity, plist_t* unsigned int tmp_len = 0; /* write manifest properties */ - uintval = _plist_dict_get_uint(request, "ApBoardID"); + uintval = plist_dict_get_uint(request, "ApBoardID"); _manifest_write_key_value(&tmp, &tmp_len, "BORD", ASN1_INTEGER, &uintval, -1); uintval = 0; _manifest_write_key_value(&tmp, &tmp_len, "CEPO", ASN1_INTEGER, &uintval, -1); - uintval = _plist_dict_get_uint(request, "ApChipID"); + uintval = plist_dict_get_uint(request, "ApChipID"); _manifest_write_key_value(&tmp, &tmp_len, "CHIP", ASN1_INTEGER, &uintval, -1); - boolval = _plist_dict_get_bool(request, "ApProductionMode"); + boolval = plist_dict_get_bool(request, "ApProductionMode"); _manifest_write_key_value(&tmp, &tmp_len, "CPRO", ASN1_BOOLEAN, &boolval, -1); boolval = 0; _manifest_write_key_value(&tmp, &tmp_len, "CSEC", ASN1_BOOLEAN, &boolval, -1); - uintval = _plist_dict_get_uint(request, "ApSecurityDomain"); + uintval = plist_dict_get_uint(request, "ApSecurityDomain"); _manifest_write_key_value(&tmp, &tmp_len, "SDOM", ASN1_INTEGER, &uintval, -1); /* create manifest properties set */ @@ -907,7 +907,7 @@ int img4_create_local_manifest(plist_t request, plist_t build_identity, plist_t* length += hdr_len; - *manifest = plist_new_data((char*)buf, length); + *manifest = plist_new_data(buf, length); free(buf); diff --git a/src/normal.c b/src/normal.c index efe8f03..8070982 100644 --- a/src/normal.c +++ b/src/normal.c @@ -333,7 +333,7 @@ static int normal_get_nonce_by_key(struct idevicerestore_client_t* client, const } uint64_t n_size = 0; - plist_get_data_val(nonce_node, (char**)nonce, &n_size); + plist_get_data_val(nonce_node, nonce, &n_size); *nonce_size = (unsigned int)n_size; plist_free(nonce_node); @@ -462,13 +462,13 @@ int normal_handle_create_stashbag(struct idevicerestore_client_t* client, plist_ } else { plist_t node; - if (_plist_dict_get_bool(pl, "Skip")) { + if (plist_dict_get_bool(pl, "Skip")) { result = 0; info("Device does not require stashbag.\n"); break; } - if (_plist_dict_get_bool(pl, "ShowDialog")) { + if (plist_dict_get_bool(pl, "ShowDialog")) { info("Device requires stashbag.\n"); printf("******************************************************************************\n" "* Please enter your passcode on the device. The device will store a token *\n" @@ -491,13 +491,13 @@ int normal_handle_create_stashbag(struct idevicerestore_client_t* client, plist_ plist_free(pl); break; } - if (_plist_dict_get_bool(pl, "Timeout")) { + if (plist_dict_get_bool(pl, "Timeout")) { error("ERROR: Timeout while waiting for user to enter passcode.\n"); result = -2; plist_free(pl); break; } - if (_plist_dict_get_bool(pl, "HideDialog")) { + if (plist_dict_get_bool(pl, "HideDialog")) { plist_free(pl); /* hide dialog */ result = 1; @@ -588,7 +588,7 @@ int normal_handle_commit_stashbag(struct idevicerestore_client_t* client, plist_ } error("ERROR: Could not commit stashbag: %s\n", (strval) ? strval : "(Unknown error)"); free(strval); - } else if (_plist_dict_get_bool(pl, "StashbagCommitComplete")) { + } else if (plist_dict_get_bool(pl, "StashbagCommitComplete")) { info("Stashbag committed!\n"); result = 0; } else { diff --git a/src/restore.c b/src/restore.c index 1261147..0e55338 100644 --- a/src/restore.c +++ b/src/restore.c @@ -976,7 +976,7 @@ int restore_send_recovery_os_root_ticket(restored_client_t restore, struct idevi if (client->root_ticket) { dict = plist_new_dict(); - plist_dict_set_item(dict, "RecoveryOSRootTicketData", plist_new_data((char*)client->root_ticket, client->root_ticket_len)); + plist_dict_set_item(dict, "RecoveryOSRootTicketData", plist_new_data(client->root_ticket, client->root_ticket_len)); } else { unsigned char* data = NULL; unsigned int len = 0; @@ -1000,7 +1000,7 @@ int restore_send_recovery_os_root_ticket(restored_client_t restore, struct idevi dict = plist_new_dict(); if (data && (len > 0)) { - plist_dict_set_item(dict, "RootTicketData", plist_new_data((char*)data, len)); + plist_dict_set_item(dict, "RootTicketData", plist_new_data(data, len)); } else { info("NOTE: not sending RootTicketData (no data present)\n"); } @@ -1029,7 +1029,7 @@ int restore_send_root_ticket(restored_client_t restore, struct idevicerestore_cl if (client->root_ticket) { dict = plist_new_dict(); - plist_dict_set_item(dict, "RootTicketData", plist_new_data((char*)client->root_ticket, client->root_ticket_len)); + plist_dict_set_item(dict, "RootTicketData", plist_new_data(client->root_ticket, client->root_ticket_len)); } else { unsigned char* data = NULL; unsigned int len = 0; @@ -1053,7 +1053,7 @@ int restore_send_root_ticket(restored_client_t restore, struct idevicerestore_cl dict = plist_new_dict(); if (data && (len > 0)) { - plist_dict_set_item(dict, "RootTicketData", plist_new_data((char*)data, len)); + plist_dict_set_item(dict, "RootTicketData", plist_new_data(data, len)); } else { info("NOTE: not sending RootTicketData (no data present)\n"); } @@ -1118,7 +1118,7 @@ int restore_send_component(restored_client_t restore, struct idevicerestore_clie } dict = plist_new_dict(); - blob = plist_new_data((char*)data, size); + blob = plist_new_data(data, size); char compkeyname[256]; sprintf(compkeyname, "%sFile", component_name); plist_dict_set_item(dict, compkeyname, blob); @@ -1279,7 +1279,7 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* } dict = plist_new_dict(); - plist_dict_set_item(dict, "LlbImageData", plist_new_data((char*)llb_data, (uint64_t) llb_size)); + plist_dict_set_item(dict, "LlbImageData", plist_new_data(llb_data, llb_size)); free(llb_data); if (flash_version_1) { @@ -1339,13 +1339,13 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* component_size = 0; if (flash_version_1) { - plist_dict_set_item(norimage, component, plist_new_data((char*)nor_data, (uint64_t)nor_size)); + plist_dict_set_item(norimage, component, plist_new_data(nor_data, nor_size)); } else { /* make sure iBoot is the first entry in the array */ if (!strncmp("iBoot", component, 5)) { - plist_array_insert_item(norimage, plist_new_data((char*)nor_data, (uint64_t)nor_size), 0); + plist_array_insert_item(norimage, plist_new_data(nor_data, nor_size), 0); } else { - plist_array_append_item(norimage, plist_new_data((char*)nor_data, (uint64_t)nor_size)); + plist_array_append_item(norimage, plist_new_data(nor_data, nor_size)); } } @@ -1381,7 +1381,7 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* return -1; } - plist_dict_set_item(dict, "RestoreSEPImageData", plist_new_data((char*)personalized_data, (uint64_t) personalized_size)); + plist_dict_set_item(dict, "RestoreSEPImageData", plist_new_data(personalized_data, personalized_size)); free(personalized_data); personalized_data = NULL; personalized_size = 0; @@ -1406,7 +1406,7 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* return -1; } - plist_dict_set_item(dict, "SEPImageData", plist_new_data((char*)personalized_data, (uint64_t) personalized_size)); + plist_dict_set_item(dict, "SEPImageData", plist_new_data(personalized_data, personalized_size)); free(personalized_data); personalized_data = NULL; personalized_size = 0; @@ -1431,7 +1431,7 @@ int restore_send_nor(restored_client_t restore, struct idevicerestore_client_t* return -1; } - plist_dict_set_item(dict, "SEPPatchImageData", plist_new_data((char*)personalized_data, (uint64_t) personalized_size)); + plist_dict_set_item(dict, "SEPPatchImageData", plist_new_data(personalized_data, personalized_size)); free(personalized_data); personalized_data = NULL; personalized_size = 0; @@ -1609,7 +1609,7 @@ static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const unsigned blob = NULL; blob_size = 0; - plist_get_data_val(node, (char**)&blob, &blob_size); + plist_get_data_val(node, &blob, &blob_size); if (!blob) { error("ERROR: could not get %s-Blob data\n", key); goto leave; @@ -1742,7 +1742,7 @@ static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const unsigned blob = NULL; blob_size = 0; - plist_get_data_val(bbticket, (char**)&blob, &blob_size); + plist_get_data_val(bbticket, &blob, &blob_size); if (!blob) { error("ERROR: could not get BBTicket data\n"); goto leave; @@ -1780,7 +1780,7 @@ static int restore_sign_bbfw(const char* bbfwtmp, plist_t bbtss, const unsigned // add BBTicket as bbticket.der blob = NULL; blob_size = 0; - plist_get_data_val(bbticket, (char**)&blob, &blob_size); + plist_get_data_val(bbticket, &blob, &blob_size); if (!blob) { error("ERROR: could not get BBTicket data\n"); goto leave; @@ -1839,7 +1839,7 @@ static int restore_send_baseband_data(restored_client_t restore, struct idevicer uint64_t bb_nonce_size = 0; uint64_t bb_chip_id = 0; plist_t response = NULL; - char* buffer = NULL; + uint8_t* buffer = NULL; char* bbfwtmp = NULL; plist_t dict = NULL; @@ -1860,11 +1860,11 @@ static int restore_send_baseband_data(restored_client_t restore, struct idevicer } plist_t bb_snum_node = plist_dict_get_item(arguments, "ChipSerialNo"); if (bb_snum_node && plist_get_node_type(bb_snum_node) == PLIST_DATA) { - plist_get_data_val(bb_snum_node, (char**)&bb_snum, &bb_snum_size); + plist_get_data_val(bb_snum_node, &bb_snum, &bb_snum_size); } plist_t bb_nonce_node = plist_dict_get_item(arguments, "Nonce"); if (bb_nonce_node && plist_get_node_type(bb_nonce_node) == PLIST_DATA) { - plist_get_data_val(bb_nonce_node, (char**)&bb_nonce, &bb_nonce_size); + plist_get_data_val(bb_nonce_node, &bb_nonce, &bb_nonce_size); } } @@ -1873,11 +1873,11 @@ static int restore_send_baseband_data(restored_client_t restore, struct idevicer plist_t parameters = plist_new_dict(); plist_dict_set_item(parameters, "ApECID", plist_new_uint(client->ecid)); if (bb_nonce) { - plist_dict_set_item(parameters, "BbNonce", plist_new_data((const char*)bb_nonce, bb_nonce_size)); + plist_dict_set_item(parameters, "BbNonce", plist_new_data(bb_nonce, bb_nonce_size)); } plist_dict_set_item(parameters, "BbChipID", plist_new_uint(bb_chip_id)); plist_dict_set_item(parameters, "BbGoldCertId", plist_new_uint(bb_cert_id)); - plist_dict_set_item(parameters, "BbSNUM", plist_new_data((const char*)bb_snum, bb_snum_size)); + plist_dict_set_item(parameters, "BbSNUM", plist_new_data(bb_snum, bb_snum_size)); tss_parameters_add_from_manifest(parameters, build_identity, true); @@ -1970,7 +1970,7 @@ static int restore_send_baseband_data(restored_client_t restore, struct idevicer // send file dict = plist_new_dict(); - plist_dict_set_item(dict, "BasebandData", plist_new_data(buffer, (uint64_t)sz)); + plist_dict_set_item(dict, "BasebandData", plist_new_data(buffer, sz)); free(buffer); buffer = NULL; @@ -2034,7 +2034,7 @@ static int restore_send_image_data(restored_client_t restore, struct idevicerest int want_image_list = 0; arguments = plist_dict_get_item(message, "Arguments"); - want_image_list = _plist_dict_get_bool(arguments, image_list_k); + want_image_list = plist_dict_get_bool(arguments, image_list_k); node = plist_dict_get_item(arguments, "ImageName"); if (node) { plist_get_string_val(node, &image_name); @@ -2109,7 +2109,7 @@ static int restore_send_image_data(restored_client_t restore, struct idevicerest error("ERROR: Unable to get personalized component: %s\n", component); } - plist_dict_set_item(data_dict, component, plist_new_data((const char*)data, size)); + plist_dict_set_item(data_dict, component, plist_new_data(data, size)); free(data); } } @@ -2256,7 +2256,7 @@ static plist_t restore_get_se_firmware_data(restored_client_t restore, struct id error("ERROR: No 'SE ticket' in TSS response, this might not work\n"); } - plist_dict_set_item(response, "FirmwareData", plist_new_data((char*)component_data, (uint64_t) component_size)); + plist_dict_set_item(response, "FirmwareData", plist_new_data(component_data, component_size)); free(component_data); component_data = NULL; component_size = 0; @@ -2347,7 +2347,7 @@ static plist_t restore_get_savage_firmware_data(restored_client_t restore, struc *(uint32_t*)(component_data + 4) = htole32((uint32_t)component_size); component_size += 16; - plist_dict_set_item(response, "FirmwareData", plist_new_data((char*)component_data, (uint64_t) component_size)); + plist_dict_set_item(response, "FirmwareData", plist_new_data(component_data, component_size)); free(component_data); component_data = NULL; component_size = 0; @@ -2429,7 +2429,7 @@ static plist_t restore_get_yonkers_firmware_data(restored_client_t restore, stru comp_name = NULL; plist_t firmware_data = plist_new_dict(); - plist_dict_set_item(firmware_data, "YonkersFirmware", plist_new_data((char *)component_data, (uint64_t)component_size)); + plist_dict_set_item(firmware_data, "YonkersFirmware", plist_new_data(component_data, component_size)); plist_dict_set_item(response, "FirmwareData", firmware_data); free(component_data); @@ -2578,7 +2578,7 @@ static plist_t restore_get_rose_firmware_data(restored_client_t restore, struct ftab_write(ftab, &component_data, &component_size); ftab_free(ftab); - plist_dict_set_item(response, "FirmwareData", plist_new_data((char *)component_data, (uint64_t)component_size)); + plist_dict_set_item(response, "FirmwareData", plist_new_data(component_data, component_size)); free(component_data); component_data = NULL; component_size = 0; @@ -2676,7 +2676,7 @@ static plist_t restore_get_veridian_firmware_data(restored_client_t restore, str plist_to_bin(fw_map, &bin_plist, &bin_size); plist_free(fw_map); - plist_dict_set_item(response, "FirmwareData", plist_new_data(bin_plist, (uint64_t)bin_size)); + plist_dict_set_item(response, "FirmwareData", plist_new_data((uint8_t*)bin_plist, bin_size)); free(bin_plist); return response; @@ -2798,7 +2798,7 @@ static plist_t restore_get_tcon_firmware_data(restored_client_t restore, struct return NULL; } - plist_dict_set_item(response, "FirmwareData", plist_new_data((char *)component_data, (uint64_t)component_size)); + plist_dict_set_item(response, "FirmwareData", plist_new_data(component_data, component_size)); free(component_data); component_data = NULL; component_size = 0; @@ -2851,7 +2851,7 @@ static plist_t restore_get_timer_firmware_data(restored_client_t restore, struct } else { plist_t info_dict = plist_array_get_item(info_array, 0); plist_t hwid = plist_dict_get_item(info_dict, "HardwareID"); - tag = (uint32_t)_plist_dict_get_uint(info_dict, "TagNumber"); + tag = (uint32_t)plist_dict_get_uint(info_dict, "TagNumber"); char key[64]; plist_dict_set_item(parameters, "TagNumber", plist_new_uint(tag)); @@ -2862,25 +2862,25 @@ static plist_t restore_get_timer_firmware_data(restored_client_t restore, struct } sprintf(key, "Timer,ChipID,%u", tag); - _plist_dict_copy_uint(parameters, hwid, key, "ChipID"); + plist_dict_copy_uint(parameters, hwid, key, "ChipID"); sprintf(key, "Timer,BoardID,%u", tag); - _plist_dict_copy_uint(parameters, hwid, key, "BoardID"); + plist_dict_copy_uint(parameters, hwid, key, "BoardID"); sprintf(key, "Timer,ECID,%u", tag); - _plist_dict_copy_uint(parameters, hwid, key, "ECID"); + plist_dict_copy_uint(parameters, hwid, key, "ECID"); sprintf(key, "Timer,Nonce,%u", tag); - _plist_dict_copy_data(parameters, hwid, key, "Nonce"); + plist_dict_copy_data(parameters, hwid, key, "Nonce"); sprintf(key, "Timer,SecurityMode,%u", tag); - _plist_dict_copy_bool(parameters, hwid, key, "SecurityMode"); + plist_dict_copy_bool(parameters, hwid, key, "SecurityMode"); sprintf(key, "Timer,SecurityDomain,%u", tag); - _plist_dict_copy_uint(parameters, hwid, key, "SecurityDomain"); + plist_dict_copy_uint(parameters, hwid, key, "SecurityDomain"); sprintf(key, "Timer,ProductionMode,%u", tag); - _plist_dict_copy_uint(parameters, hwid, key, "ProductionStatus"); + plist_dict_copy_uint(parameters, hwid, key, "ProductionStatus"); } plist_t ap_info = plist_dict_get_item(p_info, "APInfo"); if (!ap_info) { @@ -2983,7 +2983,7 @@ static plist_t restore_get_timer_firmware_data(restored_client_t restore, struct ftab_write(ftab, &component_data, &component_size); ftab_free(ftab); - plist_dict_set_item(response, "FirmwareData", plist_new_data((char *)component_data, (uint64_t)component_size)); + plist_dict_set_item(response, "FirmwareData", plist_new_data(component_data, component_size)); free(component_data); component_data = NULL; component_size = 0; @@ -3043,10 +3043,10 @@ static plist_t restore_get_cryptex1_firmware_data(restored_client_t restore, str plist_dict_set_item(parameters, "ApSecurityMode", plist_new_bool(1)); } if (!plist_dict_get_item(parameters, "ApChipID")) { - _plist_dict_copy_uint(parameters, build_identity, "ApChipID", NULL); + plist_dict_copy_uint(parameters, build_identity, "ApChipID", NULL); } if (!plist_dict_get_item(parameters, "ApBoardID")) { - _plist_dict_copy_uint(parameters, build_identity, "ApBoardID", NULL); + plist_dict_copy_uint(parameters, build_identity, "ApBoardID", NULL); } /* add device generated request data to parameters */ @@ -3461,7 +3461,7 @@ plist_t restore_get_build_identity(struct idevicerestore_client_t* client, uint8 plist_t restore_get_build_identity_from_request(struct idevicerestore_client_t* client, plist_t msg) { plist_t args = plist_dict_get_item(msg, "Arguments"); - return restore_get_build_identity(client, _plist_dict_get_bool(args, "IsRecoveryOS")); + return restore_get_build_identity(client, plist_dict_get_bool(args, "IsRecoveryOS")); } int extract_macos_variant(plist_t build_identity, char** output) @@ -3549,7 +3549,7 @@ static int _restore_send_file_data(struct _restore_send_file_data_ctx* rctx, voi plist_t dict = plist_new_dict(); if (data != NULL) { // Send a chunk of file data - plist_dict_set_item(dict, "FileData", plist_new_data((char*)data, size)); + plist_dict_set_item(dict, "FileData", plist_new_data(data, size)); } else { // Send FileDataDone to mark end of transfer plist_dict_set_item(dict, "FileDataDone", plist_new_bool(1)); @@ -3806,7 +3806,7 @@ int restore_send_restore_local_policy(restored_client_t restore, struct idevicer } plist_t dict = plist_new_dict(); - plist_dict_set_item(dict, "Ap,LocalPolicy", plist_new_data((char*)data, size)); + plist_dict_set_item(dict, "Ap,LocalPolicy", plist_new_data(data, size)); int restore_error = restored_send(restore, dict); if (restore_error != RESTORE_E_SUCCESS) { @@ -4289,7 +4289,7 @@ int restore_device(struct idevicerestore_client_t* client, plist_t build_identit plist_dict_set_item(opts, "BBUpdaterState", bbus); - _plist_dict_copy_data(opts, client->preflight_info, "BasebandNonce", "Nonce"); + plist_dict_copy_data(opts, client->preflight_info, "BasebandNonce", "Nonce"); } plist_dict_set_item(opts, "SupportedDataTypes", restore_supported_data_types()); diff --git a/src/tss.c b/src/tss.c index 80591e7..04d5108 100644 --- a/src/tss.c +++ b/src/tss.c @@ -92,39 +92,39 @@ int tss_request_add_local_policy_tags(plist_t request, plist_t parameters) { plist_dict_set_item(request, "@ApImg4Ticket", plist_new_bool(1)); - if (_plist_dict_copy_bool(request, parameters, "Ap,LocalBoot", NULL) < 0) { + if (plist_dict_copy_bool(request, parameters, "Ap,LocalBoot", NULL) < 0) { error("ERROR: Unable to find required Ap,LocalBoot in parameters\n"); return -1; } - if (_plist_dict_copy_item(request, parameters, "Ap,LocalPolicy", NULL) < 0) { + if (plist_dict_copy_item(request, parameters, "Ap,LocalPolicy", NULL) < 0) { error("ERROR: Unable to find required Ap,LocalPolicy in parameters\n"); return -1; } - if (_plist_dict_copy_data(request, parameters, "Ap,NextStageIM4MHash", NULL) < 0) { + if (plist_dict_copy_data(request, parameters, "Ap,NextStageIM4MHash", NULL) < 0) { error("ERROR: Unable to find required Ap,NextStageIM4MHash in parameters\n"); return -1; } - _plist_dict_copy_data(request, parameters, "Ap,RecoveryOSPolicyNonceHash", NULL); - _plist_dict_copy_data(request, parameters, "Ap,VolumeUUID", NULL); - _plist_dict_copy_uint(request, parameters, "ApECID", NULL); - _plist_dict_copy_uint(request, parameters, "ApChipID", NULL); - _plist_dict_copy_uint(request, parameters, "ApBoardID", NULL); - _plist_dict_copy_uint(request, parameters, "ApSecurityDomain", NULL); - _plist_dict_copy_data(request, parameters, "ApNonce", NULL); + plist_dict_copy_data(request, parameters, "Ap,RecoveryOSPolicyNonceHash", NULL); + plist_dict_copy_data(request, parameters, "Ap,VolumeUUID", NULL); + plist_dict_copy_uint(request, parameters, "ApECID", NULL); + plist_dict_copy_uint(request, parameters, "ApChipID", NULL); + plist_dict_copy_uint(request, parameters, "ApBoardID", NULL); + plist_dict_copy_uint(request, parameters, "ApSecurityDomain", NULL); + plist_dict_copy_data(request, parameters, "ApNonce", NULL); if (!plist_dict_get_item(request, "ApSecurityMode")) { /* copy from parameters if available */ - if (_plist_dict_copy_bool(request, parameters, "ApSecurityMode", NULL) < 0) { + if (plist_dict_copy_bool(request, parameters, "ApSecurityMode", NULL) < 0) { error("ERROR: Unable to find required ApSecurityMode in parameters\n"); return -1; } } if (!plist_dict_get_item(request, "ApProductionMode")) { /* copy from parameters if available */ - if (_plist_dict_copy_bool(request, parameters, "ApProductionMode", NULL) < 0) { + if (plist_dict_copy_bool(request, parameters, "ApProductionMode", NULL) < 0) { error("ERROR: Unable to find required ApProductionMode in parameters\n"); return -1; } @@ -137,121 +137,121 @@ int tss_parameters_add_from_manifest(plist_t parameters, plist_t build_identity, { plist_t node = NULL; - if (_plist_dict_copy_data(parameters, build_identity, "UniqueBuildID", NULL) < 0) { + if (plist_dict_copy_data(parameters, build_identity, "UniqueBuildID", NULL) < 0) { error("ERROR: Unable to find UniqueBuildID node\n"); return -1; } - _plist_dict_copy_string(parameters, build_identity, "Ap,OSLongVersion", NULL); + plist_dict_copy_string(parameters, build_identity, "Ap,OSLongVersion", NULL); - if (_plist_dict_copy_uint(parameters, build_identity, "ApChipID", NULL) < 0) {; + if (plist_dict_copy_uint(parameters, build_identity, "ApChipID", NULL) < 0) {; error("ERROR: Unable to find ApChipID node\n"); return -1; } - if (_plist_dict_copy_uint(parameters, build_identity, "ApBoardID", NULL) < 0) { + if (plist_dict_copy_uint(parameters, build_identity, "ApBoardID", NULL) < 0) { error("ERROR: Unable to find ApBoardID node\n"); return -1; } - _plist_dict_copy_uint(parameters, build_identity, "ApSecurityDomain", NULL); - _plist_dict_copy_uint(parameters, build_identity, "BMU,BoardID", NULL); - _plist_dict_copy_uint(parameters, build_identity, "BMU,ChipID", NULL); + plist_dict_copy_uint(parameters, build_identity, "ApSecurityDomain", NULL); + plist_dict_copy_uint(parameters, build_identity, "BMU,BoardID", NULL); + plist_dict_copy_uint(parameters, build_identity, "BMU,ChipID", NULL); - if (_plist_dict_copy_uint(parameters, build_identity, "BbChipID", NULL) < 0) { + if (plist_dict_copy_uint(parameters, build_identity, "BbChipID", NULL) < 0) { debug("NOTE: Unable to find BbChipID node\n"); } - if (_plist_dict_copy_data(parameters, build_identity, "BbProvisioningManifestKeyHash", NULL) < 0) { + if (plist_dict_copy_data(parameters, build_identity, "BbProvisioningManifestKeyHash", NULL) < 0) { debug("NOTE: Unable to find BbProvisioningManifestKeyHash node\n"); } - if (_plist_dict_copy_data(parameters, build_identity, "BbActivationManifestKeyHash", NULL) < 0) { + if (plist_dict_copy_data(parameters, build_identity, "BbActivationManifestKeyHash", NULL) < 0) { debug("NOTE: Unable to find BbActivationManifestKeyHash node\n"); } - if (_plist_dict_copy_data(parameters, build_identity, "BbCalibrationManifestKeyHash", NULL) < 0) { + if (plist_dict_copy_data(parameters, build_identity, "BbCalibrationManifestKeyHash", NULL) < 0) { debug("NOTE: Unable to find BbCalibrationManifestKeyHash node\n"); } - if (_plist_dict_copy_data(parameters, build_identity, "BbFactoryActivationManifestKeyHash", NULL) < 0) { + if (plist_dict_copy_data(parameters, build_identity, "BbFactoryActivationManifestKeyHash", NULL) < 0) { debug("NOTE: Unable to find BbFactoryActivationManifestKeyHash node\n"); } - if (_plist_dict_copy_data(parameters, build_identity, "BbFDRSecurityKeyHash", NULL) < 0) { + if (plist_dict_copy_data(parameters, build_identity, "BbFDRSecurityKeyHash", NULL) < 0) { debug("NOTE: Unable to find BbFDRSecurityKeyHash node\n"); } /* BbSkeyId - Used by XMM 6180/GSM */ - if (_plist_dict_copy_data(parameters, build_identity, "BbSkeyId", NULL) < 0) { + if (plist_dict_copy_data(parameters, build_identity, "BbSkeyId", NULL) < 0) { debug("NOTE: Unable to find BbSkeyId node\n"); } /* SE,ChipID - Used for SE firmware request */ - _plist_dict_copy_uint(parameters, build_identity, "SE,ChipID", NULL); + plist_dict_copy_uint(parameters, build_identity, "SE,ChipID", NULL); /* Savage,ChipID - Used for Savage firmware request */ - _plist_dict_copy_uint(parameters, build_identity, "Savage,ChipID", NULL); + plist_dict_copy_uint(parameters, build_identity, "Savage,ChipID", NULL); /* add Savage,PatchEpoch - Used for Savage firmware request */ - _plist_dict_copy_uint(parameters, build_identity, "Savage,PatchEpoch", NULL); + plist_dict_copy_uint(parameters, build_identity, "Savage,PatchEpoch", NULL); /* Yonkers,BoardID - Used for Yonkers firmware request */ - _plist_dict_copy_uint(parameters, build_identity, "Yonkers,BoardID", NULL); + plist_dict_copy_uint(parameters, build_identity, "Yonkers,BoardID", NULL); /* Yonkers,ChipID - Used for Yonkers firmware request */ - _plist_dict_copy_uint(parameters, build_identity, "Yonkers,ChipID", NULL); + plist_dict_copy_uint(parameters, build_identity, "Yonkers,ChipID", NULL); /* add Yonkers,PatchEpoch - Used for Yonkers firmware request */ - _plist_dict_copy_uint(parameters, build_identity, "Yonkers,PatchEpoch", NULL); - - _plist_dict_copy_uint(parameters, build_identity, "Rap,BoardID", NULL); - _plist_dict_copy_uint(parameters, build_identity, "Rap,ChipID", NULL); - _plist_dict_copy_uint(parameters, build_identity, "Rap,SecurityDomain", NULL); - - _plist_dict_copy_uint(parameters, build_identity, "Baobab,BoardID", NULL); - _plist_dict_copy_uint(parameters, build_identity, "Baobab,ChipID", NULL); - _plist_dict_copy_uint(parameters, build_identity, "Baobab,ManifestEpoch", NULL); - _plist_dict_copy_uint(parameters, build_identity, "Baobab,SecurityDomain", NULL); - - _plist_dict_copy_uint(parameters, build_identity, "eUICC,ChipID", NULL); - - _plist_dict_copy_uint(parameters, build_identity, "NeRDEpoch", NULL); - _plist_dict_copy_data(parameters, build_identity, "PearlCertificationRootPub", NULL); - - _plist_dict_copy_uint(parameters, build_identity, "Timer,BoardID,1", NULL); - _plist_dict_copy_uint(parameters, build_identity, "Timer,BoardID,2", NULL); - _plist_dict_copy_uint(parameters, build_identity, "Timer,ChipID,1", NULL); - _plist_dict_copy_uint(parameters, build_identity, "Timer,ChipID,2", NULL); - _plist_dict_copy_uint(parameters, build_identity, "Timer,SecurityDomain,1", NULL); - _plist_dict_copy_uint(parameters, build_identity, "Timer,SecurityDomain,2", NULL); - - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,ChipID", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,Type", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,SubType", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,ProductClass", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,UseProductClass", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,NonceDomain", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,Version", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,PreauthorizationVersion", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,FakeRoot", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,SystemOS", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,SystemVolume", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,SystemTrustCache", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,AppOS", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,AppVolume", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,AppTrustCache", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,MobileAssetBrainOS", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,MobileAssetBrainVolume", NULL); - _plist_dict_copy_item(parameters, build_identity, "Cryptex1,MobileAssetBrainTrustCache", NULL); - - _plist_dict_copy_item(parameters, build_identity, "USBPortController1,BoardID", NULL); - _plist_dict_copy_item(parameters, build_identity, "USBPortController1,ChipID", NULL); - _plist_dict_copy_item(parameters, build_identity, "USBPortController1,SecurityDomain", NULL); + plist_dict_copy_uint(parameters, build_identity, "Yonkers,PatchEpoch", NULL); + + plist_dict_copy_uint(parameters, build_identity, "Rap,BoardID", NULL); + plist_dict_copy_uint(parameters, build_identity, "Rap,ChipID", NULL); + plist_dict_copy_uint(parameters, build_identity, "Rap,SecurityDomain", NULL); + + plist_dict_copy_uint(parameters, build_identity, "Baobab,BoardID", NULL); + plist_dict_copy_uint(parameters, build_identity, "Baobab,ChipID", NULL); + plist_dict_copy_uint(parameters, build_identity, "Baobab,ManifestEpoch", NULL); + plist_dict_copy_uint(parameters, build_identity, "Baobab,SecurityDomain", NULL); + + plist_dict_copy_uint(parameters, build_identity, "eUICC,ChipID", NULL); + + plist_dict_copy_uint(parameters, build_identity, "NeRDEpoch", NULL); + plist_dict_copy_data(parameters, build_identity, "PearlCertificationRootPub", NULL); + + plist_dict_copy_uint(parameters, build_identity, "Timer,BoardID,1", NULL); + plist_dict_copy_uint(parameters, build_identity, "Timer,BoardID,2", NULL); + plist_dict_copy_uint(parameters, build_identity, "Timer,ChipID,1", NULL); + plist_dict_copy_uint(parameters, build_identity, "Timer,ChipID,2", NULL); + plist_dict_copy_uint(parameters, build_identity, "Timer,SecurityDomain,1", NULL); + plist_dict_copy_uint(parameters, build_identity, "Timer,SecurityDomain,2", NULL); + + plist_dict_copy_item(parameters, build_identity, "Cryptex1,ChipID", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,Type", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,SubType", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,ProductClass", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,UseProductClass", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,NonceDomain", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,Version", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,PreauthorizationVersion", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,FakeRoot", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,SystemOS", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,SystemVolume", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,SystemTrustCache", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,AppOS", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,AppVolume", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,AppTrustCache", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,MobileAssetBrainOS", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,MobileAssetBrainVolume", NULL); + plist_dict_copy_item(parameters, build_identity, "Cryptex1,MobileAssetBrainTrustCache", NULL); + + plist_dict_copy_item(parameters, build_identity, "USBPortController1,BoardID", NULL); + plist_dict_copy_item(parameters, build_identity, "USBPortController1,ChipID", NULL); + plist_dict_copy_item(parameters, build_identity, "USBPortController1,SecurityDomain", NULL); node = plist_dict_get_item(build_identity, "Info"); if (node) { - _plist_dict_copy_bool(parameters, node, "RequiresUIDMode", NULL); + plist_dict_copy_bool(parameters, node, "RequiresUIDMode", NULL); } if (include_manifest) { @@ -274,9 +274,9 @@ int tss_request_add_ap_img4_tags(plist_t request, plist_t parameters) return -1; } - _plist_dict_copy_string(request, parameters, "Ap,OSLongVersion", NULL); + plist_dict_copy_string(request, parameters, "Ap,OSLongVersion", NULL); - if (_plist_dict_copy_data(request, parameters, "ApNonce", NULL) < 0) { + if (plist_dict_copy_data(request, parameters, "ApNonce", NULL) < 0) { error("ERROR: Unable to find required ApNonce in parameters\n"); return -1; } @@ -285,34 +285,34 @@ int tss_request_add_ap_img4_tags(plist_t request, plist_t parameters) if (!plist_dict_get_item(request, "ApSecurityMode")) { /* copy from parameters if available */ - if (_plist_dict_copy_bool(request, parameters, "ApSecurityMode", NULL) < 0) { + if (plist_dict_copy_bool(request, parameters, "ApSecurityMode", NULL) < 0) { error("ERROR: Unable to find required ApSecurityMode in parameters\n"); return -1; } } if (!plist_dict_get_item(request, "ApProductionMode")) { /* ApProductionMode */ - if (_plist_dict_copy_bool(request, parameters, "ApProductionMode", NULL) < 0) { + if (plist_dict_copy_bool(request, parameters, "ApProductionMode", NULL) < 0) { error("ERROR: Unable to find required ApProductionMode in parameters\n"); return -1; } } - _plist_dict_copy_data(request, parameters, "SepNonce", "ApSepNonce"); - _plist_dict_copy_uint(request, parameters, "NeRDEpoch", NULL); - _plist_dict_copy_data(request, parameters, "PearlCertificationRootPub", NULL); + plist_dict_copy_data(request, parameters, "SepNonce", "ApSepNonce"); + plist_dict_copy_uint(request, parameters, "NeRDEpoch", NULL); + plist_dict_copy_data(request, parameters, "PearlCertificationRootPub", NULL); if (plist_dict_get_item(parameters, "UID_MODE")) { - _plist_dict_copy_item(request, parameters, "UID_MODE", NULL); - } else if (_plist_dict_get_bool(parameters, "RequiresUIDMode")) { + plist_dict_copy_item(request, parameters, "UID_MODE", NULL); + } else if (plist_dict_get_bool(parameters, "RequiresUIDMode")) { // The logic here is missing why this value is expected to be 'false' plist_dict_set_item(request, "UID_MODE", plist_new_bool(0)); } // FIXME: I didn't understand yet when this value is set, so for now we use a workaround if (plist_dict_get_item(parameters, "ApSikaFuse")) { - _plist_dict_copy_item(request, parameters, "Ap,SikaFuse", "ApSikaFuse"); - } else if (_plist_dict_get_bool(parameters, "RequiresUIDMode")) { + plist_dict_copy_item(request, parameters, "Ap,SikaFuse", "ApSikaFuse"); + } else if (plist_dict_get_bool(parameters, "RequiresUIDMode")) { // Workaround: We have only seen Ap,SikaFuse together with UID_MODE plist_dict_set_item(request, "Ap,SikaFuse", plist_new_int(0)); } @@ -327,28 +327,28 @@ int tss_request_add_ap_img3_tags(plist_t request, plist_t parameters) return -1; } - if (_plist_dict_copy_data(request, parameters, "ApNonce", NULL) < 0) { + if (plist_dict_copy_data(request, parameters, "ApNonce", NULL) < 0) { error("WARNING: Unable to find ApNonce in parameters\n"); } plist_dict_set_item(request, "@APTicket", plist_new_bool(1)); - if (_plist_dict_copy_uint(request, parameters, "ApBoardID", NULL) < 0) { + if (plist_dict_copy_uint(request, parameters, "ApBoardID", NULL) < 0) { error("ERROR: Unable to find required ApBoardID in request\n"); return -1; } - if (_plist_dict_copy_uint(request, parameters, "ApChipID", NULL) < 0) { + if (plist_dict_copy_uint(request, parameters, "ApChipID", NULL) < 0) { error("ERROR: Unable to find required ApChipID in request\n"); return -1; } - if (_plist_dict_copy_uint(request, parameters, "ApSecurityDomain", NULL) < 0) { + if (plist_dict_copy_uint(request, parameters, "ApSecurityDomain", NULL) < 0) { error("ERROR: Unable to find required ApSecurityDomain in request\n"); return -1; } - if (_plist_dict_copy_bool(request, parameters, "ApProductionMode", NULL) < 0) { + if (plist_dict_copy_bool(request, parameters, "ApProductionMode", NULL) < 0) { error("ERROR: Unable to find required ApProductionMode in parameters\n"); return -1; } @@ -358,11 +358,11 @@ int tss_request_add_ap_img3_tags(plist_t request, plist_t parameters) int tss_request_add_common_tags(plist_t request, plist_t parameters, plist_t overrides) { - _plist_dict_copy_uint(request, parameters, "ApECID", NULL); - _plist_dict_copy_data(request, parameters, "UniqueBuildID", NULL); - _plist_dict_copy_uint(request, parameters, "ApChipID", NULL); - _plist_dict_copy_uint(request, parameters, "ApBoardID", NULL); - _plist_dict_copy_uint(request, parameters, "ApSecurityDomain", NULL); + plist_dict_copy_uint(request, parameters, "ApECID", NULL); + plist_dict_copy_data(request, parameters, "UniqueBuildID", NULL); + plist_dict_copy_uint(request, parameters, "ApChipID", NULL); + plist_dict_copy_uint(request, parameters, "ApBoardID", NULL); + plist_dict_copy_uint(request, parameters, "ApSecurityDomain", NULL); /* apply overrides */ if (overrides) { @@ -576,19 +576,19 @@ int tss_request_add_ap_recovery_tags(plist_t request, plist_t parameters, plist_ continue; } - if (_plist_dict_get_bool(parameters, "_OnlyFWComponents")) { - if (!_plist_dict_get_bool(manifest_entry, "Trusted")) { + if (plist_dict_get_bool(parameters, "_OnlyFWComponents")) { + if (!plist_dict_get_bool(manifest_entry, "Trusted")) { debug("DEBUG: %s: Skipping '%s' as it is not trusted\n", __func__, key); continue; } - if (!_plist_dict_get_bool(info_dict, "IsFirmwarePayload") - && !_plist_dict_get_bool(info_dict, "IsSecondaryFirmwarePayload") - && !_plist_dict_get_bool(info_dict, "IsFUDFirmware") - && !_plist_dict_get_bool(info_dict, "IsLoadedByiBoot") - && !_plist_dict_get_bool(info_dict, "IsEarlyAccessFirmware") - && !_plist_dict_get_bool(info_dict, "IsiBootEANFirmware") - && !_plist_dict_get_bool(info_dict, "IsiBootNonEssentialFirmware")) + if (!plist_dict_get_bool(info_dict, "IsFirmwarePayload") + && !plist_dict_get_bool(info_dict, "IsSecondaryFirmwarePayload") + && !plist_dict_get_bool(info_dict, "IsFUDFirmware") + && !plist_dict_get_bool(info_dict, "IsLoadedByiBoot") + && !plist_dict_get_bool(info_dict, "IsEarlyAccessFirmware") + && !plist_dict_get_bool(info_dict, "IsiBootEANFirmware") + && !plist_dict_get_bool(info_dict, "IsiBootNonEssentialFirmware")) { debug("DEBUG: %s: Skipping '%s' as it is not a firmware payload\n", __func__, key); continue; @@ -609,7 +609,7 @@ int tss_request_add_ap_recovery_tags(plist_t request, plist_t parameters, plist_ } /* Make sure we have a Digest key for Trusted items even if empty */ - if (_plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) { + if (plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) { debug("DEBUG: No Digest data, using empty value for entry %s\n", key); plist_dict_set_item(tss_entry, "Digest", plist_new_data(NULL, 0)); } @@ -679,28 +679,28 @@ int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrid continue; } - if (_plist_dict_get_bool(parameters, "ApSupportsImg4")) { + if (plist_dict_get_bool(parameters, "ApSupportsImg4")) { if (!plist_dict_get_item(info_dict, "RestoreRequestRules")) { debug("DEBUG: %s: Skipping '%s' as it doesn't have RestoreRequestRules\n", __func__, key); continue; } } - int is_fw_payload = _plist_dict_get_bool(info_dict, "IsFirmwarePayload") - || _plist_dict_get_bool(info_dict, "IsSecondaryFirmwarePayload") - || _plist_dict_get_bool(info_dict, "IsFUDFirmware") - || _plist_dict_get_bool(info_dict, "IsLoadedByiBoot") - || _plist_dict_get_bool(info_dict, "IsEarlyAccessFirmware") - || _plist_dict_get_bool(info_dict, "IsiBootEANFirmware") - || _plist_dict_get_bool(info_dict, "IsiBootNonEssentialFirmware"); + int is_fw_payload = plist_dict_get_bool(info_dict, "IsFirmwarePayload") + || plist_dict_get_bool(info_dict, "IsSecondaryFirmwarePayload") + || plist_dict_get_bool(info_dict, "IsFUDFirmware") + || plist_dict_get_bool(info_dict, "IsLoadedByiBoot") + || plist_dict_get_bool(info_dict, "IsEarlyAccessFirmware") + || plist_dict_get_bool(info_dict, "IsiBootEANFirmware") + || plist_dict_get_bool(info_dict, "IsiBootNonEssentialFirmware"); - if (_plist_dict_get_bool(parameters, "_OnlyFWOrTrustedComponents")) { - if (!_plist_dict_get_bool(manifest_entry, "Trusted") && !is_fw_payload) { + if (plist_dict_get_bool(parameters, "_OnlyFWOrTrustedComponents")) { + if (!plist_dict_get_bool(manifest_entry, "Trusted") && !is_fw_payload) { debug("DEBUG: %s: Skipping '%s' as it is neither firmware payload nor trusted\n", __func__, key); continue; } - } else if (_plist_dict_get_bool(parameters, "_OnlyFWComponents")) { - if (!_plist_dict_get_bool(manifest_entry, "Trusted")) { + } else if (plist_dict_get_bool(parameters, "_OnlyFWComponents")) { + if (!plist_dict_get_bool(manifest_entry, "Trusted")) { debug("DEBUG: %s: Skipping '%s' as it is not trusted\n", __func__, key); continue; } @@ -711,7 +711,7 @@ int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrid } /* skip components with IsFTAB:true */ - if (_plist_dict_get_bool(info_dict, "IsFTAB")) { + if (plist_dict_get_bool(info_dict, "IsFTAB")) { debug("DEBUG: %s: Skipping FTAB component '%s'\n", __func__, key); continue; } @@ -730,7 +730,7 @@ int tss_request_add_ap_tags(plist_t request, plist_t parameters, plist_t overrid } /* Make sure we have a Digest key for Trusted items even if empty */ - if (_plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) { + if (plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) { debug("DEBUG: No Digest data, using empty value for entry %s\n", key); plist_dict_set_item(tss_entry, "Digest", plist_new_data(NULL, 0)); } @@ -755,22 +755,22 @@ int tss_request_add_baseband_tags(plist_t request, plist_t parameters, plist_t o plist_dict_set_item(request, "@BBTicket", plist_new_bool(1)); - _plist_dict_copy_uint(request, parameters, "BbChipID", NULL); - _plist_dict_copy_data(request, parameters, "BbProvisioningManifestKeyHash", NULL); + plist_dict_copy_uint(request, parameters, "BbChipID", NULL); + plist_dict_copy_data(request, parameters, "BbProvisioningManifestKeyHash", NULL); /* BbActivationManifestKeyHash - Used by Qualcomm MDM6610 */ - _plist_dict_copy_data(request, parameters, "BbActivationManifestKeyHash", NULL); - _plist_dict_copy_data(request, parameters, "BbCalibrationManifestKeyHash", NULL); - _plist_dict_copy_data(request, parameters, "BbFactoryActivationManifestKeyHash", NULL); - _plist_dict_copy_data(request, parameters, "BbFDRSecurityKeyHash", NULL); + plist_dict_copy_data(request, parameters, "BbActivationManifestKeyHash", NULL); + plist_dict_copy_data(request, parameters, "BbCalibrationManifestKeyHash", NULL); + plist_dict_copy_data(request, parameters, "BbFactoryActivationManifestKeyHash", NULL); + plist_dict_copy_data(request, parameters, "BbFDRSecurityKeyHash", NULL); /* BbSkeyId - Used by XMM 6180/GSM */ - _plist_dict_copy_data(request, parameters, "BbSkeyId", NULL); - _plist_dict_copy_data(request, parameters, "BbNonce", NULL); - _plist_dict_copy_uint(request, parameters, "BbGoldCertId", NULL); + plist_dict_copy_data(request, parameters, "BbSkeyId", NULL); + plist_dict_copy_data(request, parameters, "BbNonce", NULL); + plist_dict_copy_uint(request, parameters, "BbGoldCertId", NULL); - uint64_t bb_chip_id = _plist_dict_get_uint(request, "BbChipID"); - int32_t bb_cert_id = (int32_t)_plist_dict_get_uint(request, "BbGoldCertId"); + uint64_t bb_chip_id = plist_dict_get_uint(request, "BbChipID"); + int32_t bb_cert_id = (int32_t)plist_dict_get_uint(request, "BbGoldCertId"); - if (_plist_dict_copy_data(request, parameters, "BbSNUM", NULL) < 0) { + if (plist_dict_copy_data(request, parameters, "BbSNUM", NULL) < 0) { error("ERROR: Unable to find required BbSNUM in parameters\n"); return -1; } @@ -818,28 +818,28 @@ int tss_request_add_se_tags(plist_t request, plist_t parameters, plist_t overrid plist_dict_set_item(request, "@BBTicket", plist_new_bool(1)); - if (_plist_dict_copy_uint(request, parameters, "SE,ChipID", NULL) < 0) { + if (plist_dict_copy_uint(request, parameters, "SE,ChipID", NULL) < 0) { error("ERROR: %s: Unable to find required SE,ChipID in parameters\n", __func__); return -1; } - if (_plist_dict_copy_data(request, parameters, "SE,ID", NULL) < 0) { + if (plist_dict_copy_data(request, parameters, "SE,ID", NULL) < 0) { error("ERROR: %s: Unable to find required SE,ID in parameters\n", __func__); return -1; } - if (_plist_dict_copy_data(request, parameters, "SE,Nonce", NULL) < 0) { + if (plist_dict_copy_data(request, parameters, "SE,Nonce", NULL) < 0) { error("ERROR: %s: Unable to find required SE,Nonce in parameters\n", __func__); return -1; } - if (_plist_dict_copy_data(request, parameters, "SE,RootKeyIdentifier", NULL) < 0) { + if (plist_dict_copy_data(request, parameters, "SE,RootKeyIdentifier", NULL) < 0) { error("ERROR: %s: Unable to find required SE,RootKeyIdentifier in parameters\n", __func__); return -1; } /* 'IsDev' determines whether we have Production or Development */ - uint8_t is_dev = _plist_dict_get_bool(parameters, "SE,IsDev"); + uint8_t is_dev = plist_dict_get_bool(parameters, "SE,IsDev"); /* add SE,* components from build manifest to request */ char* key = NULL; @@ -914,7 +914,7 @@ int tss_request_add_savage_tags(plist_t request, plist_t parameters, plist_t ove plist_dict_set_item(request, "@BBTicket", plist_new_bool(1)); plist_dict_set_item(request, "@Savage,Ticket", plist_new_bool(1)); - if (_plist_dict_copy_data(request, parameters, "Savage,UID", NULL) < 0) { + if (plist_dict_copy_data(request, parameters, "Savage,UID", NULL) < 0) { error("ERROR: %s: Unable to find required Savage,UID in parameters\n", __func__); return -1; } @@ -929,33 +929,33 @@ int tss_request_add_savage_tags(plist_t request, plist_t parameters, plist_t ove plist_dict_set_item(dict, "Digest", plist_copy(node)); plist_dict_set_item(request, "SEP", dict); - if (_plist_dict_copy_uint(request, parameters, "Savage,PatchEpoch", NULL) < 0) { + if (plist_dict_copy_uint(request, parameters, "Savage,PatchEpoch", NULL) < 0) { error("ERROR: %s: Unable to find required Savage,PatchEpoch in parameters\n", __func__); return -1; } - if (_plist_dict_copy_uint(request, parameters, "Savage,ChipID", NULL) < 0) { + if (plist_dict_copy_uint(request, parameters, "Savage,ChipID", NULL) < 0) { error("ERROR: %s: Unable to find required Savage,ChipID in parameters\n", __func__); return -1; } - if (_plist_dict_copy_bool(request, parameters, "Savage,AllowOfflineBoot", NULL) < 0) { + if (plist_dict_copy_bool(request, parameters, "Savage,AllowOfflineBoot", NULL) < 0) { error("ERROR: %s: Unable to find required Savage,AllowOfflineBoot in parameters\n", __func__); return -1; } - if (_plist_dict_copy_bool(request, parameters, "Savage,ReadFWKey", NULL) < 0) { + if (plist_dict_copy_bool(request, parameters, "Savage,ReadFWKey", NULL) < 0) { error("ERROR: %s: Unable to find required Savage,ReadFWKey in parameters\n", __func__); return -1; } - if (_plist_dict_copy_bool(request, parameters, "Savage,ProductionMode", NULL) < 0) { + if (plist_dict_copy_bool(request, parameters, "Savage,ProductionMode", NULL) < 0) { error("ERROR: %s: Unable to find required Savage,ProductionMode in parameters\n", __func__); return -1; } const char *comp_name = NULL; - uint8_t isprod = _plist_dict_get_bool(request, "Savage,ProductionMode"); + uint8_t isprod = plist_dict_get_bool(request, "Savage,ProductionMode"); /* get the right component name */ comp_name = (isprod) ? "Savage,B0-Prod-Patch" : "Savage,B0-Dev-Patch"; @@ -963,7 +963,7 @@ int tss_request_add_savage_tags(plist_t request, plist_t parameters, plist_t ove if (node && (plist_get_node_type(node) == PLIST_DATA)) { unsigned char *savage_rev = NULL; uint64_t savage_rev_len = 0; - plist_get_data_val(node, (char**)&savage_rev, &savage_rev_len); + plist_get_data_val(node, &savage_rev, &savage_rev_len); if (savage_rev_len > 0) { if (((savage_rev[0] | 0x10) & 0xF0) == 0x30) { comp_name = (isprod) ? "Savage,B2-Prod-Patch" : "Savage,B2-Dev-Patch"; @@ -988,12 +988,12 @@ int tss_request_add_savage_tags(plist_t request, plist_t parameters, plist_t ove *component_name = strdup(comp_name); } - if (_plist_dict_copy_data(request, parameters, "Savage,Nonce", NULL) < 0) { + if (plist_dict_copy_data(request, parameters, "Savage,Nonce", NULL) < 0) { error("ERROR: %s: Unable to find required Savage,Nonce in parameters\n", __func__); return -1; } - if (_plist_dict_copy_bool(request, parameters, "Savage,ReadECKey", NULL) < 0) { + if (plist_dict_copy_bool(request, parameters, "Savage,ReadECKey", NULL) < 0) { error("ERROR: %s: Unable to find required Savage,ReadECKey in parameters\n", __func__); return -1; } @@ -1045,8 +1045,8 @@ int tss_request_add_yonkers_tags(plist_t request, plist_t parameters, plist_t ov char *comp_name = NULL; plist_t comp_node = NULL; - uint8_t isprod = _plist_dict_get_bool(parameters, "Yonkers,ProductionMode"); - uint64_t fabrevision = _plist_dict_get_uint(parameters, "Yonkers,FabRevision"); + uint8_t isprod = plist_dict_get_bool(parameters, "Yonkers,ProductionMode"); + uint64_t fabrevision = plist_dict_get_uint(parameters, "Yonkers,FabRevision"); plist_dict_iter iter = NULL; plist_dict_new_iter(manifest_node, &iter); @@ -1120,16 +1120,16 @@ int tss_request_add_vinyl_tags(plist_t request, plist_t parameters, plist_t over plist_dict_set_item(request, "@BBTicket", plist_new_bool(1)); plist_dict_set_item(request, "@eUICC,Ticket", plist_new_bool(1)); - _plist_dict_copy_bool(request, parameters, "eUICC,ApProductionMode", "ApProductionMode"); - _plist_dict_copy_uint(request, parameters, "eUICC,ChipID", NULL); - _plist_dict_copy_data(request, parameters, "eUICC,EID", NULL); - _plist_dict_copy_data(request, parameters, "eUICC,RootKeyIdentifier", NULL); + plist_dict_copy_bool(request, parameters, "eUICC,ApProductionMode", "ApProductionMode"); + plist_dict_copy_uint(request, parameters, "eUICC,ChipID", NULL); + plist_dict_copy_data(request, parameters, "eUICC,EID", NULL); + plist_dict_copy_data(request, parameters, "eUICC,RootKeyIdentifier", NULL); if (!plist_dict_get_item(request, "eUICC,Gold")) { plist_t n = plist_access_path(parameters, 2, "Manifest", "eUICC,Gold"); if (n) { plist_t p = plist_new_dict(); - _plist_dict_copy_data(p, n, "Digest", NULL); + plist_dict_copy_data(p, n, "Digest", NULL); plist_dict_set_item(request, "eUICC,Gold", p); } } @@ -1138,7 +1138,7 @@ int tss_request_add_vinyl_tags(plist_t request, plist_t parameters, plist_t over plist_t n = plist_access_path(parameters, 2, "Manifest", "eUICC,Main"); if (n) { plist_t p = plist_new_dict(); - _plist_dict_copy_data(p, n, "Digest", NULL); + plist_dict_copy_data(p, n, "Digest", NULL); plist_dict_set_item(request, "eUICC,Main", p); } } @@ -1183,14 +1183,14 @@ int tss_request_add_rose_tags(plist_t request, plist_t parameters, plist_t overr plist_dict_set_item(request, "@BBTicket", plist_new_bool(1)); plist_dict_set_item(request, "@Rap,Ticket", plist_new_bool(1)); - _plist_dict_copy_uint(request, parameters, "Rap,BoardID", NULL); - _plist_dict_copy_uint(request, parameters, "Rap,ChipID", NULL); - _plist_dict_copy_uint(request, parameters, "Rap,ECID", NULL); - _plist_dict_copy_data(request, parameters, "Rap,Nonce", NULL); - _plist_dict_copy_bool(request, parameters, "Rap,ProductionMode", NULL); - _plist_dict_copy_uint(request, parameters, "Rap,SecurityDomain", NULL); - _plist_dict_copy_bool(request, parameters, "Rap,SecurityMode", NULL); - _plist_dict_copy_data(request, parameters, "Rap,FdrRootCaDigest", NULL); + plist_dict_copy_uint(request, parameters, "Rap,BoardID", NULL); + plist_dict_copy_uint(request, parameters, "Rap,ChipID", NULL); + plist_dict_copy_uint(request, parameters, "Rap,ECID", NULL); + plist_dict_copy_data(request, parameters, "Rap,Nonce", NULL); + plist_dict_copy_bool(request, parameters, "Rap,ProductionMode", NULL); + plist_dict_copy_uint(request, parameters, "Rap,SecurityDomain", NULL); + plist_dict_copy_bool(request, parameters, "Rap,SecurityMode", NULL); + plist_dict_copy_data(request, parameters, "Rap,FdrRootCaDigest", NULL); char *comp_name = NULL; plist_dict_iter iter = NULL; @@ -1214,7 +1214,7 @@ int tss_request_add_rose_tags(plist_t request, plist_t parameters, plist_t overr } /* Make sure we have a Digest key for Trusted items even if empty */ - if (_plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) { + if (plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) { debug("DEBUG: No Digest data, using empty value for entry %s\n", comp_name); plist_dict_set_item(manifest_entry, "Digest", plist_new_data(NULL, 0)); } @@ -1250,11 +1250,11 @@ int tss_request_add_veridian_tags(plist_t request, plist_t parameters, plist_t o plist_dict_set_item(request, "@BBTicket", plist_new_bool(1)); plist_dict_set_item(request, "@BMU,Ticket", plist_new_bool(1)); - _plist_dict_copy_uint(request, parameters, "BMU,BoardID", NULL); - _plist_dict_copy_uint(request, parameters, "BMU,ChipID", "ChipID"); - _plist_dict_copy_data(request, parameters, "BMU,Nonce", "Nonce"); - _plist_dict_copy_bool(request, parameters, "BMU,ProductionMode", "ProductionMode"); - _plist_dict_copy_uint(request, parameters, "BMU,UniqueID", "UniqueID"); + plist_dict_copy_uint(request, parameters, "BMU,BoardID", NULL); + plist_dict_copy_uint(request, parameters, "BMU,ChipID", "ChipID"); + plist_dict_copy_data(request, parameters, "BMU,Nonce", "Nonce"); + plist_dict_copy_bool(request, parameters, "BMU,ProductionMode", "ProductionMode"); + plist_dict_copy_uint(request, parameters, "BMU,UniqueID", "UniqueID"); char *comp_name = NULL; plist_dict_iter iter = NULL; @@ -1278,7 +1278,7 @@ int tss_request_add_veridian_tags(plist_t request, plist_t parameters, plist_t o } /* Make sure we have a Digest key for Trusted items even if empty */ - if (_plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) { + if (plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) { debug("DEBUG: No Digest data, using empty value for entry %s\n", comp_name); plist_dict_set_item(manifest_entry, "Digest", plist_new_data(NULL, 0)); } @@ -1314,16 +1314,16 @@ int tss_request_add_tcon_tags(plist_t request, plist_t parameters, plist_t overr plist_dict_set_item(request, "@BBTicket", plist_new_bool(1)); plist_dict_set_item(request, "@Baobab,Ticket", plist_new_bool(1)); - _plist_dict_copy_uint(request, parameters, "Baobab,BoardID", NULL); - _plist_dict_copy_uint(request, parameters, "Baobab,ChipID", NULL); - _plist_dict_copy_data(request, parameters, "Baobab,ECID", NULL); - _plist_dict_copy_uint(request, parameters, "Baobab,Life", NULL); - _plist_dict_copy_uint(request, parameters, "Baobab,ManifestEpoch", NULL); - _plist_dict_copy_bool(request, parameters, "Baobab,ProductionMode", NULL); - _plist_dict_copy_uint(request, parameters, "Baobab,SecurityDomain", NULL); - _plist_dict_copy_data(request, parameters, "Baobab,UpdateNonce", NULL); + plist_dict_copy_uint(request, parameters, "Baobab,BoardID", NULL); + plist_dict_copy_uint(request, parameters, "Baobab,ChipID", NULL); + plist_dict_copy_data(request, parameters, "Baobab,ECID", NULL); + plist_dict_copy_uint(request, parameters, "Baobab,Life", NULL); + plist_dict_copy_uint(request, parameters, "Baobab,ManifestEpoch", NULL); + plist_dict_copy_bool(request, parameters, "Baobab,ProductionMode", NULL); + plist_dict_copy_uint(request, parameters, "Baobab,SecurityDomain", NULL); + plist_dict_copy_data(request, parameters, "Baobab,UpdateNonce", NULL); - uint8_t isprod = _plist_dict_get_bool(parameters, "Baobab,ProductionMode"); + uint8_t isprod = plist_dict_get_bool(parameters, "Baobab,ProductionMode"); char *comp_name = NULL; plist_dict_iter iter = NULL; @@ -1380,28 +1380,28 @@ int tss_request_add_timer_tags(plist_t request, plist_t parameters, plist_t over plist_dict_set_item(request, key, plist_new_bool(1)); - tag = (uint32_t)_plist_dict_get_uint(parameters, "TagNumber"); + tag = (uint32_t)plist_dict_get_uint(parameters, "TagNumber"); sprintf(key, "Timer,BoardID,%u", tag); - _plist_dict_copy_uint(request, parameters, key, NULL); + plist_dict_copy_uint(request, parameters, key, NULL); sprintf(key, "Timer,ChipID,%u", tag); - _plist_dict_copy_uint(request, parameters, key, NULL); + plist_dict_copy_uint(request, parameters, key, NULL); sprintf(key, "Timer,SecurityDomain,%u", tag); - _plist_dict_copy_uint(request, parameters, key, NULL); + plist_dict_copy_uint(request, parameters, key, NULL); sprintf(key, "Timer,SecurityMode,%u", tag); - _plist_dict_copy_bool(request, parameters, key, NULL); + plist_dict_copy_bool(request, parameters, key, NULL); sprintf(key, "Timer,ProductionMode,%u", tag); - _plist_dict_copy_bool(request, parameters, key, NULL); + plist_dict_copy_bool(request, parameters, key, NULL); sprintf(key, "Timer,ECID,%u", tag); - _plist_dict_copy_uint(request, parameters, key, NULL); + plist_dict_copy_uint(request, parameters, key, NULL); sprintf(key, "Timer,Nonce,%u", tag); - _plist_dict_copy_data(request, parameters, key, NULL); + plist_dict_copy_data(request, parameters, key, NULL); char *comp_name = NULL; plist_dict_iter iter = NULL; @@ -1425,7 +1425,7 @@ int tss_request_add_timer_tags(plist_t request, plist_t parameters, plist_t over } /* Make sure we have a Digest key for Trusted items even if empty */ - if (_plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) { + if (plist_dict_get_bool(manifest_entry, "Trusted") && !plist_dict_get_item(manifest_entry, "Digest")) { debug("DEBUG: No Digest data, using empty value for entry %s\n", comp_name); plist_dict_set_item(manifest_entry, "Digest", plist_new_data(NULL, 0)); } @@ -1454,13 +1454,13 @@ int tss_request_add_cryptex_tags(plist_t request, plist_t parameters, plist_t ov if (plist_dict_get_item(parameters, "Ap,LocalPolicy")) { /* Cryptex1LocalPolicy */ tss_request_add_local_policy_tags(request, parameters); - _plist_dict_copy_data(request, parameters, "Ap,NextStageCryptex1IM4MHash", NULL); + plist_dict_copy_data(request, parameters, "Ap,NextStageCryptex1IM4MHash", NULL); } else { /* Cryptex1 */ plist_dict_set_item(request, "@Cryptex1,Ticket", plist_new_bool(1)); - _plist_dict_copy_bool(request, parameters, "ApSecurityMode", NULL); - _plist_dict_copy_bool(request, parameters, "ApProductionMode", NULL); + plist_dict_copy_bool(request, parameters, "ApSecurityMode", NULL); + plist_dict_copy_bool(request, parameters, "ApProductionMode", NULL); plist_dict_iter iter = NULL; plist_dict_new_iter(parameters, &iter); @@ -1659,7 +1659,7 @@ static int tss_response_get_data_by_key(plist_t response, const char* name, unsi return -1; } - char *data = NULL; + uint8_t* data = NULL; uint64_t len = 0; plist_get_data_val(node, &data, &len); if (data) { @@ -1718,7 +1718,7 @@ int tss_response_get_blob_by_path(plist_t tss, const char* path, unsigned char** uint32_t tss_size = 0; uint64_t blob_size = 0; char* entry_key = NULL; - char* blob_data = NULL; + uint8_t* blob_data = NULL; char* entry_path = NULL; plist_t tss_entry = NULL; plist_t blob_node = NULL; @@ -1772,7 +1772,7 @@ int tss_response_get_blob_by_path(plist_t tss, const char* path, unsigned char** int tss_response_get_blob_by_entry(plist_t response, const char* entry, unsigned char** blob) { uint64_t blob_size = 0; - char* blob_data = NULL; + uint8_t* blob_data = NULL; plist_t blob_node = NULL; plist_t tss_entry = NULL; -- cgit v1.1-32-gdbae