From afae03eb78cfa6c3982a382f010bc0fae959651a Mon Sep 17 00:00:00 2001 From: Gregor Haas Date: Sun, 5 Jan 2020 19:02:31 -0500 Subject: [PATCH] Correct byte order --- c8_remote/main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/c8_remote/main.c b/c8_remote/main.c index 87b94f6..6a686a5 100644 --- a/c8_remote/main.c +++ b/c8_remote/main.c @@ -4,9 +4,9 @@ #include #include -#include "usb_helpers.h" #include "command.h" #include "payload.h" +#include "usb_helpers.h" #ifdef CHECKM8_LOGGING #include @@ -41,7 +41,6 @@ void checkm8_debug_block(const char *format, ...) #endif } - int main() { int ret; @@ -53,8 +52,8 @@ int main() return -1; } - unsigned long long data0 = 0xdeadbeefdeadbeef; - unsigned long long data1 = 0xdeadbeefdeadbeef; + unsigned char data0[8] = {0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef}; + unsigned char data1[8] = {0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef}; ret = open_device_session(dev); if(IS_CHECKM8_FAIL(ret)) @@ -68,12 +67,12 @@ int main() printf("encrypting "); for(int j = 0; j < 8; j++) { - printf("%02X", ((unsigned char *) &data0)[j]); + printf("%02X", data0[j]); } for(int j = 0; j < 8; j++) { - printf("%02X", ((unsigned char *) &data1)[j]); + printf("%02X", data1[j]); } printf("\n"); @@ -84,7 +83,8 @@ int main() 16, // data size 0x20000201, // AES_UID_KEY 0, 0, // no - data0, data1); + *((unsigned long long *) data0), + *((unsigned long long *) data1)); if(IS_CHECKM8_FAIL(resp->ret)) { @@ -107,7 +107,7 @@ int main() printf("%02X", ((unsigned char *) &data1)[j]); } printf("\n"); - usleep(250000); + usleep(333333); } close_device_session(dev);