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

Upstream merge #46

Merged
merged 19 commits into from
May 24, 2022
Merged

Upstream merge #46

merged 19 commits into from
May 24, 2022

Conversation

daringer
Copy link
Collaborator

merge notes/todos:

  • dispatch-fido is not needed anymore, thus remove (included in fido-auth with "dispatch" in features)
  • fido-authenticator has been taken from upstream/main for now -> @todo ?
    • or does version 0.1 already contain all things we need ?
    • so do we merge fido-authenticator upstream, or stay on version = 0.1
  • ctaphid.set_version(usbd_ctaphid::Version {
    • don't we want that?
    • in initilizer.rs
    • added for now here
  • inside initializer.rs get_serial_number()
    • afaik this should not be set for fido2-devices
    • did not take the upstream implementation, just returning "00....00"
  • various RGB related changes and adaptations inside board/trussed.rs
    • to be discussed if we really want a math-lib as dep to calc a LED-amplitude
    • anyways RGB should be heavily tested
    • added Intensities::scale_by() for easy scaling (currently misused by scaling with the amplitude...)
  • src/types.rs UsbClasses with or without serial ?
    • maybe #cfg[] ? based on feature?
    • serial pulled in for now...

pub const MESSAGE_SIZE: usize = PACKET_SIZE - 7 + 128 * (PACKET_SIZE - 5);
// 1200
// pub const MESSAGE_SIZE: usize = ctap_types::sizes::REALISTIC_MAX_MESSAGE_SIZE;
pub const MESSAGE_SIZE: usize = 3072;
Copy link
Member

Choose a reason for hiding this comment

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

This one looks arbitrary. To confirm its origin.

# "-Dwarnings",
"-Dwarnings",
Copy link
Member

Choose a reason for hiding this comment

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

What's this one doing? -D is of course defining a macro, but what's its purpose?

Copy link
Member

Choose a reason for hiding this comment

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

-D, --deny LINT Set lint denied – so this should make the compilation fail if there are compiler warnings. Makes sense for the CI, less so for development.

Comment on lines 75 to 86
fn get_serial_number() -> &'static str {
/*static mut SERIAL_NUMBER: heapless::String<heapless::consts::U36> = heapless::String(heapless::i::String::new());
use core::fmt::Write;
unsafe {
let uuid = crate::hal::uuid();
SERIAL_NUMBER.write_fmt(format_args!("{}", hexstr!(&uuid))).unwrap();
&SERIAL_NUMBER
}*/
"00000000-0000-0000-00000000"
}


Copy link
Member

Choose a reason for hiding this comment

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

IMO showing serial number should be configurable, with the default being the SN exposed to allow managing devices in the enterprise setting. Let's discuss this.

Copy link
Member

Choose a reason for hiding this comment

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

We had this discussion before the release and the conclusion was that we disable it by default and add an option to enable it later.

Comment on lines +212 to +215
// let remaining = msp() - 0x2000_0000;
// if remaining < 100_000 {
// debug_now!("USB interrupt: remaining stack size: {} bytes", remaining);
// }
Copy link
Member

Choose a reason for hiding this comment

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

This debug code should be active in the develop builds, or removed completely.
Similarly other statements like that.

@szszszsz
Copy link
Member

dispatch-fido is not needed anymore, thus remove (included in fido-auth with "dispatch" in features)
fido-authenticator has been taken from upstream/main for now -> @todo ?
or does version 0.1 already contain all things we need ?
so do we merge fido-authenticator upstream, or stay on version = 0.1

AFAIK fido-authenticator is updated with our changes, but potentially modified, and with that breaking user data compatibility. Let's use the released version. To do: check data retention for the FIDO2 key handles; verify changes against our last used.

ctaphid.set_version(usbd_ctaphid::Version {
don't we want that?
in initilizer.rs
added for now here

Yes, we do. See spec below. Let's make sure the proper version is used.

various RGB related changes and adaptations inside board/trussed.rs
to be discussed if we really want a math-lib as dep to calc a LED-amplitude
anyways RGB should be heavily tested
added Intensities::scale_by() for easy scaling (currently misused by scaling with the amplitude...)

Yes, math lib for that looks like overkill to me as well. Why the final values were not tabularized / calculated during the build via the const func? Do you know what was wrong with the initial sin approximation func?
See how this was done for the Nitrokey FIDO2:

src/types.rs UsbClasses with or without serial ?
maybe #cfg[] ? based on feature?
serial pulled in for now...

AFAIK it got removed in the upstream, as this was mainly debug feature. Or am I wrong?
I do not see the need to leave it enabled for the release. Potentially worth to make it a feature for the fast debug purposes.

@szszszsz
Copy link
Member

Final question: have you used the stable upstream release for the merge? Or an arbitrary commit?
And where is the CI build backlink? :|

@robin-nitrokey
Copy link
Member

re. RGB: We want to change the LED patterns anyway and remove the pulsing. Maybe just change it to constant colors in this PR and then change it to the colors we actually want before the next release?

@szszszsz
Copy link
Member

Bumping. ETA?

Copy link
Member

@robin-nitrokey robin-nitrokey left a comment

Choose a reason for hiding this comment

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

Not tested yet, just based on the code change:

  • I’d also like some more context for the constant changes regarding CTAPHID packet size, as mentioned by Szczepan
  • I think we should change the LED code to keep the status quo for the moment – this should also remove the need for the math dependency.
  • Instead of setting an all-zero serial number, can’t we just remove the .serial_number(serial_number) call?

@szszszsz
Copy link
Member

szszszsz commented Apr 28, 2022

Is this fixing below by any chance?

@robin-nitrokey
Copy link
Member

robin-nitrokey commented Apr 28, 2022

Is this fixing below by any chance?

* [SSH: Unable to download resident keys solokeys/fido-authenticator#10](https://github.com/solokeys/fido-authenticator/issues/10) (edit)

That should already be fixed with our v1.0.1 release. The issue we are having with resident keys is querying them, not creating them.

Edit: I replied to an old version of your comment. The download issue is not fixed yet AFAIK, but I haven’t tested it yet with the current fido-authenticator.

This patch removes solo2-specific targets from the Makefile.
This patch indicates the LED pulsing.  This does not change the current
behavior for production devices as LED pulsing is not working due to a
missing peripheral in locked mode in the current firmware version.
Instead of setting an all-zero serial number for the USB device, we
remove the serial number entirely to maintain the status quo.
This patch removes the -Dwarnings flag from the cargo configuration that
fails the build if there is a warning.  While this setting makes sense
in the CI, it is annoying during development.
Due to recent changes in Trussed, the LED is blinking during a user
confirmation request if it is processing data, for example on
webauthn.bin.coffee.  This patch restores the old behavior by using a
custom Trussed version that does not change the LED when processing data
and by fixing the refresh method in board/src/trussed.rs.
@robin-nitrokey robin-nitrokey marked this pull request as ready for review May 24, 2022 08:15
@robin-nitrokey
Copy link
Member

I’ve added some commits to finalize this PR – in my opinion, it is ready now. @szszszsz @daringer Please review.

The only non-trivial change I made is the last commit. It is necessary to maintain the current LED behavior, but it has to use a patched Trussed version because of the upstream changes. Here is the required patch.

@robin-nitrokey
Copy link
Member

Also, can someone please test NFC with these changes as there seem to be new issues for solo2?

runners/lpc55/Cargo.toml Show resolved Hide resolved
runners/lpc55/board/src/trussed.rs Show resolved Hide resolved
runners/lpc55/Cargo.toml Show resolved Hide resolved
@szszszsz
Copy link
Member

@daringer Engage!

Copy link
Collaborator Author

@daringer daringer left a comment

Choose a reason for hiding this comment

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

+1

@daringer daringer merged commit e0b4461 into main May 24, 2022
@robin-nitrokey
Copy link
Member

robin-nitrokey commented Jun 2, 2022

To test:

@szszszsz szszszsz deleted the upstream-merge branch June 23, 2022 17:25
@szszszsz
Copy link
Member

szszszsz commented Jul 4, 2022

Looks good. I do not see any problems while using under the latest Windows 10. #48 is fixed.
Using Resident Keys works well, including OpenSSH.
As discussed, the following will be retested on the production hardware:

  • NFC,
  • User data retention.

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.

4 participants