Conversation

Jarkko Sakkinen

Edited 5 months ago

Closed my tpm-rs bug because I do not want to contribute to that project: https://github.com/tpm-rs/tpm-rs/issues/71#issuecomment-2171360982

Why? I think mine is better or will grow so much better than this. It is more idiomatic #Rust, and generally less layered and more lean and mean ;-)

I will review merge requests for mine tho, on the basis of common sense and code quality tho: https://gitlab.com/jarkkojs/tpm2_library/-/issues

#linux #kernel #tpm2 #rustlang

1
2
0

@jarkko good luck with your project. More tooling can only lead to better tooling:-)

1
0
1

@hunger yep, so for me it is somewhat is easy choice because I’m the main consumer of my own product.

For instance the first pieces of functionality are response code to (spec) mnemonic decoding and object enumeration. I wrote those only because that will free from having to use tpm2_rc_decode and tpm2_getcap for this again.

Consortium projects can have sometimes issues that there is bunch of people who do not actually use it every day in their tool set. I.e. ‘’let’s do something ugly that covers our spec” type of acting ;-)

The second problem is that often in such projects moving changes to upstream can take ages because nobody cares that much. So I can either choose:

  1. Have arguments, frustration and anger at Github issues.
  2. Write meaningful functionality that I need and use straight out of the bat.

All I did in 48h improved my kernel flow at instant. That is at least measurable benefit. Doing for myself, not for users ;-)

1
0
0

@hunger I have also somewhat clear milestone deriving from a kernel patch set: https://lore.kernel.org/linux-integrity/20240528210823.28798-1-jarkko@kernel.org/

For v8, one of the goals is to have the smoke testing transcripts described in tpm2-cli.

Main gist of upcoming changes for my crate are scoped in the this:

tpm2_createprimary --hierarchy o -G rsa2048 -c owner.txt
tpm2_evictcontrol -c owner.txt 0x81000001
openssl genrsa -out private.pem 2048
tpm2_import -C 0x81000001 -G rsa -i private.pem -u key.pub -r key.priv
tpm2_encodeobject -C 0x81000001 -u key.pub -r key.priv -o key.priv.pem
openssl asn1parse -inform pem -in key.priv.pem -noout -out key.priv.der

[and similar for ECDSA]

In my project tpm2_call has the protocol layer and zero OS specific shenangians, i.e. it is ultra-portable.

However, in tpm2-cli I can just add a command that does the equivalent flow using openssl and asn1 crates. Generally the winds and stream in this project go in a way that I let shit grow in tpm2-cli and abstract away stuff that is agnostic and mature enough to tpm2_call. This way abstraction formalize by evolution and stimulus and not by top-down design…

1
0
0

Jarkko Sakkinen

Edited 5 months ago
@hunger I don't have as mature design as tpm-rs but I think my process is a winning horse. I.e. kernel standard way acting, no vision at all, or roadmap of any kind, just be a golfish and impact with the world where you use your tools.
1
0
0

Jarkko Sakkinen

Edited 5 months ago

@hunger And there’s one huge contradiction between how I see the stack should work in the user space and how TCG sees it.

I did not believe in TrouSerS and neither do I believe in TSS2. User space arbitrator is just a bad idea as far as I’m concerned. And tpm-rs crate’s docs already have hints that they want to do something similar at very least.

I think a single chip can at most exactly two tasks:

  • Managing persistent and transient with /dev/tpm0
  • Managing transient only bu per open file with /dev/tpmrm0.

Anything that tries to scale up from this with a crazy and complex daemon is just totally misguided in architecture [1]. Never try to scale anything beyond what it has capabilities for.

For multiplex, e.g. for guests or containers, a decent vTPM implementation (posssibly attestated by the hardware chip, and thus doing arbitration in different layer or by the means of SGX/TDX/SNP) would be so much better approach, despite having challenges of its own.

It is something that one can understand is within limits of scalability of a chip (literally I mean think of more complex task like primary key generation).

[1] https://www.joelonsoftware.com/2001/04/21/dont-let-architecture-astronauts-scare-you/

1
0
0
@hunger There's some irony in this though.

I've been slandering Rust community for making forks of every possible thing but I do think I'm in different grounds here ;-)

But in this case I disagree with core ideas of the architecture, cannot do the tasks that I need to now as an end user, and I have my own code base starting from epoch.

So literally I will never get the tool that I need myself, if I do not create a competing platform. Now I got first essential pieces what I needed in 48h. Thus, I think I'm in legit grounds with this and doing the right thing.
0
0
0