Im trying to port a legacy app which has some basic bit shifting to decrypt a buffer, but im lost with this powerpc code - i tried my best to understand it and added comments and created a pseudo c function however something is obviously not right.
This is the PPC function, it has one argument i think the buffer (params are: void *,int) http://pastebin.com/RNRAWCpi
this is as far as my pseudo c has advanced:
unsigned long long* data=(unsigned long long*)pBuffer; // file data
unsigned long long crypt = 0x0000;
unsigned long long next_crypt;
unsigned int len = size >> 3;
for(unsigned int i=0; i<len;i++) {
next_crypt = crypt+data[i]-0x9A6C9A19;
data[i] = ((data[i]<<0x18)|(data[i]>>0x14))+0x9A6C9A19;
data[i] = (data[i]<<0x3)|(data[i]>>0x29);
data[i] = data[i] - crypt;
crypt = next_crypt;
}
For example, why is crypt split into two registers r29 & r30
Any assistance would be greatly appreciated.
If the PowerPC is 32bit then a "long long" (64bits) would need to be split into 2 32bit registers. Do you have any other specific questions?