some fixes

This commit is contained in:
2020-02-09 12:53:25 -05:00
parent cd3eb5edf0
commit 5c8579c913
2 changed files with 44 additions and 43 deletions

View File

@@ -231,7 +231,7 @@ void aes_sw(struct pwned_device *dev)
return;
}
for(int i = 0; i < 100; i++)
for(i = 0; i < 100; i++)
{
resp = execute_payload(dev, PAYLOAD_AES_SW, 0, 7,
addr_data, 16, addr_key,
@@ -286,46 +286,47 @@ int main()
}
demote_device(dev);
aes_sw(dev);
if(IS_CHECKM8_FAIL(install_payload(dev, PAYLOAD_SYNC, SRAM)))
{
printf("failed to install sync payload\n");
return -1;
}
if(IS_CHECKM8_FAIL(install_payload(dev, PAYLOAD_TASK_SLEEP_TEST, SRAM)))
{
printf("failed to install exit usb task payload\n");
return -1;
}
if(IS_CHECKM8_FAIL(install_payload(dev, PAYLOAD_FLOPPYSLEEP, SRAM)))
{
printf("failed to install floppysleep\n");
return -1;
}
float init_a = -7.504355E-39f;
resp = write_gadget(dev, 0x180154000, (unsigned char *) &init_a, sizeof(float));
free_dev_cmd_resp(resp);
resp = execute_payload(dev, PAYLOAD_SYNC, 0, 0);
if(IS_CHECKM8_FAIL(resp->ret))
{
printf("failed to execute bootstrap\n");
return -1;
}
free_dev_cmd_resp(resp);
resp = execute_payload(dev, PAYLOAD_TASK_SLEEP_TEST, 0, 2, 0x180152000, 0x180154000);
if(IS_CHECKM8_FAIL(resp->ret))
{
printf("failed to exit usb task\n");
return -1;
}
free_dev_cmd_resp(resp);
close_device_session(dev);
// if(IS_CHECKM8_FAIL(install_payload(dev, PAYLOAD_SYNC, SRAM)))
// {
// printf("failed to install sync payload\n");
// return -1;
// }
//
// if(IS_CHECKM8_FAIL(install_payload(dev, PAYLOAD_TASK_SLEEP_TEST, SRAM)))
// {
// printf("failed to install exit usb task payload\n");
// return -1;
// }
//
// if(IS_CHECKM8_FAIL(install_payload(dev, PAYLOAD_FLOPPYSLEEP, SRAM)))
// {
// printf("failed to install floppysleep\n");
// return -1;
// }
//
// float init_a = -7.504355E-39f;
// resp = write_gadget(dev, 0x180154000, (unsigned char *) &init_a, sizeof(float));
// free_dev_cmd_resp(resp);
//
// resp = execute_payload(dev, PAYLOAD_SYNC, 0, 0);
// if(IS_CHECKM8_FAIL(resp->ret))
// {
// printf("failed to execute bootstrap\n");
// return -1;
// }
// free_dev_cmd_resp(resp);
//
// resp = execute_payload(dev, PAYLOAD_TASK_SLEEP_TEST, 0, 2, 0x180152000, 0x180154000);
// if(IS_CHECKM8_FAIL(resp->ret))
// {
// printf("failed to exit usb task\n");
// return -1;
// }
// free_dev_cmd_resp(resp);
//
// close_device_session(dev);
free_device(dev);
}

View File

@@ -98,7 +98,7 @@ void free_payload(struct payload *p)
unsigned long long get_address(struct pwned_device *dev, LOCATION_T l, int len)
{
checkm8_debug_indent("get_address(dev = %p, loc = %i, len = %i)\n");
checkm8_debug_indent("get_address(dev = %p, loc = %i, len = %i)\n", dev, l, len);
unsigned long long addr_malloc = 0x10000efe0, retval;
unsigned long long malloc_args[2] = {addr_malloc, (unsigned long long) len};
@@ -113,7 +113,7 @@ unsigned long long get_address(struct pwned_device *dev, LOCATION_T l, int len)
retval = resp->retval;
free_dev_cmd_resp(resp);
checkm8_debug_indent("\tgot address %X\n", retval);
checkm8_debug_indent("\tgot address %llX\n", retval);
return retval;
}
@@ -224,7 +224,7 @@ int uninstall_payload(struct pwned_device *dev, PAYLOAD_T p)
unsigned long long install_data(struct pwned_device *dev, LOCATION_T loc, unsigned char *data, int len)
{
checkm8_debug_indent("install_data(dev = %p, loc = %i, data = %p, len = %i)\n");
checkm8_debug_indent("install_data(dev = %p, loc = %i, data = %p, len = %i)\n", dev, loc, data, len);
struct dev_cmd_resp *resp;
unsigned long long addr = get_address(dev, loc, len);