In a method for protecting a calculation in a cryptographic algorithm, the
calculation obtaining input data so as to create output data, input data
for the calculation are initially provided. Subsequently, the calculation
is performed so as to obtain the output data of the calculation. After
the calculation has been performed, a verification is carried out as to
whether the input data was changed during the calculation, to be precise
using a verification algorithm which differs from the calculation itself.
If the verification proves that the input data was changed during the
calculation, forwarding of the output data is suppressed. By doing so,
outputting of incorrect results of the calculation of the cryptographic
algorithm is prevented with a high degree of certainty, since the input
data is particularly susceptible to hardware attacks. In addition, the
input data may be examined with a view to their integrity with little
expenditure compare to calculating the cryptographic algorithm itself.