Skip to content
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 continued #18663

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

Ollrogge
Copy link
Contributor

@Ollrogge Ollrogge commented Sep 28, 2022

Contribution description

This PR adds changes to make the FIDO2 API usable without a transport layer as
well as improve the overall usability. With this come changes specific to the native
target, to account for the fact that mtd flash handling is file backed in this case.

This also includes breaking changes to the public API:

  • All public methods defined in "sys/include/fido2/ctap.h" now return a
    ctap_status_code_t instead of the size of the response.
  • The size of the FIDO2 response is now contained within the response structure
    ctap_resp_t.

Users of the FIDO2 API need to adjust their applications to now expect a status
code as the return value of functions such as fido2_ctap_handle_request and
expect the length of the response in resp->len.

To test the usability of FIDO2 without a transport layer, this PR also adds
another test module which tests the CTAP implementation without transport layer.

With the new test module being added, the old tests are renamed to
sys_fido2_ctap_hid to highlight the fact that they test the CTAP2 implementation
using CTAPHID as transport binding.

Furthermore, this PR removes the dependency of ctap_hid for ztimer64 as
having 64 bit timestamps is not required.

Testing procedure

  • tests/sys_fido2_ctap
  • tests/sys_fido2_ctap_hid

Issues/PRs references

Depends on PR #18637
Issue regarding file backed flash memory on native: #19559

@github-actions github-actions bot added Area: doc Area: Documentation Area: Kconfig Area: Kconfig integration Area: sys Area: System Area: tests Area: tests and testing framework labels Sep 28, 2022
Copy link
Member

@chrysn chrysn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm splitting review into multiple stages as that's a relatively large number of files for a subsystem with few major contributors. For this round, I'm only looking at changes visible outside the module, including the removed ztimer64 use.

Minor comments inline; one larger here:

There are several incompatible changes to the public fido2 API. Please prepare, ideally in the top post of the PR, a note that can then be placed in the release notes. It should describe to users of the API what they need to change in their applications, with emphasis on changes that might go undetected by the compiler and alter the program's meaning (such as when fido2_ctap_handle_request returns a status code rather than a length, which the compiler may cast implicitly).

sys/Makefile.dep Outdated Show resolved Hide resolved
sys/include/fido2/ctap.h Outdated Show resolved Hide resolved
sys/include/fido2/ctap/ctap_utils.h Outdated Show resolved Hide resolved
tests/sys_fido2_ctap/Makefile Outdated Show resolved Hide resolved
tests/sys_fido2_ctap/main.c Outdated Show resolved Hide resolved
tests/sys_fido2_ctap/main.c Outdated Show resolved Hide resolved
@Ollrogge
Copy link
Contributor Author

With #18637 having been merged a while a go, I would like to get this in as well. Rebased on latest master.

@Ollrogge
Copy link
Contributor Author

Ollrogge commented May 8, 2023

@chrysn Can we get this in ?

@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Platform: native Platform: This PR/issue effects the native platform and removed Area: doc Area: Documentation labels May 25, 2023
@kfessel
Copy link
Contributor

kfessel commented May 25, 2023

link to #19559 native is using file backed mtd

@github-actions github-actions bot added the Area: doc Area: Documentation label May 25, 2023
@Ollrogge Ollrogge force-pushed the fido2_follow_up2 branch 2 times, most recently from 68b8994 to 4e1b12d Compare May 26, 2023 07:57
@github-actions github-actions bot removed the Area: Kconfig Area: Kconfig integration label Sep 28, 2024
@kfessel kfessel added the Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care. label Sep 30, 2024
@kfessel
Copy link
Contributor

kfessel commented Sep 30, 2024

i think one of the test application is "copied" ( old copy should be deleted) to the new path structure
one is not moved yet.

I am not sure how many users of this module are out there, this changes a lot of api from return the size of data to return an error code (misinterpretation might not be nice).

@Ollrogge
Copy link
Contributor Author

i think one of the test application is "copied" ( old copy should be deleted) to the new path structure one is not moved yet.

Ah yes, I missed the directory structure changes. Will fix

I am not sure how many users of this module are out there, this changes a lot of api from return the size of data to return an error code (misinterpretation might not be nice).

Currently I don't think very many. I personally don't know of anybody. One reason for this was (at least the last time I checked) that many applications lacked FIDO2 support and only support FIDO U2F, which is not implemented in RIOT currently. I am planning to put some more work into the FIDO2 implementation in order to get a fully working RIOT security key at some point :)

Either way, I don't think the API change will affect many people.

@kfessel
Copy link
Contributor

kfessel commented Oct 7, 2024

please add a "cleanup" commit that fixes longlines ( >100 chars) and consecutive empty lines if possible

@@ -28,16 +28,22 @@
#define ENABLE_DEBUG (0)
#include "debug.h"

#ifdef BOARD_NATIVE
#include "mtd_default.h"
// native mtd is file backed => Start address of flash is 0.
Copy link
Contributor

@kfessel kfessel Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style : single line comment is too modern for RIOT

content: is that always the case
(e.g. if something else is build into the same application and is using the mtd)
or is there always a dedicated file for fido?

Copy link
Contributor

@kfessel kfessel Oct 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having a specific mtd configuration seems application specific -> ?better in test app?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is only needed when running the fido2 layer natively (for testing). In this case I set the mtd_default because that is the only one that works correctly natively if I remember correctly.

@Ollrogge
Copy link
Contributor Author

please add a "cleanup" commit that fixes longlines ( >100 chars) and consecutive empty lines if possible

Fixed for every location that is not a structure documentation

@@ -47,78 +46,80 @@ static int _sig_to_der_format(uint8_t *r, uint8_t *s, uint8_t *sig,
*/
static int _RNG(uint8_t *dest, unsigned size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that line is no longer needed ( since you moved the function that used that declaration)

@kfessel
Copy link
Contributor

kfessel commented Nov 1, 2024

@Ollrogge @chrysn

I just looked at the code the changes seem sane and build tests are happy. As @Ollrogge is the main consumer of this code and he is the original author I would just accept it if nothing comes up within 2 weeks, please remind me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: sys Area: System Area: tests Area: tests and testing framework Platform: native Platform: This PR/issue effects the native platform Process: API change Integration Process: PR contains or issue proposes an API change. Should be handled with care.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants