title: Protecting executable from reverse engineering?
body: <p>I've been contemplating how to protect my C/C++ code from disassembly and reverse engineering.  Normally I would never condone this behavior myself in my code; however the current protocol I've been working on must not ever be inspected or understandable, for the security of various people.</p>
  
  <p>Now this is a new subject to me, and the internet is not really resourceful for <em>prevention against reverse engineering</em> but rather depicts tons of information on <em>how to reverse engineer</em></p>
  
  <p>Some of the things I've thought of so far are:</p>
  
  <ul>
  <li>Code injection (calling dummy functions before and after actual function calls)</li>
  <li>Code obfustication (mangles the disassembly of the binary)</li>
  <li><p>Write my own startup routines (harder for debuggers to bind to)  </p>
  
  <p></p>
  
  <pre><code>void startup();  
  int _start()   
  {  
      startup( );  
      exit   (0)   
  }  
  void startup()  
  {  
      /* code here */  
  }
  </code></pre></li>
  <li><p>Runtime check for debuggers (and force exit if detected)</p></li>
  <li><p>Function trampolines</p>
  
  <p></p>
  
  <pre><code> void trampoline(void (*fnptr)(), bool ping = false)  
   {  
     if(ping)  
       fnptr();  
     else  
       trampoline(fnptr, true);  
   }
  </code></pre></li>
  <li><p>Pointless allocations and deallocations (stack changes a lot)</p></li>
  <li>Pointless dummy calls and trampolines (tons of jumping in disassembly output)</li>
  <li>Tons of casting (for obfuscated disassembly)</li>
  </ul>
  
  <p>I mean these are some of the things I've thought of but they can all be worked around and or figured out by code analysts given the right time frame.  Is there anything else alternative I have?</p>