All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arun Menon <armenon@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Jarkko Sakkinen <jarkko@kernel.org>,
	Jason Gunthorpe <jgg@ziepe.ca>, Peter Huewe <peterhuewe@gmx.de>,
	linux-integrity@vger.kernel.org, Arun Menon <armenon@redhat.com>
Subject: [PATCH v5 5/7] tpm: Increase TPM_BUFSIZE to 8KB for chunking support
Date: Thu, 29 Oct 2026 23:45:39 +0530	[thread overview]
Message-ID: <20261029181541.99505-6-armenon@redhat.com> (raw)
In-Reply-To: <20261029181541.99505-1-armenon@redhat.com>

From: Arun Menon <armenon@redhat.com>

TPM_BUFSIZE limits the TPM2 command the kernel builds before handing
it to a chip driver's send() callback. TPM 2.0 Library Part 3:
Commands v185 adds ML-DSA key objects and the ML-KEM
TPM2_Encapsulate()/TPM2_Decapsulate() commands (sections 14.10,
14.11) [1]. NIST FIPS 204, Table 2, gives the largest ML-DSA
parameter set, ML-DSA-87, a 4896-byte private key and a 2592-byte
public key [2].
Loading such a key pair with TPM2_Load, plus header, handle and session,
comes to roughly 7.7KB - more than the current 4096-byte TPM_BUFSIZE.

Raise TPM_BUFSIZE to 8192 bytes. It covers this command with
headroom, and keeps every kzalloc(TPM_BUFSIZE, ...) call in the TPM
stack at an order-1 page allocation rather than a higher order.

This matches the largest parameter set defined today. NIST has already
published PQC families with larger keys and signatures than ML-DSA
(e.g. FIPS 205/SLH-DSA), so a future algorithm could exceed 8192 bytes.
CRB chunking, added later in this series, does not change that; it only
lets an already-built command cross a smaller MMIO window in pieces,
it does not change how large a command the generic stack can build.

[1] https://medias.cdn.trustedcomputinggroup.org/production/Trusted_Platform_Module_2_0_Library_Part_3_Commands_Version_185_pub_87a5c10230.pdf
[2] https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.204.pdf

Signed-off-by: Arun Menon <armenon@redhat.com>
---
 include/linux/tpm_command.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/tpm_command.h b/include/linux/tpm_command.h
index fc446a1282e2..4ad11068b090 100644
--- a/include/linux/tpm_command.h
+++ b/include/linux/tpm_command.h
@@ -434,7 +434,7 @@ struct tpm2_context {
  */
 
 #define TPM_DIGEST_SIZE		20	/* Max TPM v1.2 PCR size */
-#define TPM_BUFSIZE		4096
+#define TPM_BUFSIZE		8192
 
 /*
  * SHA-512 is, as of today, the largest digest in the TCG algorithm repository.
-- 
2.56.0


  parent reply	other threads:[~2026-10-29 18:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 18:15 [PATCH v5 0/7] tpm_crb: Add command and response buffer chunking support Arun Menon
2026-10-29 18:15 ` [PATCH v5 1/7] tpm_crb: Add register definitions of TPM CRB chunking fields Arun Menon
2026-10-29 18:15 ` [PATCH v5 2/7] tpm_crb: Split start method into a separate header Arun Menon
2026-10-29 18:15 ` [PATCH v5 3/7] tpm_crb: Add start_cmd parameter to tpm_crb_start wrapper Arun Menon
2026-10-29 18:15 ` [PATCH v5 4/7] tpm: tis_i2c: Use local 4KB buffer to limit memory usage Arun Menon
2026-10-29 18:15 ` Arun Menon [this message]
2026-10-29 18:55   ` [PATCH v5 5/7] tpm: Increase TPM_BUFSIZE to 8KB for chunking support Jarkko Sakkinen
2026-10-29 18:15 ` [PATCH v5 6/7] tpm_crb: Factor crb_send()/crb_recv() bodies into helpers Arun Menon
2026-10-29 19:27   ` Jarkko Sakkinen
2026-10-29 18:15 ` [PATCH v5 7/7] tpm_crb: Implement command and response chunking logic Arun Menon
2026-10-29 19:28   ` Jarkko Sakkinen
2026-10-29 23:30 ` [PATCH v5 0/7] tpm_crb: Add command and response buffer chunking support 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=20261029181541.99505-6-armenon@redhat.com \
    --to=armenon@redhat.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    /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.