All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: Stefan Berger <stefanb@linux.ibm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Vitaly Chikunov <vt@altlinux.org>,
	David Howells <dhowells@redhat.com>,
	Ignat Korchagin <ignat@cloudflare.com>,
	linux-crypto@vger.kernel.org, keyrings@vger.kernel.org
Subject: Re: [PATCH 3/3] crypto: ecdsa - Fix NIST P521 key size reported by KEYCTL_PKEY_QUERY
Date: Fri, 3 Jan 2025 18:38:06 +0100	[thread overview]
Message-ID: <Z3ggfuaY9WgApXbW@wunner.de> (raw)
In-Reply-To: <b8d40d86-21b5-40c6-89c7-3d792e3a791c@linux.ibm.com>

On Thu, Jan 02, 2025 at 12:45:47PM -0500, Stefan Berger wrote:
> On 12/26/24 1:08 PM, Lukas Wunner wrote:
> > When user space issues a KEYCTL_PKEY_QUERY system call for a NIST P521
> > key, the key_size is incorrectly reported as 528 bits instead of 521.
> 
> Is there a way to query this with keyctl pkey_query?

Yes, these are the commands I've used for testing:

  id=`keyctl padd asymmetric "" %:_uid.0 < end_responder.cert.der`
  keyctl pkey_query $id 0 enc=x962 hash=sha256

This is the certificate I've used:

  https://github.com/DMTF/libspdm/raw/refs/heads/main/unit_test/sample_key/ecp521/end_responder.cert.der

Before:

  key_size=528
  max_data_size=64
  max_sig_size=139
  max_enc_size=66
  max_dec_size=66
  encrypt=n
  decrypt=n
  sign=n
  verify=y

After:

  key_size=521
  max_data_size=64
  max_sig_size=139
  max_enc_size=0
  max_dec_size=0
  encrypt=n
  decrypt=n
  sign=n
  verify=y

Thanks,

Lukas

  reply	other threads:[~2025-01-03 17:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-26 18:08 [PATCH 0/3] ecdsa KEYCTL_PKEY_QUERY fixes Lukas Wunner
2024-12-26 18:08 ` [PATCH 1/3] crypto: sig - Prepare for algorithms with variable signature size Lukas Wunner
2025-01-02 15:06   ` Stefan Berger
2024-12-26 18:08 ` [PATCH 2/3] crypto: ecdsa - Fix enc/dec size reported by KEYCTL_PKEY_QUERY Lukas Wunner
2025-01-02 14:09   ` Stefan Berger
2024-12-26 18:08 ` [PATCH 3/3] crypto: ecdsa - Fix NIST P521 key " Lukas Wunner
2025-01-02 17:45   ` Stefan Berger
2025-01-03 17:38     ` Lukas Wunner [this message]
2025-01-03 18:06       ` Stefan Berger
2025-01-04  0:45   ` Herbert Xu
2025-01-04 11:31     ` Lukas Wunner

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=Z3ggfuaY9WgApXbW@wunner.de \
    --to=lukas@wunner.de \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ignat@cloudflare.com \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=stefanb@linux.ibm.com \
    --cc=vt@altlinux.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 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.