Linux-Sgx Archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: linux-sgx@vger.kernel.org
Cc: Jarkko Sakkinen <jarkko@kernel.org>,
	James Bottomley <James.Bottomley@HansenPartnership.com>,
	William Roberts <bill.c.roberts@gmail.com>,
	Stefan Berger <stefanb@linux.ibm.com>,
	David Howells <dhowells@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Mimi Zohar <zohar@linux.ibm.com>
Subject: [PATCH v2 0/6] Extend struct tpm_buf to support sized buffers (TPM2B)
Date: Tue, 22 Aug 2023 20:52:15 +0300	[thread overview]
Message-ID: <20230822175221.2196136-1-jarkko@kernel.org> (raw)

This patch set implements my ideas on how to extend struct tpm_buf to
support TPM2 sized buffers (TPM2B). See Section 10.4 in TPM2 Structures
specification for more information.

The goal is to do initial groundwork for smoother landing of integrity
protection patches by James Bottomley.

I tested the patch set with:

https://github.com/jarkkojs/buildroot-tpmdd/tree/linux-6.5.y

Compilation:

make qemu_x86_64_defconfig
make 2>&1 | tee build.txt;

TPM1 startup: output/images/start-qemu.sh --use-system-swtpm --rtc --tpm1
TPM2 startup: output/images/start-qemu.sh --use-system-swtpm --rtc

For TPM2 I executed the following as the smoke test for these patches:

/usr/lib/kselftests/run_kselftest.sh
tpm2_createprimary --hierarchy o -G rsa2048 -c key.ctxt
tpm2_evictcontrol -c key.ctxt 0x81000001
keyctl add trusted kmk "new 32 keyhandle=0x81000001" @u
keyctl add encrypted 1000100010001000 "new ecryptfs trusted:kmk 64" @u

For TPM1 I tried:

keyctl add trusted kmk "new 32" @u

This caused TPM error 18, which AFAIK means that there is not SRK (?),
which is probably an issue in my swtpm configuration, which is visible
in board/qemu/start-qemu.sh.in.

Link: https://lore.kernel.org/linux-integrity/CT5OE5VZA7D7.3B7C6CK27JIK1@suppilovahvero/
Link: https://lore.kernel.org/linux-integrity/20230403214003.32093-1-James.Bottomley@HansenPartnership.com/
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: William Roberts <bill.c.roberts@gmail.com> 
Cc: Stefan Berger <stefanb@linux.ibm.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Mimi Zohar <zohar@linux.ibm.com>

James Bottomley (1):
  tpm: Move buffer handling from static inlines to real functions

Jarkko Sakkinen (5):
  tpm: Store TPM buffer length
  tpm: Detach tpm_buf_reset() from tpm_buf_init()
  tpm: Support TPM2 sized buffers (TPM2B)
  tpm: Add tpm_buf_read_{u8,u16,u32}
  KEYS: trusted: tpm2: Use struct tpm_buf for sized buffers

 drivers/char/tpm/Makefile                 |   1 +
 drivers/char/tpm/tpm-buf.c                | 195 ++++++++++++++++++++++
 drivers/char/tpm/tpm-interface.c          |  18 +-
 drivers/char/tpm/tpm-sysfs.c              |   3 +-
 drivers/char/tpm/tpm1-cmd.c               |  26 ++-
 drivers/char/tpm/tpm2-cmd.c               |  36 ++--
 drivers/char/tpm/tpm2-space.c             |   7 +-
 drivers/char/tpm/tpm_vtpm_proxy.c         |  13 +-
 include/linux/tpm.h                       |  96 ++---------
 security/keys/trusted-keys/trusted_tpm1.c |  12 +-
 security/keys/trusted-keys/trusted_tpm2.c |  60 ++++---
 11 files changed, 325 insertions(+), 142 deletions(-)
 create mode 100644 drivers/char/tpm/tpm-buf.c

-- 
2.39.2


             reply	other threads:[~2023-08-22 17:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 17:52 Jarkko Sakkinen [this message]
2023-08-22 17:52 ` [PATCH v2 1/6] tpm: Move buffer handling from static inlines to real functions Jarkko Sakkinen
2023-08-22 17:52 ` [PATCH v2 2/6] tpm: Store TPM buffer length Jarkko Sakkinen
2023-08-22 17:52 ` [PATCH v2 3/6] tpm: Detach tpm_buf_reset() from tpm_buf_init() Jarkko Sakkinen
2023-08-22 17:52 ` [PATCH v2 4/6] tpm: Support TPM2 sized buffers (TPM2B) Jarkko Sakkinen
2023-08-22 17:52 ` [PATCH v2 5/6] tpm: Add tpm_buf_read_{u8,u16,u32} Jarkko Sakkinen
2023-08-22 17:52 ` [PATCH v2 6/6] KEYS: trusted: tpm2: Use struct tpm_buf for sized buffers Jarkko Sakkinen
  -- strict thread matches above, loose matches on Subject: below --
2023-08-22 17:54 [PATCH v2 0/6] Extend struct tpm_buf to support sized buffers (TPM2B) 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=20230822175221.2196136-1-jarkko@kernel.org \
    --to=jarkko@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=bill.c.roberts@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-sgx@vger.kernel.org \
    --cc=stefanb@linux.ibm.com \
    --cc=zohar@linux.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).