Skip to content

Instantly share code, notes, and snippets.

@matteyeux
Created September 25, 2019 15:29
Show Gist options
  • Save matteyeux/4092286925f0795f6574ec1b78c976fc to your computer and use it in GitHub Desktop.
Save matteyeux/4092286925f0795f6574ec1b78c976fc to your computer and use it in GitHub Desktop.
/*
* some code I put here to not forget it
*/
typedef int (*aes_crypto_cmd_t)(unsigned int op, void* src, void* dst, int size, unsigned int hwKey, void* iv, void* key);
int main(void)
{
// Set hardcoded aes_hw_crypto_cmd offset here...
aes_crypto_cmd_t mahAESThing = (aes_crypto_cmd_t) 0x0;
// Copy the KBAG to someAddy...
memcpy((void*) someAddy, (void*) KBAGloc, 0x30);
mahAESThing(0x11,(void*) someAddy,(void*)someAddy,0x30,0x20000200,0,0); // (0x10 == ENCRYPT & 0x11 == DECRYPT)
// Hexdump the area of someAddy to grab the result :)
return 0;
}
// Sample code to 32-bit endian byte flip
#if 0
uint32_t key[] = {
0xF8A555D2, 0x00000000, 0x00000000, 0x00000000,
0xF4DFD3CB, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
};
int main(void)
{
int i;
for(i = 0; i < (sizeof(key)/sizeof(uint32_t)); i++) {
printf("%08X", __builtin_bswap32(key[i]));
}
return 0;
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment