From: Stefan Berger <stefanb@linux.ibm.com>
To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au,
davem@davemloft.net
Cc: linux-kernel@vger.kernel.org, jarkko@kernel.org, ardb@kernel.org,
salvatore.benedetto@intel.com, git@jvdsn.com,
Stefan Berger <stefanb@linux.ibm.com>
Subject: [PATCH v2 0/2] crypto: ecdh & ecc: Fix private key byte ordering issues
Date: Wed, 17 Apr 2024 12:21:15 -0400 [thread overview]
Message-ID: <20240417162117.2752326-1-stefanb@linux.ibm.com> (raw)
The 1st patch fixes a byte ordering issue where ctx->private_key is
currently passed to ecc_is_key_valid but the key is in reverse byte order.
To solve this issue it introduces the variable 'priv' that is already used
throughout the ecc and ecdh code bases for a private key in proper byte
order and calls the function with 'priv'.
The 2nd patch gets rid of the 'priv' variable wherever it is used to hold
a private key (byte-swapped initialized from ctx->private_key) in proper
byte order and uses ctx->private_key directly that is now initialized in
proper byte order.
Regards,
Stefan
v2:
- Added missing zeroizing of priv variable (1/2)
- Improved patch description (2/2)
Stefan Berger (2):
crypto: ecdh - Pass private key in proper byte order to check valid
key
crypto: ecdh & ecc - Initialize ctx->private_key in proper byte order
crypto/ecc.c | 29 ++++++++++-------------------
crypto/ecdh.c | 9 ++++++---
include/crypto/internal/ecc.h | 3 ++-
3 files changed, 18 insertions(+), 23 deletions(-)
--
2.43.0
next reply other threads:[~2024-04-17 16:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 16:21 Stefan Berger [this message]
2024-04-17 16:21 ` [PATCH v2 1/2] crypto: ecdh - Pass private key in proper byte order to check valid key Stefan Berger
2024-04-17 22:42 ` Jarkko Sakkinen
2024-04-17 16:21 ` [PATCH v2 2/2] crypto: ecdh & ecc - Initialize ctx->private_key in proper byte order Stefan Berger
2024-04-17 22:43 ` 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=20240417162117.2752326-1-stefanb@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=ardb@kernel.org \
--cc=davem@davemloft.net \
--cc=git@jvdsn.com \
--cc=herbert@gondor.apana.org.au \
--cc=jarkko@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=salvatore.benedetto@intel.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 read-only IMAP folder(s) and NNTP newsgroup(s).