The Wayback Machine - https://web.archive.org/web/20211128215517/https://github.com/tock/tock/issues/2635
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

Tracking: Crypto HIL improvements #2635

Open
1 task
bradjc opened this issue Jun 28, 2021 · 1 comment
Open
1 task

Tracking: Crypto HIL improvements #2635

bradjc opened this issue Jun 28, 2021 · 1 comment

Comments

@bradjc
Copy link
Contributor

@bradjc bradjc commented Jun 28, 2021

  • The set_mode_X() HIL functions need to support returning an error if hardware does not support that mode or if the implementation cannot put the hardware in to that mode at that time. See for an example where panic is used instead of returning an error https://github.com/tock/tock/pull/2629/files.
@phil-levis
Copy link
Contributor

@phil-levis phil-levis commented Aug 1, 2021

I think this is a larger issue, which we're facing with virtualization.

In the best case, the set mode methods are checked statically: if an implementation can provide them it does, and if it doesn't it doesn't. That way if a client needs a certain mode, you can't connect it to an implementation that doesn't implement it.

The issue with this is virtualizers. If you say that a virtualizer implements only the traits its underlying resource implements, you end up with lots of different virtualizers: this one supports AES128CBC, that one supports AES128CBC+AES128ECB, etc.

I see 4 ways forward:

  1. Forget the "trait per mode" approach, and go fully dynamic, using an enum. If you request a mode not supported, it returns and error.
  2. Keep the "trait per mode" approach, for static binding in the kernel, but introduce error return values because we want a single virtualizer implementation (the current approach).
  3. Have a variety of virtualizer implementations, supporting different cipher suites.
  4. Refactor how these traits work such that the virtualizer is parameterized by a type which implements the set_mode methods, such that system calls can get runtime errors but any given set_mode doesn't. This is pared down version of 3: we have a single virtualizer implementation, but multiple implementations of what cipher suites are supported.

There are certainly others. But what I want to avoid is pushing us towards run-time checks (motivated by userspace) that be checked statically for in-kernel use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment