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

Reverse HOTP #1

Closed
wants to merge 20 commits into from
Closed

Reverse HOTP #1

wants to merge 20 commits into from

Conversation

szszszsz
Copy link
Member

@szszszsz szszszsz commented Nov 9, 2022

Add the reverse HOTP feature

Tasks

  • return error on the counter overflow
  • discuss, if on-credential operations (get code, verify code, or both) should be limited during its registration
  • integrate with embedded runner
  • support LED control - done partially, see Update blinking handlers #4
  • support touch button
  • extension: PIN verification as an alternative to the VALIDATE command, PIN verification as an alternative to the VALIDATE command #6
  • optional: finish Trussed Virt-based example and tests , Add example #7
  • discuss, if the error codes should be more specific (its basically success or error now)
  • use u64 as the input for the verify_code, instead of the currently string

Description

Verify the HOTP code coming from a PC host, and show visually to user, that the code is correct or not, with a green or red LED respectively. Does not need authorization by design.

See more at:

Solution contains means to avoid desynchronization between the host's and device's counters. Device calculates up to 9 values ahead of its current counter to find the matching code (in total it calculates HOTP code for 10 subsequent counter positions). In case:

  • no code would match - the on-device counter will not be changed;
  • incoming code parsing would fail - the on-device counter will not be changed;
  • code would match, but with some counter's offset (up to 9) - the on-device counter will be set to matched code-generated HOTP counter and incremented by 1;
  • code would match, and the code matches counter without offset - the counter will be incremented by 1.

Device will stop verifying the HOTP codes in case, when the difference between the host and on-device counters will be greater or equal to 10.

cc @sosthene-nitrokey

@szszszsz szszszsz marked this pull request as draft November 9, 2022 12:24
@szszszsz szszszsz marked this pull request as ready for review November 9, 2022 12:24
@szszszsz
Copy link
Member Author

szszszsz commented Nov 9, 2022

Let's consider this being ready to review. The remaining tasks' results will be supplied in separate PRs.

@szszszsz
Copy link
Member Author

szszszsz commented Nov 9, 2022

Cargo.toml Outdated Show resolved Hide resolved
src/authenticator.rs Outdated Show resolved Hide resolved
src/authenticator.rs Outdated Show resolved Hide resolved
src/authenticator.rs Outdated Show resolved Hide resolved
src/command.rs Show resolved Hide resolved
src/authenticator.rs Outdated Show resolved Hide resolved
src/authenticator.rs Outdated Show resolved Hide resolved
Support CTAPHID transport. This is realized by sending CCID traffic into CTAP vendor command.

Fixes #2
@szszszsz
Copy link
Member Author

Updated as suggested in the review. Remaining tasks moved to separate tickets.
Merging.

@szszszsz szszszsz closed this in 833c3bc Nov 18, 2022
@szszszsz szszszsz deleted the reverse-hotp branch November 18, 2022 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants