summaryrefslogtreecommitdiff
path: root/crypto/api.c
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.ibm.com>2024-04-18 11:24:45 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2024-04-26 17:26:09 +0800
commit210b65f5cb4a366976de0b3090021473a449712d (patch)
treeafda6a4e6f8094a6581b08b4d99170b3750ff30f /crypto/api.c
parentb9b16f5f27d2fba430baa8c5c7c543ae08afa7e1 (diff)
downloadlinux-crypto-210b65f5cb4a366976de0b3090021473a449712d.tar.gz
linux-crypto-210b65f5cb4a366976de0b3090021473a449712d.zip
crypto: ecdh - Initialize ctx->private_key in proper byte order
The private key in ctx->private_key is currently initialized in reverse byte order in ecdh_set_secret and whenever the key is needed in proper byte order the variable priv is introduced and the bytes from ctx->private_key are copied into priv while being byte-swapped (ecc_swap_digits). To get rid of the unnecessary byte swapping initialize ctx->private_key in proper byte order and clean up all functions that were previously using priv or were called with ctx->private_key: - ecc_gen_privkey: Directly initialize the passed ctx->private_key with random bytes filling all the digits of the private key. Get rid of the priv variable. This function only has ecdh_set_secret as a caller to create NIST P192/256/384 private keys. - crypto_ecdh_shared_secret: Called only from ecdh_compute_value with ctx->private_key. Get rid of the priv variable and work with the passed private_key directly. - ecc_make_pub_key: Called only from ecdh_compute_value with ctx->private_key. Get rid of the priv variable and work with the passed private_key directly. Cc: Salvatore Benedetto <salvatore.benedetto@intel.com> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Acked-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/api.c')
0 files changed, 0 insertions, 0 deletions