Android Memory Encryption Analysis: Cryptography Function Breakdown
This function appears to perform some kind of cryptography operation on a given input. Here is a breakdown of the function:
- It first retrieves the address of a library using the
GetLibAddr()function. - It assigns the value of the library's offset (stored at the address + 32) to
v2and the library's base address (stored at the address + 24) tov3. - It calculates the end address of the library by adding
v2tov3and shifts it left by 20 bits. This value is then subtracted by 1 and the result is shifted right by 32 bits. Finally, the result is added to the right-shifted value ofv3 + v2to getv6. - It calls
j_mprotect()to change the memory privileges of the library. If the result is non-zero, it logs an error message. - It iterates over the memory range from
v5tov8(exclusive) and performs a bitwise XOR operation on each byte with the value 0x88. - It calls
j___clear_cache()to invalidate the instruction cache for the modified memory range. - It calls
j_mprotect()again to restore the original memory privileges. If the result is non-zero, it logs an error message. - It returns the result of the second
j_mprotect()call.
Overall, it appears that the function modifies and encrypts a portion of memory in the library, and then restores the original memory privileges. The purpose and specific details of the cryptography operation are not clear from this code snippet.
原文地址: https://www.cveoy.top/t/topic/qFwQ 著作权归作者所有。请勿转载和采集!