The situation is the following:

I'm reversing an application, In which I found a lot of functions that belongs to the OpenSSL library. Since I have the source code for this module, I was wondering if it's possible to somehow "extract" the variable names, structures, function names from the source code, and sync/map it to IDA?

  • 1
    Most likely not. You'd probably have to build the same version of OpenSSL, under the same version of the same compiler with the same settings to get a binary that's close enough to what you're RE'ing, in order to perform any simple matching. Commented Dec 12, 2013 at 5:52
  • 1
    Or, you can just compile this source code with all the symbols and analyze it, diff it with what you have. I'm pretty sure even if the compiled binary will not be exactly the same, but it will be very close. To be even more close, you can try to compile with the same compiler the original binary was compiled.
    – PhoeniX
    Commented Dec 12, 2013 at 8:07
  • 1
    Even if you compile with different settings, the order of functions will be the same. So if you can identify one function, then the following functions should be the same as the ones following before/after it in the source module.
    – Devolus
    Commented Dec 18, 2013 at 8:26
  • @Devolus Okey, but how can I automate this process? I mean I compiled the said module, I recognize the functions, but I can't manually name all the variables and function names. Commented Dec 18, 2013 at 9:12
  • 1
    I don't think you can automatize this, as there is no sure mapping between variables and the resulting code, especially if compiled with optimizer. I don't see why this should matter though. For reversing, it would be enough to know the signatures of the library, and if you want to make a compilable code, then you can use the source anyway, unless the code relies on some specific behaviour of that particular version, which is doubtfull imo.
    – Devolus
    Commented Dec 18, 2013 at 9:22

1 Answer 1

  1. Build the module with debug symbols
  2. Load the module you built into IDA Pro and import the debug symbols
  3. Use BinDiff to port function names, etc. from the IDB of the module you built to the IDB of your target module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.