From: Jarkko Sakkinen <jarkko@kernel.org>
To: linux-integrity@vger.kernel.org
Cc: James.Bottomley@HansenPartnership.com, roberto.sassu@huawei.com,
mapengyu@gmail.com, Jarkko Sakkinen <jarkko@kernel.org>,
Mimi Zohar <zohar@linux.ibm.com>,
David Howells <dhowells@redhat.com>,
Paul Moore <paul@paul-moore.com>,
James Morris <jmorris@namei.org>,
"Serge E. Hallyn" <serge@hallyn.com>,
keyrings@vger.kernel.org, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v3 1/7] tpm: Remove the top-level documentation tpm2-sessions.c
Date: Tue, 17 Sep 2024 18:44:30 +0300 [thread overview]
Message-ID: <20240917154444.702370-2-jarkko@kernel.org> (raw)
In-Reply-To: <20240917154444.702370-1-jarkko@kernel.org>
The documentation in the file header is duplicate documentation to the
documentation Documentation/security/tpm/tpm-security.rst and kdoc comments
attached to the exported functions in 'tpm2-sessions.c'.
Remove it as maintaining it would be just a waster of time and resources.
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
v3:
- Refine the commit message.
v2:
- Refine the commit message.
---
drivers/char/tpm/tpm2-sessions.c | 65 --------------------------------
1 file changed, 65 deletions(-)
diff --git a/drivers/char/tpm/tpm2-sessions.c b/drivers/char/tpm/tpm2-sessions.c
index 44f60730cff4..6cc1ea81c57c 100644
--- a/drivers/char/tpm/tpm2-sessions.c
+++ b/drivers/char/tpm/tpm2-sessions.c
@@ -1,71 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
-
/*
* Copyright (C) 2018 James.Bottomley@HansenPartnership.com
- *
- * Cryptographic helper routines for handling TPM2 sessions for
- * authorization HMAC and request response encryption.
- *
- * The idea is to ensure that every TPM command is HMAC protected by a
- * session, meaning in-flight tampering would be detected and in
- * addition all sensitive inputs and responses should be encrypted.
- *
- * The basic way this works is to use a TPM feature called salted
- * sessions where a random secret used in session construction is
- * encrypted to the public part of a known TPM key. The problem is we
- * have no known keys, so initially a primary Elliptic Curve key is
- * derived from the NULL seed (we use EC because most TPMs generate
- * these keys much faster than RSA ones). The curve used is NIST_P256
- * because that's now mandated to be present in 'TCG TPM v2.0
- * Provisioning Guidance'
- *
- * Threat problems: the initial TPM2_CreatePrimary is not (and cannot
- * be) session protected, so a clever Man in the Middle could return a
- * public key they control to this command and from there intercept
- * and decode all subsequent session based transactions. The kernel
- * cannot mitigate this threat but, after boot, userspace can get
- * proof this has not happened by asking the TPM to certify the NULL
- * key. This certification would chain back to the TPM Endorsement
- * Certificate and prove the NULL seed primary had not been tampered
- * with and thus all sessions must have been cryptographically secure.
- * To assist with this, the initial NULL seed public key name is made
- * available in a sysfs file.
- *
- * Use of these functions:
- *
- * The design is all the crypto, hash and hmac gunk is confined in this
- * file and never needs to be seen even by the kernel internal user. To
- * the user there's an init function tpm2_sessions_init() that needs to
- * be called once per TPM which generates the NULL seed primary key.
- *
- * These are the usage functions:
- *
- * tpm2_start_auth_session() which allocates the opaque auth structure
- * and gets a session from the TPM. This must be called before
- * any of the following functions. The session is protected by a
- * session_key which is derived from a random salt value
- * encrypted to the NULL seed.
- * tpm2_end_auth_session() kills the session and frees the resources.
- * Under normal operation this function is done by
- * tpm_buf_check_hmac_response(), so this is only to be used on
- * error legs where the latter is not executed.
- * tpm_buf_append_name() to add a handle to the buffer. This must be
- * used in place of the usual tpm_buf_append_u32() for adding
- * handles because handles have to be processed specially when
- * calculating the HMAC. In particular, for NV, volatile and
- * permanent objects you now need to provide the name.
- * tpm_buf_append_hmac_session() which appends the hmac session to the
- * buf in the same way tpm_buf_append_auth does().
- * tpm_buf_fill_hmac_session() This calculates the correct hash and
- * places it in the buffer. It must be called after the complete
- * command buffer is finalized so it can fill in the correct HMAC
- * based on the parameters.
- * tpm_buf_check_hmac_response() which checks the session response in
- * the buffer and calculates what it should be. If there's a
- * mismatch it will log a warning and return an error. If
- * tpm_buf_append_hmac_session() did not specify
- * TPM_SA_CONTINUE_SESSION then the session will be closed (if it
- * hasn't been consumed) and the auth structure freed.
*/
#include "tpm.h"
--
2.46.0
next prev parent reply other threads:[~2024-09-17 15:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-17 15:44 [PATCH v3 0/7] Lazy flush for the auth session Jarkko Sakkinen
2024-09-17 15:44 ` Jarkko Sakkinen [this message]
2024-09-17 15:44 ` [PATCH v3 2/7] tpm: Return on tpm2_create_null_primary() failure Jarkko Sakkinen
2024-09-17 15:44 ` [PATCH v3 3/7] tpm: Return on tpm2_create_primary() failure in tpm2_load_null() Jarkko Sakkinen
2024-09-17 15:44 ` [PATCH v3 4/7] tpm: flush the null key only when /dev/tpm0 is accessed Jarkko Sakkinen
2024-09-17 15:44 ` [PATCH v3 5/7] tpm: Allocate chip->auth in tpm2_start_auth_session() Jarkko Sakkinen
2024-09-17 15:44 ` [PATCH v3 6/7] tpm: flush the auth session only when /dev/tpm0 is open Jarkko Sakkinen
2024-09-17 15:44 ` [PATCH v3 7/7] tpm: open code tpm2_create_null_primary() Jarkko Sakkinen
2024-09-18 6:47 ` [PATCH v3 0/7] Lazy flush for the auth session Pengyu Ma
2024-09-18 20:38 ` 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=20240917154444.702370-2-jarkko@kernel.org \
--to=jarkko@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=dhowells@redhat.com \
--cc=jmorris@namei.org \
--cc=keyrings@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=mapengyu@gmail.com \
--cc=paul@paul-moore.com \
--cc=roberto.sassu@huawei.com \
--cc=serge@hallyn.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 NNTP newsgroup(s).