A secure processing device having a power saving mode, which is used for
built-in apparatuses, calculates a hash value of secure data that needs
to be saved when switching to the power saving mode, stores the
calculated hash value in a protection storage unit whose data is not lost
even in the power saving mode, encrypts the secure data and stores the
encrypted data in an external memory when switching to the power saving
mode. When switching back to the normal power mode, the secure processing
device decrypts the encrypted data, calculates a hash value of the
decrypted data and compares the hash value with the hash value stored in
the protection storage unit. The decrypted data is restored to the
protection storage unit when the hash values are identical, but discarded
together with the encrypted data stored in the external memory when the
hash values are not identical.