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

Rewrite macOS IOHIDManager communication and state machine #52

Closed
wants to merge 1 commit into from

Conversation

ttaubert
Copy link
Contributor

@ttaubert ttaubert commented Nov 9, 2017

r? @jcjones

Looking forward to your feedback!

This seems very stable, I can't make a custom Firefox panic when plugging/unplugging multiple times. Re-plugged devices are properly registered, and work for registration and signing. With Chrome open, I also can't reproduce bug 1398268 anymore.

@ttaubert ttaubert self-assigned this Nov 9, 2017
@ttaubert ttaubert requested a review from jcjones November 9, 2017 11:53
Copy link
Contributor

@jcjones jcjones left a comment

Choose a reason for hiding this comment

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

This looks really clean, Tim. Other than the chaining style - which please pick and fix before landing - it looks good as-is.

We should open an issue to write tests for Transaction though.


// Iterate the exlude list and see if there are any matches.
// Abort the state machine if we found a valid key handle.
if key_handles.iter().any(|key_handle| {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: feels like you should use the same chaining style here as around line 105... either's fine, but ... one. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're not quite the same. For register() we want to bail out as soon as we match one of the entries in the exclusion list. In sign() we want to actually get a list of all matching tokens and try to sign with those one by one.

I'll leave this as is and land it. If you disagree, let's open an issue and I'll be happy to address that in a follow-up :)

let manager = unsafe { IOHIDManagerCreate(kCFAllocatorDefault, kIOHIDManagerOptionNone) };

// Match FIDO devices only.
let _matcher = IOHIDDeviceMatcher::new();
Copy link
Contributor

Choose a reason for hiding this comment

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

btw, I'm super impressed that you figured out how to make this work. I fought it ... too long.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It took... at lot of time :)


let rv = IOHIDManagerOpen(self.manager, kIOHIDManagerOptionNone);
if rv != 0 {
return Err(io_err("Couldn't open HID Manager"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Probably good to put the rv into the message, but shrug

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, done.

@ttaubert ttaubert closed this Nov 14, 2017
@ttaubert ttaubert deleted the macos-statemachine branch November 14, 2017 10:24
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 14, 2017
xeonchen pushed a commit to xeonchen/gecko-cinnabar that referenced this pull request Nov 14, 2017
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this pull request Nov 15, 2017
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 20, 2017
…'t use KeyHandleMatcher r=jcj

This patch rewrites the Linux backend to have a structure similar to the macOS
one [1]. We'll have one thread per device, which means that a device that is
stuck or unresponsive won't break other devices.

[1] mozilla/authenticator-rs#52

Review: mozilla/authenticator-rs#56

mozilla/authenticator-rs@7d9f31a
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this pull request Nov 21, 2017
…'t use KeyHandleMatcher r=jcj

This patch rewrites the Linux backend to have a structure similar to the macOS
one [1]. We'll have one thread per device, which means that a device that is
stuck or unresponsive won't break other devices.

[1] mozilla/authenticator-rs#52

Review: mozilla/authenticator-rs#56

mozilla/authenticator-rs@7d9f31a
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 2, 2019
…nd state machine r=jcj

Review: mozilla/authenticator-rs#52

UltraBlame original commit: 6fab343d63b66b26b0f42f2c317a3279257f31d9
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 2, 2019
…'t use KeyHandleMatcher r=jcj

This patch rewrites the Linux backend to have a structure similar to the macOS
one [1]. We'll have one thread per device, which means that a device that is
stuck or unresponsive won't break other devices.

[1] mozilla/authenticator-rs#52

Review: mozilla/authenticator-rs#56

mozilla/authenticator-rs@7d9f31a

UltraBlame original commit: 066c5f6d20c759fcf65f8065010d32db34230e2e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 2, 2019
…nd state machine r=jcj

Review: mozilla/authenticator-rs#52

UltraBlame original commit: 6fab343d63b66b26b0f42f2c317a3279257f31d9
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 2, 2019
…nd state machine r=jcj

Review: mozilla/authenticator-rs#52

UltraBlame original commit: 6fab343d63b66b26b0f42f2c317a3279257f31d9
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 2, 2019
…'t use KeyHandleMatcher r=jcj

This patch rewrites the Linux backend to have a structure similar to the macOS
one [1]. We'll have one thread per device, which means that a device that is
stuck or unresponsive won't break other devices.

[1] mozilla/authenticator-rs#52

Review: mozilla/authenticator-rs#56

mozilla/authenticator-rs@7d9f31a

UltraBlame original commit: 066c5f6d20c759fcf65f8065010d32db34230e2e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 2, 2019
…'t use KeyHandleMatcher r=jcj

This patch rewrites the Linux backend to have a structure similar to the macOS
one [1]. We'll have one thread per device, which means that a device that is
stuck or unresponsive won't break other devices.

[1] mozilla/authenticator-rs#52

Review: mozilla/authenticator-rs#56

mozilla/authenticator-rs@7d9f31a

UltraBlame original commit: 066c5f6d20c759fcf65f8065010d32db34230e2e
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