conorpp / u2f-zero

U2F USB token optimized for physical security, affordability, and style
Other
2.41k stars 202 forks source link

Highlight "lazy check" for rewrite #51

Closed rampageservices closed 6 years ago

rampageservices commented 7 years ago

Hi, I just wanted to highlight this line of code for someone to rewrite or to remind myself to submit a PR for a better check for the test_key_signing() method. I understand code-space is limited which may be the reasoning behind a simple check but if the result can be verified that seems to be the better route.

// lazy/bad check but eh
    return res.len > 8 ? 0 : -1;

https://github.com/conorpp/u2f-zero/blob/master/firmware/tests/tests.c#L226

conorpp commented 7 years ago

Thanks. It isn't so much of a space constraint of me being lazy a a while ago when I wrote that test. Tests shouldn't be compiled into production and don't need all functionality present so relatively speaking there aren't any constraints.