u2f-zero icon indicating copy to clipboard operation
u2f-zero copied to clipboard

U2F Zero key derivation algorithm could be explained in more detail

Open vojnovski opened this issue 7 years ago • 5 comments

Currently, without doing a full analysis of the code, the key derivation algorithm used is not evident.

Something akin to https://developers.yubico.com/U2F/Protocol_details/Key_generation.html might be a good addition to the documentation.

Furthermore, it might be good to explain that the u2f fob programming should be done on a secure environment as the master key is generated there and then subsequently copied to the EFM8 and the ATECC.

#38 and #66 talk about this as well, and resources from there can be reused for documentation.

vojnovski avatar Jan 20 '18 15:01 vojnovski

While here, couldn't the master key generation have been done on-device? RMASK/WMASK could then have been also calculated on-device and sent back to the client script, in order to be incorporated in the final firmware.

vojnovski avatar Jan 20 '18 20:01 vojnovski

or alternativly, just left in a know place on the flash memory to be reused by the firmware which could then be generic.

gdamjan avatar Jan 24 '18 17:01 gdamjan

I remember using that diagram as a reference when I did the key derivation. The algorithm is very similar, doing a HMAC using a device secret, AppID, and random number.

I agree with your point about having a secure environment for key generation.

I'm planning to update the documentation later this weekend.

conorpp avatar Jan 26 '18 04:01 conorpp

@vojnovski yes key generation could be done on the device instead. The hardware number generator on the ATECC508 is cryptographically based on a tamper resistant seed. So if how Atmel set that seed up was to get compromised somehow, than at least key generation would still be secure since other RNG numbers were mixed in at the start. At least, that was what I was initially thinking. A user's computer getting compromised during programming might be more likely :)

conorpp avatar Jan 26 '18 04:01 conorpp

Hi! Here is our work-in-progress attempt to document the process: security_architecture.md. Any feedback appreciated!

(except some of the source code references, it should be the same with U2F-Zero)

Edit: merged to master

szszszsz avatar Aug 03 '18 08:08 szszszsz