The authentication should be implemented using the following steps:
-
- MAC command 0x0000: Command = 0x0000, write the 20 bytes to 0x40, then write the checksum+len at 0x60.
The response will be available as a MAC response, so 0x3E/0x3F will be 0x0000, 0x40 will have the SHA1 result, and 0x60/0x61 will have the checksum and length.
- Generate 160-bit message M using a random number generator that meets approved random number generators described in FIPS PUB 140–2.
- Generate SHA-1 input block B1 of 512 bytes (total input = 128-bit authentication key KD + 160-bit message M + 1 + 159 0s + 100100000).
- Generate SHA-1 hash HMAC1 using B1.
- Generate SHA-1 input block B2 of 512 bytes (total input = 128-bit authentication key KD + 160-bit hash HMAC1 + 1 + 159 0s + 100100000).
- Generate SHA-1 hash HMAC2 using B2.
- With no active MACData() data waiting, write 160-bit message M to MACData() in the format 0xAABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTT, where AA is LSB.
- Wait 250 ms, then read MACData() for HMAC3.
- Compare host HMAC2 with device HMAC3, and if it matches, both host and device have the same key KD and the device is authenticated.