-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fido2 follow up #17096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fido2 follow up #17096
Conversation
7a26235 to
e1c430e
Compare
|
Tested with a nrf52840dk:
|
|
The changes look good in general, but I think the documentation can be improved. From a user perspective: I can now change the number of flashpages (jippie!) but what does that mean, how should I configure that value? For example, I know that I want to serve 12 accounts with my authenticator, how many flashpages do I need? |
6128697 to
1c40380
Compare
|
A bit unrelated, but what made you chose TinyCBOR instead of NanoCBOR for CBOR parsing? |
Honestly I can't remember. This decision was made really early when I barely had any experience with RIOT. I think someone recommended TinyCBOR and I just went with it |
d96b0f1 to
a981b51
Compare
|
The way If I came to these functions without the context of the present PR, I'd assume that these "free" pages are free for the application to use. Here, something internal to RIOT uses them -- and my expectation of a modules system is that I can enable any additional modules and my application would still run unimpeded. A possible way out here is for the flashpage_*_free mechanism would be to keep track of that some system component has "claimed" a chunk of flash (and because that happens in ordered start code, they get the same pages across reboots) -- but that would be doing a check at runtime that could also be done at built time. (In own applications, I've always allocated flash like static const uint8_t backing_memory[FLASHPAGE_SIZE] __attribute__((aligned(FLASHPAGE_SIZE))) = {0};
...
int flashpage = flashpage_page((void*)backing_memory);which cooperates nicely with the flashpage_*_free mechanism). |
|
@chrysn thanks for the suggestions ! I think your suggested aproach is the best solution. I updated the code accordingly. |
6e1965c to
077d7e9
Compare
To my understanding yes. This does still interfere with the firmware update case.
Which documentation do you think should be updated ? |
|
In sys/fido2/doc.txt a note on 1. how flash is allocated and 2. firmware updates are not possible with our fido2 implementation for thisandthat reason. @chrysn other things to document? |
|
@chrysn other things to document?
Not in here, now that it's not using flashpage_*_free any more.
If the changes here removed the necessity to have flashpage_first_free
and flashpage_last_free altogether (which AIU was prepared in a first
stage of this PR), it may be worth considering deprecating (or removing,
not having been in a release) them right away again, or documenting how
they are supposed to be used, but there's nothing in this PR any more
that makes that belong here.
|
I added a python script to the test application directory that allows for resetting the authenticator. Also documentated it in the README. |
12c8dd1 to
97628f2
Compare
|
Otherwise, the PR looks good and the reset abilities really improve our implementation ;) |
A bit more specifically:
|
Found the issue, thanks for testing so rigorously. The problem was the wrong location of this check. |
|
Regarding the commit messages: should I just call the whole thing "fido2 follow up" or divide further? |
|
|
Think I would like three commits:
What do you think? |
0a5e042 to
c5993ac
Compare
|
Murdock fails... |
4bfaa87 to
c7638d8
Compare
| #else | ||
| #define CONFIG_FIDO2_CTAP_DISABLE_UP 1 | ||
| #endif | ||
| #endif /* BTN0_PIN */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is actually the desired behavior? Silently disable user presence on boards that do not expose a pin? Or better throw a warning and exclude these boards from CI? Throw a warning here and disable user presence in the test by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we had a discussion about this when I added these lines and we agreed on the first approach.
Murdock complained about a symbol being redefined. I hopefully fixed this issue now and it should work like the first approach you mentioned above with the recent changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to be fixed. Maybe run the compile test locally before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. Didn't think about just trying to compile locally with the failing boards. Did that now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Success :)
c7638d8 to
b1755b4
Compare
b1755b4 to
deeea2b
Compare
PeterKietzmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good. Green lights, go!

Contribution description
This PR adjusts the FIDO2 CTAP flash handling to reserve flash memory at compile time using a
static constbuffer. This ensures that the FIDO2 CTAP implementation does not interfere with other modules wanting to use flash memory and doesn't corrupt firmware or e.g. bootloaders at the end of flash. Furthermore configuringCONFIG_FIDO2_CTAP_NUM_FLASHPAGESsuch that more flash than available is required will fail at build time rather than runtime.Testing procedure
tests/sys_fido2_ctapI successfully ran the tests on the
nrf52840dongleandnrf52840dk.