Skip to content

Commit

Permalink
Fix some variable types for more consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
nikias committed Mar 22, 2024
1 parent fdbf383 commit 012e0aa
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions src/dfu.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ int dfu_is_image4_supported(struct idevicerestore_client_t* client)
return (device_info->ibfl & IBOOT_FLAG_IMAGE4_AWARE);
}

int dfu_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size)
int dfu_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size)
{
if(client->dfu == NULL) {
if (dfu_client_new(client) < 0) {
Expand All @@ -263,7 +263,7 @@ int dfu_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** non
return 0;
}

int dfu_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size)
int dfu_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size)
{
if(client->dfu == NULL) {
if (dfu_client_new(client) < 0) {
Expand Down Expand Up @@ -417,7 +417,7 @@ int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_ide

/* get nonce */
unsigned char* nonce = NULL;
int nonce_size = 0;
unsigned int nonce_size = 0;
int nonce_changed = 0;
if (dfu_get_ap_nonce(client, &nonce, &nonce_size) < 0) {
error("ERROR: Unable to get ApNonce from device!\n");
Expand Down
4 changes: 2 additions & 2 deletions src/dfu.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ int dfu_send_buffer(struct idevicerestore_client_t* client, unsigned char* buffe
int dfu_send_component(struct idevicerestore_client_t* client, plist_t build_identity, const char* component);
int dfu_get_cpid(struct idevicerestore_client_t* client, unsigned int* cpid);
int dfu_is_image4_supported(struct idevicerestore_client_t* client);
int dfu_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int dfu_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int dfu_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size);
int dfu_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size);
int dfu_enter_recovery(struct idevicerestore_client_t* client, plist_t build_identity);


Expand Down
14 changes: 7 additions & 7 deletions src/idevicerestore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client)

if (client->build_major > 8) {
unsigned char* nonce = NULL;
int nonce_size = 0;
unsigned int nonce_size = 0;
if (get_ap_nonce(client, &nonce, &nonce_size) < 0) {
/* the first nonce request with older firmware releases can fail and it's OK */
info("NOTE: Unable to get nonce from device\n");
Expand Down Expand Up @@ -1265,7 +1265,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
if (!client->image4supported && (client->build_major > 8)) {
// we need another tss request with nonce.
unsigned char* nonce = NULL;
int nonce_size = 0;
unsigned int nonce_size = 0;
int nonce_changed = 0;
if (get_ap_nonce(client, &nonce, &nonce_size) < 0) {
error("ERROR: Unable to get nonce from device!\n");
Expand Down Expand Up @@ -1810,7 +1810,7 @@ int is_image4_supported(struct idevicerestore_client_t* client)
return res;
}

int get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size)
int get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size)
{
int mode = _MODE_UNKNOWN;

Expand Down Expand Up @@ -1861,7 +1861,7 @@ int get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce,
return 0;
}

int get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size)
int get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size)
{
int mode = _MODE_UNKNOWN;

Expand Down Expand Up @@ -2102,7 +2102,7 @@ int get_tss_response(struct idevicerestore_client_t* client, plist_t build_ident
plist_dict_set_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size));
}
unsigned char* sep_nonce = NULL;
int sep_nonce_size = 0;
unsigned int sep_nonce_size = 0;
get_sep_nonce(client, &sep_nonce, &sep_nonce_size);

if (sep_nonce) {
Expand Down Expand Up @@ -2226,7 +2226,7 @@ int get_recoveryos_root_ticket_tss_response(struct idevicerestore_client_t* clie
plist_dict_set_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size));
}
unsigned char* sep_nonce = NULL;
int sep_nonce_size = 0;
unsigned int sep_nonce_size = 0;
get_sep_nonce(client, &sep_nonce, &sep_nonce_size);

