Nitrokey / nitrokey-3-firmware

Nitrokey 3 firmware
Apache License 2.0
241 stars 25 forks source link

Configure se050 backend on boot #504

Closed sosthene-nitrokey closed 3 months ago

sosthene-nitrokey commented 4 months ago

Depends on:

nitrokey-ci commented 4 months ago

No significant changes.

Insignifcant changes | metric | value | | change | | ------ | ----: | :-: | :----: | | binary-size-nk3am | 1,415,485 | :white_check_mark: | -9,000 (-0.63%) | | binary-size-nk3am-test | 2,014,544 | :white_check_mark: | -9,025 (-0.45%) | | binary-size-nk3xn | 507,728 | :white_check_mark: | -3,024 (-0.59%) | | binary-size-nk3xn-test | 544,692 | :white_check_mark: | -2,704 (-0.49%) | | binary-size-nkpk | 737,591 | :white_circle: | +0 (+0.00%) |
sosthene-nitrokey commented 4 months ago

Yes I don't want to leave this that way. This is too unreadable.

I first wanted it to get it working. But the usbip runner did not have the service available in its builder. I'll look into it.

sosthene-nitrokey commented 4 months ago

This is actually difficult to do. The Service used by usbip is pub struct Service<S: StoreProvider, D: Dispatch>(Rc<RefCell<trussed::Service<Platform<S>, D>>>);, so there is no sound way to have a &mut trussed::Service at the same time as the ClientBuilder.

Maybe we need to change the make_client to be a trait implementation with a build method, and also a method to get a mut access to the trussed::Service.

That requires also updating the pc_usbip_runner crate.

sosthene-nitrokey commented 4 months ago

I think i'll just put it behind an option and pass None in the usbip runner, with an unwrap. Worst case in the future if an new update expects it to always be available, it only breaks the usbip runner.

sosthene-nitrokey commented 4 months ago

I think I have the simplest solution.

I opened https://github.com/trussed-dev/pc-usbip-runner/issues/30 so that maybe in the future the usbip runner will match more closely the model of the real runner.

robin-nitrokey commented 3 months ago

We can get rid of the option once https://github.com/Nitrokey/nitrokey-3-firmware/pull/505 is merged.