Prerequisites


git clone git://git.libssh.org/projects/libssh.git libssh
cd libssh

Modify libssh source files


  • Open the file CMakeLists.txt in the root folder of your libssh sources and add this line somewhere at the start of the file:
set (OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT_DIR})
  • Open the file src/libcrypto-compat.c and comment the functions EVP_CIPHER_CTX_new and EVP_CIPHER_CTX_free

If you are more comfirtable with patches, here is a patch that you can apply to your libssh sources:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30b1025..5244595 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,8 @@ if (WITH_ZLIB)
     find_package(ZLIB REQUIRED)
 endif (WITH_ZLIB)

+set (OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT_DIR})
+
 if (WITH_GCRYPT)
   find_package(GCrypt 1.5.0 REQUIRED)
   if (NOT GCRYPT_FOUND)
diff --git a/src/libcrypto-compat.c b/src/libcrypto-compat.c
index e0c95ff..c3fd9e2 100644
--- a/src/libcrypto-compat.c
+++ b/src/libcrypto-compat.c
@@ -314,7 +314,7 @@ int HMAC_CTX_reset(HMAC_CTX *ctx)
     HMAC_CTX_init(ctx);
     return 1;
 }
-
+/*
 EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
 {
     return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
@@ -322,7 +322,7 @@ EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)

 void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
 {
-    /* EVP_CIPHER_CTX_reset(ctx); alias */
     EVP_CIPHER_CTX_init(ctx);
     OPENSSL_free(ctx);
 }
+*/
\ No newline at end of file

Build


Assuming you have installed your OpenSSL into C:\OpenSSL, open CMD terminal and type the following:

cd C:\path\to\libssh
set OPENSSL_ROOT_DIR=C:\OpenSSL
mkdir build-release
cd build-release
cmake .. -DCMAKE_BUILD_TYPE=Release -G"MinGW Makefiles" -DWITH_ZLIB=0
mingw32-make -j8
Edit - History - Print - Recent Changes - Search
Page last modified on February 16, 2017, at 03:58 PM