diff --git a/c8_payloads/include/brfunc_common.h b/c8_payloads/include/brfunc_common.h index dc6e34a..4e2d41d 100644 --- a/c8_payloads/include/brfunc_common.h +++ b/c8_payloads/include/brfunc_common.h @@ -27,6 +27,7 @@ typedef int (*BOOTROM_FUNC)(); #define ADDR_CLOCK_GATE 0x100009d4c #define ADDR_SYSTEM_TIME 0x10000B0E0 #define ADDR_TIME_HAS_ELAPSED 0x10000B04F +#define ADDR_TASK_SLEEP 0x10000ADF0 #else #error "Unsupported checkm8 platform" diff --git a/c8_payloads/include/brfunc_timing.h b/c8_payloads/include/brfunc_timing.h index b3eac15..9abea32 100644 --- a/c8_payloads/include/brfunc_timing.h +++ b/c8_payloads/include/brfunc_timing.h @@ -7,4 +7,10 @@ #define SYSTEM_TIME ((BOOTROM_FUNC) ADDR_SYSTEM_TIME) #define TIME_HAS_ELAPSED ((BOOTROM_FUNC) ADDR_TIME_HAS_ELAPSED) +PAYLOAD_SECTION +void task_sleep(unsigned int usec) +{ + ((BOOTROM_FUNC) ADDR_TASK_SLEEP)(usec); +} + #endif //CHECKM8_TOOL_BRFUNC_TIMING_H diff --git a/c8_payloads/src/aes_busy.c b/c8_payloads/src/aes_busy.c index 49b880e..b3783e6 100644 --- a/c8_payloads/src/aes_busy.c +++ b/c8_payloads/src/aes_busy.c @@ -1,5 +1,6 @@ #include "util.h" #include "brfunc_aes.h" +#include "brfunc_timing.h" TEXT_SECTION @@ -12,10 +13,12 @@ int _start(void *src, void *dst, void *key, int rep) src_data[j] = ((unsigned char *) src)[j]; } + task_sleep(100); for(i = 0; i < rep; i++) { if(i % 2 == 0) aes_hw_crypto_cmd(16, src_data, dst, 16, 0, key, 0); else aes_hw_crypto_cmd(16, dst, src_data, 16, 0, key, 0); + task_sleep(15); } return 0;