From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Ben Boeckel" <me@benboeckel.net>,
"James Bottomley" <James.Bottomley@hansenpartnership.com>
Cc: <linux-integrity@vger.kernel.org>, <keyrings@vger.kernel.org>
Subject: Re: [PATCH 1/6] tpm: consolidate TPM to crypto hash algorithm conversion
Date: Mon, 27 May 2024 14:18:33 +0300 [thread overview]
Message-ID: <D1KDWAY0DJUU.37W6F6RTTNVI0@kernel.org> (raw)
In-Reply-To: <ZlQBzdfyg1rSF_9a@farprobe>
On Mon May 27, 2024 at 6:45 AM EEST, Ben Boeckel wrote:
> On Fri, May 24, 2024 at 09:04:54 -0400, James Bottomley wrote:
> > diff --git a/include/linux/tpm.h b/include/linux/tpm.h
> > index c17e4efbb2e5..07f532456a0c 100644
> > --- a/include/linux/tpm.h
> > +++ b/include/linux/tpm.h
> > @@ -418,11 +418,61 @@ enum tpm2_session_attributes {
> > TPM2_SA_AUDIT = BIT(7),
> > };
> >
> > -struct tpm2_hash {
> > +static const struct {
> > unsigned int crypto_id;
> > unsigned int tpm_id;
> > +} tpm2_hash_map[] = {
> > + {HASH_ALGO_SHA1, TPM_ALG_SHA1},
> > + {HASH_ALGO_SHA256, TPM_ALG_SHA256},
> > + {HASH_ALGO_SHA384, TPM_ALG_SHA384},
> > + {HASH_ALGO_SHA512, TPM_ALG_SHA512},
> > + {HASH_ALGO_SM3_256, TPM_ALG_SM3_256},
> > };
> >
> > +/**
> > + * tpm2_crypto_to_alg() - convert a crypto hash to a TPM alg id
>
> Should "alg id" be "algorithm id" everwhere in the docs?
tpm2_hash_algorithm_from() would work for me.
> > + *
> > + * @hash: the crypto subsystem view of the hash
It is an instance of &hash_algo not "crypto subsystem view of the hash".
> > + *
> > + * Return: TPM algorithm id or -1 if no mapping was found.
> > + */
> > +static inline int tpm2_crypto_to_alg(int hash)
>
> How about naming this `crypto_id`?
It really should be @hash_info, which an instance of &hash_info.
Despite comments, this patch set will be ignored up until hmac
encryption needs no active attention and asymmetric keys have been
landed.
BR, Jarkko
next prev parent reply other threads:[~2024-05-27 11:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-24 13:04 [PATCH 0/6] Add policy to sealed keys James Bottomley
2024-05-24 13:04 ` [PATCH 1/6] tpm: consolidate TPM to crypto hash algorithm conversion James Bottomley
2024-05-24 13:40 ` Jarkko Sakkinen
2024-05-24 13:52 ` Jarkko Sakkinen
2024-05-27 3:45 ` Ben Boeckel
2024-05-27 11:18 ` Jarkko Sakkinen [this message]
2024-07-16 11:13 ` Jarkko Sakkinen
2024-05-24 13:04 ` [PATCH 2/6] tpm: add policy sessions James Bottomley
2024-07-16 11:53 ` Jarkko Sakkinen
2024-07-16 14:07 ` Jarkko Sakkinen
2024-07-16 14:08 ` Jarkko Sakkinen
2024-07-16 14:12 ` Jarkko Sakkinen
2024-07-18 2:30 ` James Bottomley
2024-07-19 13:21 ` Jarkko Sakkinen
2024-07-19 13:26 ` Jarkko Sakkinen
2024-05-24 13:04 ` [PATCH 3/6] KEYS: trusted: add PCR policy to TPM2 keys James Bottomley
2024-07-16 12:01 ` Jarkko Sakkinen
2024-05-24 13:04 ` [PATCH 4/6] KEYS: trusted: add ability to specify arbitrary policy James Bottomley
2024-07-16 12:01 ` Jarkko Sakkinen
2024-05-24 13:04 ` [PATCH 5/6] KEYS: trusted: implement counter/timer policy James Bottomley
2024-07-16 12:03 ` Jarkko Sakkinen
2024-05-24 13:04 ` [PATCH 6/6] KEYS: trusted: add support for TPM keys with signed policy James Bottomley
2024-07-16 12:03 ` Jarkko Sakkinen
2024-05-24 13:24 ` [PATCH 0/6] Add policy to sealed keys 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=D1KDWAY0DJUU.37W6F6RTTNVI0@kernel.org \
--to=jarkko@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=me@benboeckel.net \
/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).