An information processing device for obtaining an HMAC, comprising:
- a padding circuit to generate first key data K0 by adding 0 with respect to secret key data K when a secret key length (Length(K)) of input secret key data K is shorter than a block length (Length(B)) of a hash function, to set the secret key data K as second key data K0 when the secret key length (Length(K)) is equal to the block length (Length(B)) of the hash function, to generate third key data K0 by adding 0 with respect to a first digest value H(K), which is a digest value of the secret key data K, when the secret key length (Length(K)) is longer than the block length (Length(B)) of the hash function, and to perform an exclusive OR operation with a first constant ipad with respect to one of the first key data K0, the second key data K0, and the third key data K0 to calculate first data (K0 xor ipad);
- a hash calculation circuit to obtain the first digest value H(K), and obtaining a second digest value H(K0 xor ipad)∥M), which is a digest value of data (K0 xor ipad)∥M) in which the first data (K0 xor pad) and the input message data M are connected;
- a holding circuit to store the secret key data K or the first digest value H(K);
- and
- a control unit to manage a processing state for calculating the HMAC, wherein
- the hash calculation circuit outputs a midway progress of the first digest value H(K) calculated before the interruption to outside when interrupting a calculation process of the first digest value H(K) in the middle, and is input with the midway progress of the first digest value H(K) to calculate the first digest value H(K) using the midway progress of the first digest value H(K) when resuming the calculation process of the first digest value H(K),
- the hash calculation circuit outputs a midway progress of the second digest value H(K0 xor ipad)∥M) calculated before the interruption to outside when interrupting a calculation process of the second digest value H(K0 xor ipad)∥M) in the middle, and is input with the midway progress of the second digest value H(K0 xor ipad)∥M) to calculate the second digest value H(K0 xor ipad)∥M) using the midway progress of the second digest value H(K0 xor ipad)∥M) when resuming the calculation process of the second digest value H(K0 xor ipad)∥M),
- the holding circuit outputs the secrete key data K or the first digest value H(K) to outside when the hash calculation circuit interrupts the calculation process of the second digest value H(K0 xor ipad)∥M) in the middle, and is input with the secret key data K or the first digest value H(K) when the hash calculation circuit resumes the calculation process of the second digest value H(K0 xor ipad)∥M),
- the hash calculation circuit resumes the calculation process of the first digest value H(K) when a signal indicating resuming instruction of the calculation process of the first digest value H(K) is input to the control unit, and
- the hash calculation circuit resumes the calculation process of the second digest value H(K0 xor ipad)∥M) when a signal indicating resuming instruction of the calculation process of the second digest value H(K0 xor ipad)∥M) is input to the control unit.