I want to insert the check function which verify the function hash and ensure the function integrity.
My scheme is
- get the function start&end address
- insert the function which calculates the function hash from the start to end address.
So far, I find the way to get function addres at iR time using llvm::blockaddress
However, I get into trouble when get the function hash.
Can I insert a function which calc the hash and verify the hash?
I’ve watch the
2017 LLVM Developers’ Meeting: "Challenges when building an LLVM bitcode Obfuscator"
But the lecture said using JIT to generate the hash, but not mention how to insert the function which read the assemble text and calc hash.
I’m new to this, and wonder how to achieve the hash function. Is there any LLVM util helps?
(BTW, even if calc hash bring problems, it doesn’t matter
Thanks a lot in advance.