1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-20 02:42:09 +03:00

openssl.c: clean up curve25519 code (#499)

File: openssl.c, openssl.h, crypto.h, kex.c

Notes:
This cleans up a few things in the curve25519 implementation:

- There is no need to create X509_PUBKEYs or PKCS8_PRIV_KEY_INFOs to
  extract key material. EVP_PKEY_get_raw_private_key and
  EVP_PKEY_get_raw_public_key work fine.

- libssh2_x25519_ctx was never used (and occasionally mis-typedefed to
  libssh2_ed25519_ctx). Remove it. The _libssh2_curve25519_new and
  _libssh2_curve25519_gen_k interfaces use the bytes. Note, if it needs
  to be added back, there is no need to roundtrip through
  EVP_PKEY_new_raw_private_key. EVP_PKEY_keygen already generated an
  EVP_PKEY.

- Add some missing error checks.

Credit:
David Benjamin
This commit is contained in:
David Benjamin
2020-07-10 13:47:48 -04:00
committed by GitHub
parent ca9bb08908
commit 1a61d0c3ca
4 changed files with 30 additions and 56 deletions

View File

@@ -3195,7 +3195,7 @@ kex_method_curve25519_key_exchange
goto clean_exit;
}
rc = _libssh2_curve25519_new(session, NULL,
rc = _libssh2_curve25519_new(session,
&key_state->curve25519_public_key,
&key_state->curve25519_private_key);