Conversation

Jarkko Sakkinen

Edited 6 days ago
tpm2_protocol is turning into quite cool crate:

1. It's a no_std crate that uses Rust's type system describe TPM commands and responses in the same resolution as the spec.
2. It marshals also responses and unmarshals commands.
3. It's not a stack. it's stackless implementation of types.

These properties allow to nest and glue it to TSS2 and any other pre-existing TPM stack.

Also it could be theoretically used to implement a chip since it is designed to run also bare metal and has been designed to be skimpy on resources ;-)

Hopefully next week get this out...
2
0
1
Totally applicable also to be used in pre-boot loaders, operating system kernels etc. as it does what it does efficiently but is io-less (it does things right tho with AsRef and similar traits so to that it melts nicely to io-full world).
1
0
0
As secondary priority, I want to have this ready for any linux-rust interactions because it would be the part of implementation I would be most concerned of. That is one reason I've ended up to a context-free and environment agnostic implementation like this.
1
0
0
Imaginary kernel example would be /devtpmrm0 but given ability to break the bytestream apart and put it back together, be it either direction, it could be much more sophisticated than the existing.
0
0
0

@jarkko how did you end up implementing the (un)marshalling? I've been hacking on deku recently to enable support in no_std environments that also avoid alloc. Deku is pretty nice!

1
0
0
@arj i'll release the repository in upcoming days/weeks and rather use the repository for source code for proper licensing platters etc. :-)

as for deps:

bitflags = { workspace = true }
strum = { workspace = true }

I use these for convenience (for now at least) and for the reason that I can eventually remove them :-)

if i want to translate this to kernel there's no cargo.
1
0
1
@arj just saying but having "extern crate alloc;" for no_std crate is not necessarily a problem as long as you have suitable alloc for the application. depends on goals.
2
0
0
@arj and neither are deps but this also for the stituation if some wants to extend kernel tpm stack to rust side. by the time i have this polished, mature and tested and can give this and say that "this is how i want to protocol parsing work".

i thought that for such extensions there are better people than me to bind io for linux-rust shenanigans but for tpm2 protocol itself i have over decade long expertise and believe that i can solve this particular subproblem better than anyone else ;-)
1
0
0

@jarkko yes, we've been using heapless for a bunch of embedded stuff, over alloc

1
0
1

@jarkko currently poking at device-side implementations for an NVMe-MI stack https://codeconstruct.com.au/docs/mctp-rust-new-crates/

0
0
0

@jarkko sure, not doubting that, but I'm in the process of implementing parts of NVMe-MI, so was interested in the strategies you were taking for the tpm2 protocol

1
0
0
@arj yeah it should not take too long
0
0
0