I would like to learn more about RE.
I wrote a simple program on a STM32F107 which does nothing else than encrypting and decrypting a text once using AES128-ECB.
Here is the C code (I intentionally left out the key so far):
struct AES_ctx TestAes;
uint8_t key[16] =
{ MY_KEY_IS_HERE };
uint8_t InputText[16] =
{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0 };
AES_init_ctx(&TestAes, key);
AES_ECB_encrypt(&TestAes, InputText);
AES_ECB_decrypt(&TestAes, InputText);
Now I want to find the 16 byte private key in my binary.
When I open the binary in a hex editor and search for my key I find all 16 bytes in a row.
I loaded the binary in Ghidra, installed FindCrypt before and now run the analysis.
FindCrypt now finds AES_Decrytion_SBox_Inverse and AES_Ecryption_SBox.
But both are not my AES key but the SBox. How does it go on after that? In all tutorials I find it looks quite simple, because the Functions Finder finds the AES functions - but since the project is Bare Metal this will probably not work.
I thought FindCrypt looks for some kind of hex pattern which could result in a key...
I have attached the binary. endian is little, architecture is ARM Cortex (I think?!)