From: Eric Biggers <ebiggers@kernel.org>
To: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: expose needs_key in procfs
Date: Mon, 1 Mar 2021 10:47:24 -0800 [thread overview]
Message-ID: <YD02vJhFkFiARX0q@gmail.com> (raw)
In-Reply-To: <20210301165917.2576180-1-christoph.boehmwalder@linbit.com>
On Mon, Mar 01, 2021 at 05:59:17PM +0100, Christoph Böhmwalder wrote:
> Currently, it is not apparent for userspace users which hash algorithms
> require a key and which don't. We have /proc/crypto, so add a field
> with this information there.
>
> Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
>
> ---
> crypto/shash.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/crypto/shash.c b/crypto/shash.c
> index 2e3433ad9762..d3127a0618f2 100644
> --- a/crypto/shash.c
> +++ b/crypto/shash.c
> @@ -477,6 +477,9 @@ static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg)
> seq_printf(m, "type : shash\n");
> seq_printf(m, "blocksize : %u\n", alg->cra_blocksize);
> seq_printf(m, "digestsize : %u\n", salg->digestsize);
> + seq_printf(m, "needs key : %s\n",
> + crypto_shash_alg_needs_key(salg) ?
> + "yes" : "no");
> }
>
Do you have a specific use case in mind for this information? Normally, users
should already know which algorithm they want to use (or set of algorithms they
might want to use).
Also, what about algorithms of type "ahash"? Shouldn't this field be added for
them too?
Also, what about algorithms such as blake2b-256 which optionally take a key (as
indicated by CRYPTO_ALG_OPTIONAL_KEY being set)? So it's not really "yes" or
"no"; there is a third state as well.
- Eric
next prev parent reply other threads:[~2021-03-02 6:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-01 16:59 [PATCH] crypto: expose needs_key in procfs Christoph Böhmwalder
2021-03-01 18:47 ` Eric Biggers [this message]
2021-03-01 20:51 ` Christoph Böhmwalder
2021-03-01 22:09 ` Eric Biggers
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=YD02vJhFkFiARX0q@gmail.com \
--to=ebiggers@kernel.org \
--cc=christoph.boehmwalder@linbit.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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