OK, so I have resigned myself to use the win32 version of ykchalresp.exe (from ykpers-1.11.3-win32) to generate the hmac-sha1 from the yubikey. I have been plagued by a problem of inconsistency in the output of ykchalresp.exe vs HMAC in python and HashCalc for 64-byte challenges. Python (import Crypto) and HashCalc both give the same result for 64-byte challenges. The ykchalresp.exe seems to ignore the 64th byte of the challenge. All numbers below are hex.
Slot-1 has the following secretHMAC programmed:
Code:
303132333435363738393a3b3c3d3e3f40414243
64-byte challenge is:
Code:
c5e8ae90d425d81c64dd164bed1b737f7127d247e116
7f1f48b39ff5aaddc4047f25264d382e61611c32b879
3ef7ed4cf4f7967876c810ab736fe34722c784d6
Python HMAC and HashCalc both give a response of:
Code:
ca7f7a4c61df39be4fff19b4a88e78961ef616b3
Here is the command line and result from ykchalresp.exe:
Code:
C:\Users\Mike\Documents\python>ykchalresp.exe -1 -H -x "c5e8ae90d425d81c64dd164b
ed1b737f7127d247e1167f1f48b39ff5aaddc4047f25264d382e61611c32b8793ef7ed4cf4f79678
76c810ab736fe34722c784d6"
03afc07a58d983034234e141fd9d1a7c683d7a46
I verified that it is not a quoting issue:
Code:
C:\Users\Mike\Documents\python>ykchalresp.exe -1 -H -x c5e8ae90d425d81c64dd164be
d1b737f7127d247e1167f1f48b39ff5aaddc4047f25264d382e61611c32b8793ef7ed4cf4f796787
6c810ab736fe34722c784d6
03afc07a58d983034234e141fd9d1a7c683d7a46
Here is the command line and result from ykchalresp.exe with the last byte removed:
Code:
C:\Users\Mike\Documents\python>ykchalresp.exe -1 -H -x c5e8ae90d425d81c64dd164be
d1b737f7127d247e1167f1f48b39ff5aaddc4047f25264d382e61611c32b8793ef7ed4cf4f796787
6c810ab736fe34722c784
03afc07a58d983034234e141fd9d1a7c683d7a46
So, the response from the 64-byte challenge and 63-byte challenge are exactly the same.
Removing the 63rd byte does yield a different result:
Code:
C:\Users\Mike\Documents\python>ykchalresp.exe -1 -H -x c5e8ae90d425d81c64dd164be
d1b737f7127d247e1167f1f48b39ff5aaddc4047f25264d382e61611c32b8793ef7ed4cf4f796787
6c810ab736fe34722c7
ffcd6d5ec489e289c5f2726398e5cd47187806f1
Perhaps I am doing something wrong. My read of the HMAC-SHA1 spec says that a 64-byte challenge should be accepted. I can easily work around this by just using a shorter challenge, but I am curious if this is a hardware problem, some issue with ykchalresp.c, or something buried in the driver code. I looked briefly at the ykchalresp.c code, but nothing jumped out at me.
Any guidance here is appreciated.