Closed smrt28 closed 5 years ago
This is expected, the two extra bytes are the CRC of the data.
The buffer needs extra space for the CRC, then padded out to a multiple of 8 since a feature report being read is 8 bytes, and then extra space for one report of 8 bytes since an extra report is sent at the end to indicate a complete command.
Hi,
I have YubiKey 4. Slot 1 is configured with HMAC.
ykpersonalize -1 -ochal-resp -ochal-hmac -ohmac-lt64
It seems yk_challenge_response() returns 22 bytes response instead of expected 20 bytes. By definition, the yk_challenge_response() function should fill ony 20 bytes in response but it seems 22 bytes are returned instead. They are not zeros and they changes with the input so they seems to be part of the hash.
Maybe, those 2 bytes are suppose to be undefined by yk_challenge_response() definition and so the behavior is correct and I should ignore them, but it is strange.
The example code calculates HMAC from the string and prints response. First 22 bytes are not zeros (well, they are zeros in 1/256 cases ;-)). Isn't it strange?