了解带位旋转的 PowerPC 汇编器函数
我试图移植一个遗留应用程序,它有一些基本的位移来解密缓冲区,但我迷失了这个 powerpc 代码 - 我尽力理解它并添加了注释并创建了一个伪 c 函数,但是有些东西显然是不对的。
这是 PPC 函数,它有一个参数,我认为是缓冲区(参数是:void *,int)http://pastebin。 com/RNRAWCpi
这是我的伪 c 所进步的程度:
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;
}
例如,为什么 crypt 分为两个寄存器 r29 和 r29 。 r30
如有任何帮助,我们将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果 PowerPC 是 32 位,则需要将“long long”(64 位)拆分为 2 个 32 位寄存器。您还有其他具体问题吗?
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?