Linux cryptographic layer development
 help / color / mirror / Atom feed
* [PATCH 0/2] crypto: ecdh & ecc: Fix private key byte ordering issues
@ 2024-04-15  0:30 Stefan Berger
  2024-04-15  0:30 ` [PATCH 1/2] crypto: ecdh - Pass private key in proper byte order to check valid key Stefan Berger
  2024-04-15  0:30 ` [PATCH 2/2] crypto: ecdh & ecc - Initialize ctx->private_key in proper byte order Stefan Berger
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan Berger @ 2024-04-15  0:30 UTC (permalink / raw)
  To: linux-crypto, herbert, davem
  Cc: linux-kernel, jarkko, ardb, salvatore.benedetto, Stefan Berger

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


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                 |  3 ++-
 include/crypto/internal/ecc.h |  3 ++-
 3 files changed, 14 insertions(+), 21 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-17  2:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-15  0:30 [PATCH 0/2] crypto: ecdh & ecc: Fix private key byte ordering issues Stefan Berger
2024-04-15  0:30 ` [PATCH 1/2] crypto: ecdh - Pass private key in proper byte order to check valid key Stefan Berger
2024-04-15 18:53   ` Jarkko Sakkinen
2024-04-16  0:51     ` Stefan Berger
2024-04-16 14:25       ` Jarkko Sakkinen
2024-04-17  2:12         ` Joachim Vandersmissen
2024-04-17  2:31           ` Stefan Berger
2024-04-15  0:30 ` [PATCH 2/2] crypto: ecdh & ecc - Initialize ctx->private_key in proper byte order Stefan Berger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox