From db2d0ebc44530ee101a40c3babbaa37ca3a13f00 Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Tue, 14 Jun 2011 22:53:53 +0200 Subject: Fix build with missing openssl/ecdh.h --- include/libssh/crypto.h | 3 +++ src/dh.c | 6 ++++-- src/wrapper.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/libssh/crypto.h b/include/libssh/crypto.h index 60a93f0..2b15594 100644 --- a/include/libssh/crypto.h +++ b/include/libssh/crypto.h @@ -43,6 +43,7 @@ #ifdef HAVE_OPENSSL_ECDH_H #include #endif +#include "libssh/ecdh.h" enum ssh_key_exchange_e { /* diffie-hellman-group1-sha1 */ @@ -53,9 +54,11 @@ enum ssh_key_exchange_e { struct ssh_crypto_struct { bignum e,f,x,k,y; +#ifdef HAVE_ECDH EC_KEY *ecdh_privkey; ssh_string ecdh_client_pubkey; ssh_string ecdh_server_pubkey; +#endif ssh_string dh_server_signature; /* information used by dh_handshake. */ size_t digest_len; /* len of all the fields below */ unsigned char *session_id; diff --git a/src/dh.c b/src/dh.c index 91e275a..ee83a66 100644 --- a/src/dh.c +++ b/src/dh.c @@ -681,10 +681,12 @@ int make_sessionid(ssh_session session) { } ssh_string_free(num); - } else if (session->next_crypto->kex_type == SSH_KEX_ECDH_SHA2_NISTP256){ +#ifdef HAVE_ECDH + } 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_server_pubkey); - } +#endif + } num = make_bignum_string(session->next_crypto->k); if (num == NULL) { goto error; diff --git a/src/wrapper.c b/src/wrapper.c index 5a6ed08..c4ba7d5 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -111,8 +111,10 @@ void crypto_free(struct ssh_crypto_struct *crypto){ bignum_free(crypto->x); bignum_free(crypto->y); bignum_free(crypto->k); +#ifdef HAVE_ECDH SAFE_FREE(crypto->ecdh_client_pubkey); SAFE_FREE(crypto->ecdh_server_pubkey); +#endif #ifdef WITH_LIBZ if (crypto->compress_out_ctx && -- cgit