From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "James Bottomley" <James.Bottomley@HansenPartnership.com>,
<openssl-tpm2-engine@groups.io>,
"Jarkko Sakkinen" <jarkko.sakkinen@iki.fi>
Cc: <linux-integrity@vger.kernel.org>
Subject: Re: [openssl-tpm2-engine] [PATCH v2 1/8] tss: Fix handling of TPM_RH_NULL in intel-tss
Date: Mon, 05 Aug 2024 14:54:09 +0300 [thread overview]
Message-ID: <D37YHOXW44O0.98DXLONUWC1F@kernel.org> (raw)
In-Reply-To: <d0d83a418720467551faa718fd150c379a933652.camel@HansenPartnership.com>
On Mon Aug 5, 2024 at 5:48 AM EEST, James Bottomley wrote:
> On Mon, 2024-08-05 at 00:28 +0300, Jarkko Sakkinen wrote:
> [...]
> > > --- a/src/include/intel-tss.h
> > > +++ b/src/include/intel-tss.h
> > > @@ -251,14 +251,6 @@ intel_sess_helper(TSS_CONTEXT *tssContext,
> > > TPM_HANDLE auth, TPMA_SESSION flags)
> > > TPMA_SESSION_CONTINUESESSION |
> > > flags);
> > > }
> > >
> > > -static inline TPM_HANDLE
> > > -intel_handle(TPM_HANDLE h)
> > > -{
> > > - if (h == 0)
> > > - return ESYS_TR_NONE;
> > > - return h;
> > > -}
> > > -
> > > static inline void
> > > TSS_Delete(TSS_CONTEXT *tssContext)
> > > {
> > > @@ -937,8 +929,10 @@ tpm2_CreatePrimary(TSS_CONTEXT *tssContext,
> > > TPM_HANDLE primaryHandle,
> > > TPM2B_PUBLIC *opub;
> > > TPM_RC rc;
> > >
> > > - /* FIXME will generate wrong value for NULL hierarchy */
> > > - primaryHandle = intel_handle(primaryHandle);
> > > +
> > > + /* TPM_RH_NULL is mapped to ESYS_TR_NONE, which won't work
> > > here */
> > > + if (primaryHandle == TPM_RH_NULL)
> > > + primaryHandle = INT_TPM_RH_NULL;
> > >
> > > outsideInfo.size = 0;
> > > creationPcr.count = 0;
> > > @@ -993,9 +987,7 @@ tpm2_StartAuthSession(TSS_CONTEXT *tssContext,
> > > TPM_HANDLE tpmKey,
> > > TPM_HANDLE *sessionHandle,
> > > const char *bindPassword)
> > > {
> > > - bind = intel_handle(bind);
> > > - tpmKey = intel_handle(tpmKey);
> > > - if (bind != ESYS_TR_NONE)
> > > + if (bind != TPM_RH_NULL)
> > > intel_auth_helper(tssContext, bind, bindPassword);
> >
> > Not blaming the patch but just have hard time coping this.
> >
> > The most basic question is probably this: what is the application for
> > INT_TPM_RH_NULL?
>
> Ah, well, it turns out that the Intel TSS also isn't very performant
> and part of the performance loss is using a memory database for
> translating external TPM objects into internal ones. Some of the
> performance can be recovered by not doing this.
So INT_RH_NULL is a flag that translates to "do not translate to
internal object if it is derived from the nulll seed?". I.e. is it
some kind of skip flag?
External presentation is any TPM object I guess, but what is
conceptually the internal representation we are talking about here?
I wonder why nobody ever got idea that all kinds of TPM daemons
could use u64 for handles, and have future-proof robustness as in
TPM2 handles are u32.
BR, Jarkko
next prev parent reply other threads:[~2024-08-05 11:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 20:25 [PATCH 0/8] openssl_tpm2_engine: Add attestation functions for primary keys James Bottomley
2024-08-02 20:25 ` [PATCH 1/8] tss: Fix handling of TPM_RH_NULL in intel-tss James Bottomley
2024-08-03 17:08 ` Jarkko Sakkinen
2024-08-03 17:51 ` James Bottomley
2024-08-03 19:31 ` Jarkko Sakkinen
2024-08-03 19:47 ` James Bottomley
2024-08-03 20:43 ` Jarkko Sakkinen
2024-08-04 13:42 ` [PATCH v2 " James Bottomley
2024-08-04 15:37 ` [openssl-tpm2-engine] " James Bottomley
2024-08-04 21:28 ` Jarkko Sakkinen
2024-08-05 2:48 ` [openssl-tpm2-engine] " James Bottomley
2024-08-05 11:54 ` Jarkko Sakkinen [this message]
2024-08-02 20:26 ` [PATCH 2/8] libcommon: add ability to create a signing primary key James Bottomley
2024-08-02 20:26 ` [PATCH 3/8] libcommon: add bin2hex and tmp2_get_hexname James Bottomley
2024-08-03 17:21 ` Jarkko Sakkinen
2024-08-02 20:26 ` [PATCH 4/8] libcommon: add primary creation from template James Bottomley
2024-08-02 20:26 ` [PATCH 5/8] tss: add tpm2_Certify, tpm2_ActivateCredential and tpm2_PolicyOR James Bottomley
2024-08-02 20:26 ` [PATCH 6/8] tools: add new attest_tpm2_primary command James Bottomley
2024-08-02 20:26 ` [PATCH 7/8] attest_tpm2_primary: add man page James Bottomley
2024-08-02 20:26 ` [PATCH 8/8] tests: add tests for attest_tpm2_primary James Bottomley
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=D37YHOXW44O0.98DXLONUWC1F@kernel.org \
--to=jarkko@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=jarkko.sakkinen@iki.fi \
--cc=linux-integrity@vger.kernel.org \
--cc=openssl-tpm2-engine@groups.io \
/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).