A method of detecting illegal execution of code sequences includes the
steps of: setting an active identifier to a first sequence identifier of a
first code sequence, executing at least part of the first code sequence,
calling, from the first code sequence, a second code sequence having a
second sequence identifier, providing (20) a caller sequence identifier
and a callee sequence identifier, checking (21) whether the callee
sequence identifier is the same as the second sequence identifier,
checking (23) whether the caller sequence identifier is the same as the
active identifier, and generating (27) an alarm signal if either of the
checks provide incorrect results.