/* ApSepNonce */
Expand Down Expand Up @@ -2405,7 +2405,7 @@ int get_local_policy_tss_response(struct idevicerestore_client_t* client, plist_
plist_dict_set_item(parameters, "ApNonce", plist_new_data((const char*)client->nonce, client->nonce_size));
}
unsigned char* sep_nonce = NULL;
int sep_nonce_size = 0;
unsigned int sep_nonce_size = 0;
get_sep_nonce(client, &sep_nonce, &sep_nonce_size);

if (sep_nonce) {
Expand Down
4 changes: 2 additions & 2 deletions src/idevicerestore.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ const char* idevicerestore_get_error(void);
irecv_device_t get_irecv_device(struct idevicerestore_client_t* client);
int get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid);
int is_image4_supported(struct idevicerestore_client_t* client);
int get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size);
int get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size);
int get_tss_response(struct idevicerestore_client_t* client, plist_t build_identity, plist_t* tss);
int get_local_policy_tss_response(struct idevicerestore_client_t* client, plist_t build_identity, plist_t* tss);
int get_recoveryos_root_ticket_tss_response(struct idevicerestore_client_t* client, plist_t build_identity, plist_t* tss);
Expand Down
8 changes: 4 additions & 4 deletions src/normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ plist_t normal_get_lockdown_value(struct idevicerestore_client_t* client, const
return node;
}

static int normal_get_nonce_by_key(struct idevicerestore_client_t* client, const char* key, unsigned char** nonce, int* nonce_size)
static int normal_get_nonce_by_key(struct idevicerestore_client_t* client, const char* key, unsigned char** nonce, unsigned int* nonce_size)
{
plist_t nonce_node = normal_get_lockdown_value(client, NULL, key);

Expand All @@ -334,18 +334,18 @@ 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);
*nonce_size = (int)n_size;
*nonce_size = (unsigned int)n_size;
plist_free(nonce_node);

return 0;
}

int normal_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size)
int normal_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size)
{
return normal_get_nonce_by_key(client, "SEPNonce", nonce, nonce_size);
}

int normal_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size)
int normal_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size)
{
return normal_get_nonce_by_key(client, "ApNonce", nonce, nonce_size);
}
Expand Down
4 changes: 2 additions & 2 deletions src/normal.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ int normal_check_mode(struct idevicerestore_client_t* client);
irecv_device_t normal_get_irecv_device(struct idevicerestore_client_t* client);
int normal_enter_recovery(struct idevicerestore_client_t* client);
int normal_is_image4_supported(struct idevicerestore_client_t* client);
int normal_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int normal_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int normal_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size);
int normal_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size);
int normal_get_preflight_info(struct idevicerestore_client_t* client, plist_t *preflight_info);
plist_t normal_get_lockdown_value(struct idevicerestore_client_t* client, const char* domain, const char* key);
int normal_handle_create_stashbag(struct idevicerestore_client_t* client, plist_t manifest);
Expand Down
4 changes: 2 additions & 2 deletions src/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ int recovery_is_image4_supported(struct idevicerestore_client_t* client)
return (device_info->ibfl & IBOOT_FLAG_IMAGE4_AWARE);
}

int recovery_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size)
int recovery_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size)
{
if(client->recovery == NULL) {
if (recovery_client_new(client) < 0) {
Expand All @@ -562,7 +562,7 @@ int recovery_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char*
return 0;
}

int recovery_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size)
int recovery_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size)
{
if(client->recovery == NULL) {
if (recovery_client_new(client) < 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/recovery.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ int recovery_send_reset(struct idevicerestore_client_t* client);
int recovery_send_ticket(struct idevicerestore_client_t* client);
int recovery_set_autoboot(struct idevicerestore_client_t* client, int enable);
int recovery_is_image4_supported(struct idevicerestore_client_t* client);
int recovery_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int recovery_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, int* nonce_size);
int recovery_get_ap_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size);
int recovery_get_sep_nonce(struct idevicerestore_client_t* client, unsigned char** nonce, unsigned int* nonce_size);


#ifdef __cplusplus
Expand Down

0 comments on commit 012e0aa

Please sign in to comment.