A semiconductor device comprising a memory, a random number generation circuit, and a control circuit, receiving encrypted update data from an external server device, and providing the received encrypted update data for an external terminal device, wherein
- the memory stores a common key that is available between the memory and the external server device,
- the control circuit receives, from the external server device, encryption key data including a first random number signal, a second random number signal, and a sixth random number signal encrypted by the common key, and encrypted update data,
- the control circuit decrypts the encryption key data by the common key to generate a sixth random number signal,
- the control circuit outputs the first random number signal and the second random number signal as request signals to be transmitted to the external terminal device;
- the control circuit receives a first response signal and a second response signal from the external terminal device as response signals in response to the request signals,
- the control circuit generates an eighth random number signal using the first response signal, the second random number signal, and the sixth random number signal as input signals, and
- the control circuit provides the encrypted update data for the external terminal device when the second response signal coincides with the eighth random number signal.