fido-device-onboard / client-sdk-fidoiot

This a C-based implementation of the Device component defined in FIDO Device Onboard (FDO) Specification.
Apache License 2.0
20 stars 32 forks source link

[BUG] EAT Not Deterministically Encoded to CBOR #293

Open ben-krieger opened 1 month ago

ben-krieger commented 1 month ago

Describe the bug The EAToken is sometimes observed to have map keys not in bytewise lexically sorted order. Deterministic encoding is a requirement of FDO.

Example:

A2                                      # map(2)
   19 0100                              # unsigned(256)
   51                                   # bytes(17)
      017212778A2879DFE790E1CDFEE1A6925C # "\u0001r\u0012w\x8A(y\xDF\xE7\x90\xE1\xCD\xFEᦒ\\"
   0A                                   # unsigned(10)
   50                                   # bytes(16)
      AF5511E701488034ED3080BE51989F69  # "\xAFU\u0011\xE7\u0001H\x804\xED0\x80\xBEQ\x98\x9Fi"

To Reproduce Probably random, but will eventually happen in TO1 and/or TO2.

Expected behavior Key 0A should be before 190100 in the example. Generally, bytewise lexical sort order should be used for map keys.