From: Jarkko Sakkinen <jarkko@kernel.org>
To: tpm2@lists.linux.dev, linux-integrity@vger.kernel.org,
rust-for-linux@vger.kernel.org
Subject: tpm2_protocol
Date: Tue, 12 Aug 2025 15:59:25 +0300 [thread overview]
Message-ID: <aJs6rWexGNsH45_Z@kernel.org> (raw)
I came up with this within 1,5 weeks not much sleep, and thought that
this might be interesting to all of the three lists:
tpm_struct!(
#[derive(Debug, PartialEq, Eq, Clone)]
TpmPcrEventCommand,
TpmCc::PcrEvent,
TpmSt::Sessions,
1,
{
pub event_data: Tpm2b,
}
);
tpm_response!(
#[derive(Debug, Default, PartialEq, Eq, Clone)]
TpmPcrEventResponse,
TpmCc::PcrEvent,
TpmSt::Sessions,
{
pub digests: TpmlDigestValues,
}
);
[tpm_struct is also used for data types, it so just happend that it
equally works for commands, every single type in depth shares the
same core marshalling and unmarshalling infrastructure]
It's a zero deps, no-alloc and no_st crate which unamrshals the full TCG
specification to both directions. I.e. you can build a TPM emulator
alike thing "in a day", and not just interface with a chip. As it runs
also on bare-metal (it's a stack allocated entity), it would scale even
to chip firmware.
I targeted this for Linux kernel, and thus the design choices. I just
thought what would be the part that would trigger me most if someone
submitted a Rust driver, and implemented it myself. Learning from what
I've seen basically :-) I totally support someone making a Rust driver
and I thought this in-depth understanding of the protocol is my best
possible contribution for such effort (binding IO shenanigans not so
much). E.g. you could use this to do a way better /dev/tpmrm0 than what
exists today with high-fidelity filtering and shit.
Obviously I hope to be a co-maintainer if such thing ever happens.
Since it is also independent crate it can be e.g., used to build
interoperability layers and stuff like that.
There's also a cli called simply "tpm2". I'll probably make it alll
available today or tomorrow.
BR, Jarkko
next reply other threads:[~2025-08-12 12:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 12:59 Jarkko Sakkinen [this message]
2025-08-13 0:40 ` tpm2_protocol Jarkko Sakkinen
2025-08-13 0:48 ` tpm2_protocol Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aJs6rWexGNsH45_Z@kernel.org \
--to=jarkko@kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tpm2@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.