-
Notifications
You must be signed in to change notification settings - Fork 72
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
Conversation
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.
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| { |
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.
Nit: feels like you should use the same chaining style here as around line 105... either's fine, but ... one. :)
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.
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(); |
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.
btw, I'm super impressed that you figured out how to make this work. I fought it ... too long.
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.
It took... at lot of time :)
src/macos/monitor.rs
Outdated
|
||
let rv = IOHIDManagerOpen(self.manager, kIOHIDManagerOptionNone); | ||
if rv != 0 { | ||
return Err(io_err("Couldn't open HID Manager")); |
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.
Nit: Probably good to put the rv
into the message, but shrug
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.
Good idea, done.
be156ac
to
4906ba8
Compare
…nd state machine r=jcj Review: mozilla/authenticator-rs#52
…nd state machine r=jcj Review: mozilla/authenticator-rs#52
…nd state machine r=jcj Review: mozilla/authenticator-rs#52
…'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
…'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
…nd state machine r=jcj Review: mozilla/authenticator-rs#52 UltraBlame original commit: 6fab343d63b66b26b0f42f2c317a3279257f31d9
…'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
…nd state machine r=jcj Review: mozilla/authenticator-rs#52 UltraBlame original commit: 6fab343d63b66b26b0f42f2c317a3279257f31d9
…nd state machine r=jcj Review: mozilla/authenticator-rs#52 UltraBlame original commit: 6fab343d63b66b26b0f42f2c317a3279257f31d9
…'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
…'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
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.