Coder Social home page Coder Social logo

`async` API for `Env`? about opensk HOT 3 OPEN

antonok-edm avatar antonok-edm commented on July 28, 2024
`async` API for `Env`?

from opensk.

Comments (3)

kaczmarczyck avatar kaczmarczyck commented on July 28, 2024 1

Thank you for your interest. The current Env API has evolved with needs from different platforms. The API calls you mentioned are broadly in 2 categories.

USB HID related

HidConnection and UserPresence.
Our current API is mostly taken from pre-library code and hasn't been redesigned yet. I could see us moving to an async API here.
We haven't touched it yet since we might want to be compatible with other transports like NFC in the future, and the new design should work for that.

Storage related

AttestationStore::{get,set}, Storage::{read_slice,write_slice,erase_page}
First comment: This is work in progress, e.g., #679. I suggest you look at the develop branch, not the current main branch 2.1 which is for people who want to build and use OpenSK more than it is for developers. Not too different yet, but more recent. AttestationStore moved into Persist.

Being async here is more problematic, since some of our security guarantees are tied to storage writes having persisted when execution continues. Can you help me understand why a blocking API doesn't work for you?

from opensk.

antonok-edm avatar antonok-edm commented on July 28, 2024

USB HID related

Our current API is mostly taken from pre-library code and hasn't been redesigned yet. I could see us moving to an async API here.

Cool, then there's a chance I may propose a PR or two later 🙂

Storage related

Can you help me understand why a blocking API doesn't work for you?

On my hardware, I'm using external eMMC memory for persistent storage, rather than embedded flash. It gives me quite a bit more capacity to work with, but it's also a slower channel where data is transferred over a bus 1 byte at a time with a checksum at the end for verification.

some of our security guarantees are tied to storage writes having persisted when execution continues

In my case, that's exactly why I'd prefer async - so that execution can switch to other unrelated tasks (e.g. updating the display) while a read/write is pending, and yield back to OpenSK once the operation has been confirmed by a successful handshake from the eMMC.

from opensk.

kaczmarczyck avatar kaczmarczyck commented on July 28, 2024

Question is how you'd design an Env that doesn't break all sync users and supports async use cases at the same time? To make sure I don't overpromise: I don't merge a PR that only moves our API to async.

So maybe it is indeed easier if you can use the sync OpenSK as is? Outside of user presence checking, our USB HID code is in the main loop, which is fully in your control. So the limitation that you can't run, e.g., display updates in parallel only applies when OpenSK processes a command.

from opensk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.