Giter Club home page Giter Club logo

tpm-spam's People

Contributors

chrisfenner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tpm-spam's Issues

Reorganize packages

There are 3 packages:

  • eighttree, which contains one 54-line file
  • helpers, which contains two files:
    • hashing.go, 18 lines
    • policy.go, 589 lines

The Policy.go part of helpers should be broken up into some smaller libraries, e.g.:

  • helpers for checking satisfiability of a policy given some TpmState
  • helpers for running TPM policy commands
  • helpers for calculating TPM policies
  • helpers for normalizing spam policies
  • helpers for tree-izing normalized spam policies

There should not be a library called helpers. They are all helpers.

Revisit PolicyNVWritten

For a 64-byte NV index, having a policy hash bloats the size in flash by around 50% (attributes, size, and other small bits of metadata aside).

If there is a way to make spams write-once in practice without a policy, we should switch to it. For example, we could use WriteLock to lock the index after writing it, and use TPMA_NV_WRITE_STCLEAR to ensure that WRITTEN and WRITELOCKED both get cleared on TPM reset or restart.

This might increase the number of Orderly spams supported by the reference implementation (#22) from 6 to 8 or 9.

Beautification projects

  • All packages should have good descriptions
  • Go imports should be chunked up into (standard library, other github, local) chunks consistently from file to file
  • All exported functions should have good descriptions
  • Use method receivers consistently and where it cleans up the calling patterns
  • Resolve all the TODOs sprinkled around the code
  • Improve errors returns and checks using go1.13 improvements and error types instead of fmt.Errorf

Revisit Orderly

With the initial barebones implementation complete, I see some interesting things:

  • The TPM reference code simulator allocates 512B for Orderly NV, limiting us to 6 (if they have Policy) Orderly spams.
  • Using Orderly spams still triggers one write to all the NV indices during clean shutdown, same as if they were not Orderly
  • TPM implementations are permitted not to allow Orderly Ordinary indices

There are a couple of options:

    • Switch over to non-orderly spams
    • Support both orderly and non-orderly spams transparently by adding more OR branches during Normalize

The only reason I can think of to do (2) other than "someone else might think of a reason later, we could just be universally compatible from time t=0" is that some firmware TPM implementations have a "dark period" where writes to NV and DA counters have to fail (because there is actually no access to persistent NV during this time).

Support a more human-readable policy format

proto is nice for imagining policies that come from a machine, but as can be seen in the examples, it's pretty heavyweight for human-readable spam policies.

Consider something like YAML:

  • Uses indentation instead of braces
  • More commonly hand-written than textproto
  • Improve readability with anchoring and aliasing
    • e.g., define "good kernel" as some sub-policy, then reference it from elsewhere in the policy, maybe even from multiple places

vs. JSON:

  • Less visual clutter - allows keys to not be quoted
  • JSON doesn't support anchoring/aliasing
  • JSON is a bit more standard of an interchange format, but for policies that might come from an RPC proto is the clear winner anyway

Consider an invalidation API

Open question: should there be a way to invalidate a previously-written spam? For example, a kernel might need to kexec another kernel, but invalidate its own spam. This would need to not result in the spam becoming writable again.

For example, every spam could have a policy that allows writing all zeros into it, even if written. This would mean sticking with the NvWritten policy and not switching over to a lock mechanism (#23).

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.