/usr/bin/avos:AOS decipher SIGx block()
From ArchosDocs
Description
The callback function returns an MPK key with which 128 bytes of the data in sig are decrypted.
Notice that in the case the call to RSADecipher() fails, the contents of bigint.data is still copied back to sig.
The Code
int AOS_decipher_SIGx_block(char *sig, (char *callback)()) {
struct { // -0x428
uint32_t bits;
char data[128];
} bigint;
char *bigkey[24?]; // -0x320
int ret; // -0x008
if(callback == NULL)
return 1; // failure
// initialize bigkey with the mpk key provided by the callback function
if(Key_LoadMPK(&bigkey, (*callback)()) != 0)
return 1; // failure
// initialize bigint with 128 bytes of the data contained in *sig
Biginteger_Init(&bigint);
bigint.bits = 1024;
Biginteger_Malloc(memcpy(&bigint.data, sig, 128)); // weird?
// decrypt the data contained in bigint with bigkey
if(RSADecipher(&bigkey, &bigint) == 0) {
ret = 0;
} else {
ret = 1;
}
Biginteger_Free(memcpy(sig, &bigint.data, 128)); // weird?
return ret;
}

