摘要 |
Self-modifying software code comprising a number of modules (F1, F2) that each may be modified to be in a plurality of states (S1, S1 ) during execution. In order to verify the integrity of such code, the different states of the code are calculated. For each state a checksum, e.g. a hash value, is generated for at least part of the code. During execution the state of the code is changed (320), modifying (330) a module (F1, F2), and an integrity check is performed (340) using the checksum for the state of the code. The checksum may be stored in a look-up table (434) or it may be embedded in the integrity verification function. A state variable (S) indicating the state of the modules may be used to look-up the checksum in the table (434). Possible states of a module is encrypted and decrypted. Also provided is an apparatus (420) for generating protected software code (430). |