1. A method of transforming a software program from an original form to a more secure form by changing the control flow structure of the program to protect the program against static and dynamic attacks, comprising: a) analyzing the original function-call structure and function-call layout of the program; b) transforming the original function-call layout to a new function-call layout; c) transforming the original function-call structure to a new function-call structure that is able to perform dynamic self modifications; d) producing a transformed program having a transformed control flow structure, but which is semantically equivalent to the original program; said transformed program configured to transform the original function-call graph to a new function-call graph upon execution.