1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-11-27 13:21:11 +03:00

Fix build with missing openssl/ecdh.h

This commit is contained in:
Aris Adamantiadis
2011-06-14 22:53:53 +02:00
parent 583a7f933a
commit db2d0ebc44
3 changed files with 9 additions and 2 deletions

View File

@@ -43,6 +43,7 @@
#ifdef HAVE_OPENSSL_ECDH_H #ifdef HAVE_OPENSSL_ECDH_H
#include <openssl/ecdh.h> #include <openssl/ecdh.h>
#endif #endif
#include "libssh/ecdh.h"
enum ssh_key_exchange_e { enum ssh_key_exchange_e {
/* diffie-hellman-group1-sha1 */ /* diffie-hellman-group1-sha1 */
@@ -53,9 +54,11 @@ enum ssh_key_exchange_e {
struct ssh_crypto_struct { struct ssh_crypto_struct {
bignum e,f,x,k,y; bignum e,f,x,k,y;
#ifdef HAVE_ECDH
EC_KEY *ecdh_privkey; EC_KEY *ecdh_privkey;
ssh_string ecdh_client_pubkey; ssh_string ecdh_client_pubkey;
ssh_string ecdh_server_pubkey; ssh_string ecdh_server_pubkey;
#endif
ssh_string dh_server_signature; /* information used by dh_handshake. */ ssh_string dh_server_signature; /* information used by dh_handshake. */
size_t digest_len; /* len of all the fields below */ size_t digest_len; /* len of all the fields below */
unsigned char *session_id; unsigned char *session_id;

View File

@@ -681,9 +681,11 @@ int make_sessionid(ssh_session session) {
} }
ssh_string_free(num); ssh_string_free(num);
#ifdef HAVE_ECDH
} else if (session->next_crypto->kex_type == SSH_KEX_ECDH_SHA2_NISTP256){ } else if (session->next_crypto->kex_type == SSH_KEX_ECDH_SHA2_NISTP256){
buffer_add_ssh_string(buf,session->next_crypto->ecdh_client_pubkey); buffer_add_ssh_string(buf,session->next_crypto->ecdh_client_pubkey);
buffer_add_ssh_string(buf,session->next_crypto->ecdh_server_pubkey); buffer_add_ssh_string(buf,session->next_crypto->ecdh_server_pubkey);
#endif
} }
num = make_bignum_string(session->next_crypto->k); num = make_bignum_string(session->next_crypto->k);
if (num == NULL) { if (num == NULL) {

View File

@@ -111,8 +111,10 @@ void crypto_free(struct ssh_crypto_struct *crypto){
bignum_free(crypto->x); bignum_free(crypto->x);
bignum_free(crypto->y); bignum_free(crypto->y);
bignum_free(crypto->k); bignum_free(crypto->k);
#ifdef HAVE_ECDH
SAFE_FREE(crypto->ecdh_client_pubkey); SAFE_FREE(crypto->ecdh_client_pubkey);
SAFE_FREE(crypto->ecdh_server_pubkey); SAFE_FREE(crypto->ecdh_server_pubkey);
#endif
#ifdef WITH_LIBZ #ifdef WITH_LIBZ
if (crypto->compress_out_ctx && if (crypto->compress_out_ctx &&