This commit is contained in:
2019-12-07 14:22:10 -05:00
parent 3e5974b9b5
commit 413de9fb6d
8 changed files with 147 additions and 78 deletions

View File

@@ -1,4 +1,5 @@
#include <string.h>
#include <stdio.h>
#include "libusb_helpers.h"
#include "checkm8.h"
@@ -40,11 +41,12 @@ int command(unsigned char *request_data, int request_len, unsigned char *respons
int execute(unsigned long *args, int nargs, unsigned char *response_buf, int response_len)
{
unsigned long cmd_buf[nargs + 1];
cmd_buf[0] = EXEC_MAGIC;
memcpy(&cmd_buf[1], args, 8 * nargs);
unsigned char cmd_buf[8 * (nargs + 1)];
unsigned long exec = EXEC_MAGIC;
return command((unsigned char *) cmd_buf, 8 * (nargs + 1), response_buf, response_len);
memcpy(cmd_buf, &exec, 8);
memcpy(&cmd_buf[8], args, 8 * nargs);
return command(cmd_buf, 8 * (nargs + 1), response_buf, response_len);
}
@@ -65,5 +67,9 @@ int aes(unsigned char *source, unsigned char *target, int encrypt, int key)
int ret = execute(args, 10, response, 32);
memcpy(target, &response[16], 16);
for(int i = 0; i < 16; i++)
{
printf("%02x", target[i]);
}
return ret;
}