google / OpenSK

OpenSK is an open-source implementation for security keys written in Rust that supports both FIDO U2F and FIDO2 standards.
Apache License 2.0
3k stars 291 forks source link

Easier porting to other architectures #573

Open stevefan1999-personal opened 1 year ago

stevefan1999-personal commented 1 year ago

Despite I know ESP32-C3/C2 is magnitude slower than nRF52840, but I want to port this there. Right now OpenSK seems like very centric to nRF52840, but I guess this can be traded with time. There is one thing about ESP32-C3/C2 though, that they don't have official atomic support, and I believe changing it to use atomic_polyfill can have some, say like timing consequences. Wonder if we can make something relaxed so we can port things easier?

kaczmarczyck commented 1 year ago

Hi! Thanks for your interest in OpenSK. A few questions to understand the scope of your project idea:

  1. To my knowledge, there is no TockOS support for your chip. So you'd first have to either get TockOS running there (probably a lot of effort) or write your own layer underneath OpenSK. We have an ongoing effort to make this simpler by providing a cleaner interface to OpenSK (look for Env). Have you looked into that?

  2. We currently use Atomic only to make sure that something is run exactly once. This can probably also achieved with unsafe code, or maybe you have a better idea even. This shouldn't be a major blocker. You GitHub profile looks like you have some experience with these kinds of things?

stevefan1999-personal commented 1 year ago
  1. It is supported. Well, given that we are not talking about ESP32-C2 of course
  2. I have stated we can use atomic-polyfill maybe. But it is very sure doing it on software so the timing is very much arbitrary and I'm not sure about the timing requirements (hard or soft realtime) of this project. I do hope it is not really real time at all given that I didn't even saw any time complexity given...so maybe I was overthinking about being deterministic/predictable or not

@kaczmarczyck

kaczmarczyck commented 1 year ago

Oh nice, I didn't know about TockOS supporting it! The only time we use Atomic is in our storage initialization. Its purpose is pretty much to implement a singleton.

Not sure I understand the timing question, but generally speaking precise timing is not a concern.