From e272e1eac131aaa75fb0194538783b189f872b61 Mon Sep 17 00:00:00 2001 From: wildart Date: Thu, 14 Jul 2016 11:17:32 -0400 Subject: [PATCH] use release tag for libssh2 --- .../md5 | 1 + .../sha512 | 1 + .../md5 | 1 - .../sha512 | 1 - deps/libssh2.version | 4 +- deps/patches/libssh2-mbedtls.patch | 529 +++++++++++++++++- 6 files changed, 530 insertions(+), 7 deletions(-) create mode 100644 deps/checksums/libssh2-6d553a7bb94966466c4db0abf9a26660e786a275.tar.gz/md5 create mode 100644 deps/checksums/libssh2-6d553a7bb94966466c4db0abf9a26660e786a275.tar.gz/sha512 delete mode 100644 deps/checksums/libssh2-7934c9ce2a029c43e3642a492d3b9e494d1542be.tar.gz/md5 delete mode 100644 deps/checksums/libssh2-7934c9ce2a029c43e3642a492d3b9e494d1542be.tar.gz/sha512 diff --git a/deps/checksums/libssh2-6d553a7bb94966466c4db0abf9a26660e786a275.tar.gz/md5 b/deps/checksums/libssh2-6d553a7bb94966466c4db0abf9a26660e786a275.tar.gz/md5 new file mode 100644 index 0000000000000..10e23f7fb56e2 --- /dev/null +++ b/deps/checksums/libssh2-6d553a7bb94966466c4db0abf9a26660e786a275.tar.gz/md5 @@ -0,0 +1 @@ +25c40973c9cdcd7919c0b74ca0d06dd1 diff --git a/deps/checksums/libssh2-6d553a7bb94966466c4db0abf9a26660e786a275.tar.gz/sha512 b/deps/checksums/libssh2-6d553a7bb94966466c4db0abf9a26660e786a275.tar.gz/sha512 new file mode 100644 index 0000000000000..5fdf997bca855 --- /dev/null +++ b/deps/checksums/libssh2-6d553a7bb94966466c4db0abf9a26660e786a275.tar.gz/sha512 @@ -0,0 +1 @@ +eea5e3638395cb5711f97b36adfa05a9c1cb24cf3b5639cb0a20d74855da025c2db2ff3eeb6bf37d49977e2d9fcf2b929e5c5d874c65754c280defaacb9f3eb8 diff --git a/deps/checksums/libssh2-7934c9ce2a029c43e3642a492d3b9e494d1542be.tar.gz/md5 b/deps/checksums/libssh2-7934c9ce2a029c43e3642a492d3b9e494d1542be.tar.gz/md5 deleted file mode 100644 index 8be6221cb0950..0000000000000 --- a/deps/checksums/libssh2-7934c9ce2a029c43e3642a492d3b9e494d1542be.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -41eb49bcd2800bcf2cc12263be16cdfb diff --git a/deps/checksums/libssh2-7934c9ce2a029c43e3642a492d3b9e494d1542be.tar.gz/sha512 b/deps/checksums/libssh2-7934c9ce2a029c43e3642a492d3b9e494d1542be.tar.gz/sha512 deleted file mode 100644 index 35f599b6b6d17..0000000000000 --- a/deps/checksums/libssh2-7934c9ce2a029c43e3642a492d3b9e494d1542be.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -455a853076b94944a09965c57a97454989a0f6c87cd9927a75f3bce69ceff56cbe4a34b40deadcf70923434dd20381f6f4fae1564b41d3d8a970bee5f50efee0 diff --git a/deps/libssh2.version b/deps/libssh2.version index 5e0bbbfa8c85c..e661e4b436309 100644 --- a/deps/libssh2.version +++ b/deps/libssh2.version @@ -1,2 +1,2 @@ -LIBSSH2_BRANCH=master -LIBSSH2_SHA1=7934c9ce2a029c43e3642a492d3b9e494d1542be +LIBSSH2_BRANCH=libssh2-1.7.0 +LIBSSH2_SHA1=6d553a7bb94966466c4db0abf9a26660e786a275 diff --git a/deps/patches/libssh2-mbedtls.patch b/deps/patches/libssh2-mbedtls.patch index ffab8f7786685..8afe5c4b2ea4f 100644 --- a/deps/patches/libssh2-mbedtls.patch +++ b/deps/patches/libssh2-mbedtls.patch @@ -35,6 +35,47 @@ index 9d6c0be..8bc1292 100644 install: - mkdir bin +diff --git a/README b/README +index 39abc20..8a14856 100644 +--- a/README ++++ b/README +@@ -4,9 +4,9 @@ libssh2 - SSH2 library + libssh2 is a library implementing the SSH2 protocol, available under + the revised BSD license. + +-Web site: http://www.libssh2.org/ ++Web site: https://www.libssh2.org/ + +-Mailing list: http://cool.haxx.se/mailman/listinfo/libssh2-devel ++Mailing list: https://cool.haxx.se/mailman/listinfo/libssh2-devel + + License: see COPYING + +diff --git a/RELEASE-NOTES b/RELEASE-NOTES +index 2b22288..94525cb 100644 +--- a/RELEASE-NOTES ++++ b/RELEASE-NOTES +@@ -11,7 +11,7 @@ This release includes the following changes: + This release includes the following security advisory: + + o diffie_hellman_sha256: convert bytes to bits +- CVE-2016-0787: http://www.libssh2.org/adv_20160223.html ++ CVE-2016-0787: https://www.libssh2.org/adv_20160223.html + + This release includes the following bugfixes: + +@@ -49,8 +49,8 @@ advice from friends like these: + + Alexander Lamaison, Andreas Schneider, brian m. carlson, Daniel Stenberg, + David Byron, Jakob Egger, Kamil Dudka, Marc Hoersken, Mizunashi Mana, +- Patrick Monnerat, Paul Howarth, Salvador Fandino, Salvador Fandiño, +- Salvador Fandiño, Viktor Szakats, Will Cosgrove, +- (16 contributors) ++ Patrick Monnerat, Paul Howarth, Salvador Fandiño, Viktor Szakats, ++ Will Cosgrove ++ (14 contributors) + + Thanks! (and sorry if I forgot to mention someone) diff --git a/cmake/FindmbedTLS.cmake b/cmake/FindmbedTLS.cmake new file mode 100644 index 0000000..2f4adbc @@ -105,6 +146,184 @@ index 0000000..2f4adbc + MBEDX509_LIBRARY + MBEDCRYPTO_LIBRARY +) +diff --git a/docs/BINDINGS b/docs/BINDINGS +index b97758f..471f9be 100644 +--- a/docs/BINDINGS ++++ b/docs/BINDINGS +@@ -10,16 +10,16 @@ Cocoa/Objective-C + https://github.com/karelia/libssh2_sftp-Cocoa-wrapper + + Haskell +- FFI bindings - http://hackage.haskell.org/package/libssh2 ++ FFI bindings - https://hackage.haskell.org/package/libssh2 + + Perl +- Net::SSH2 - http://search.cpan.org/~rkitover/Net-SSH2-0.45/lib/Net/SSH2.pm ++ Net::SSH2 - https://metacpan.org/pod/Net::SSH2 + + PHP +- ssh2 - http://pecl.php.net/package/ssh2 ++ ssh2 - https://pecl.php.net/package/ssh2 + + Python +- pylibssh2 - http://www.wallix.org/pylibssh2-project/ ++ pylibssh2 - https://pypi.python.org/pypi/pylibssh2 + + Python-ctypes + +diff --git a/docs/INSTALL_AUTOTOOLS b/docs/INSTALL_AUTOTOOLS +index bc5a0eb..b469533 100644 +--- a/docs/INSTALL_AUTOTOOLS ++++ b/docs/INSTALL_AUTOTOOLS +@@ -284,7 +284,7 @@ Some ./configure options deserve additional comments: + * --with-libgcrypt-prefix=DIR + + libssh2 can use the Libgcrypt library +- (http://www.gnupg.org/) for cryptographic operations. ++ (https://www.gnupg.org/) for cryptographic operations. + Either Libgcrypt or OpenSSL is required. + + Configure will attempt to locate Libgcrypt +@@ -298,7 +298,7 @@ Some ./configure options deserve additional comments: + * --with-libssl-prefix=[DIR] + + libssh2 can use the OpenSSL library +- (http://www.openssl.org) for cryptographic operations. ++ (https://www.openssl.org) for cryptographic operations. + Either Libgcrypt or OpenSSL is required. + + Configure will attempt to locate OpenSSL in the +diff --git a/docs/INSTALL_CMAKE b/docs/INSTALL_CMAKE +index 7040370..d2d7169 100644 +--- a/docs/INSTALL_CMAKE ++++ b/docs/INSTALL_CMAKE +@@ -47,8 +47,8 @@ The following options are available: + * `CRYPTO_BACKEND=` + + Chooses a specific cryptography library to use for cryptographic +- operations. Can be `OpenSSL` (http://www.openssl.org), +- `Libgcrypt` (http://www.gnupg.org/), `WinCNG` (Windows Vista+) or ++ operations. Can be `OpenSSL` (https://www.openssl.org), ++ `Libgcrypt` (https://www.gnupg.org/), `WinCNG` (Windows Vista+) or + blank to use any library available. + + CMake will attempt to locate the libraries automatically. See [2] +@@ -161,14 +161,14 @@ builds your project: + Libssh2 + URL + URL_HASH SHA1= +- INSTALL_COMMAND "") ++ INSTALL_COMMAND "") + + ExternalProject_Add( + MyProject DEPENDS Libssh2 + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src + INSTALL_COMMAND "") + +-[1] http://www.cmake.org/cmake/resources/software.html +-[2] http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html +-[3] http://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html#package-registry +-[4] http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html +\ No newline at end of file ++[1] https://www.cmake.org/cmake/resources/software.html ++[2] https://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html ++[3] https://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html#package-registry ++[4] http://www.kitware.com/media/html/BuildingExternalProjectsWithCMake2.8.html +diff --git a/docs/libssh2_sftp_get_channel.3 b/docs/libssh2_sftp_get_channel.3 +index f3d364a..d1d82bc 100644 +--- a/docs/libssh2_sftp_get_channel.3 ++++ b/docs/libssh2_sftp_get_channel.3 +@@ -1,21 +1,21 @@ +-.TH libssh2_sftp_get_channel 3 "9 Sep 2011" "libssh2 1.4.0" "libssh2 manual" +-.SH NAME +-libssh2_sftp_get_channel - return the channel of sftp +-.SH SYNOPSIS +-.nf +-#include +-#include +- +-.fi +-LIBSSH2_CHANNEL *libssh2_sftp_get_channel(LIBSSH2_SFTP *sftp); +-.SH DESCRIPTION +-\fIsftp\fP - SFTP instance as returned by +-.BR libssh2_sftp_init(3) +- +-Return the channel of the given sftp handle. +-.SH RETURN VALUE +-The channel of the SFTP instance or NULL if something was wrong. +-.SH AVAILABILITY +-Added in 1.4.0 +-.SH SEE ALSO +-.BR libssh2_sftp_init(3) ++.TH libssh2_sftp_get_channel 3 "9 Sep 2011" "libssh2 1.4.0" "libssh2 manual" ++.SH NAME ++libssh2_sftp_get_channel - return the channel of sftp ++.SH SYNOPSIS ++.nf ++#include ++#include ++ ++.fi ++LIBSSH2_CHANNEL *libssh2_sftp_get_channel(LIBSSH2_SFTP *sftp); ++.SH DESCRIPTION ++\fIsftp\fP - SFTP instance as returned by ++.BR libssh2_sftp_init(3) ++ ++Return the channel of the given sftp handle. ++.SH RETURN VALUE ++The channel of the SFTP instance or NULL if something was wrong. ++.SH AVAILABILITY ++Added in 1.4.0 ++.SH SEE ALSO ++.BR libssh2_sftp_init(3) +diff --git a/example/subsystem_netconf.c b/example/subsystem_netconf.c +index 96ef54a..82c4941 100644 +--- a/example/subsystem_netconf.c ++++ b/example/subsystem_netconf.c +@@ -250,7 +250,7 @@ int main(int argc, char *argv[]) + goto shutdown; + } + +- /* NETCONF: http://tools.ietf.org/html/draft-ietf-netconf-ssh-06 */ ++ /* NETCONF: https://tools.ietf.org/html/draft-ietf-netconf-ssh-06 */ + + fprintf(stderr, "Sending NETCONF client \n"); + snprintf(buf, sizeof(buf), +diff --git a/include/libssh2.h b/include/libssh2.h +index c157757..9ef9ff1 100644 +--- a/include/libssh2.h ++++ b/include/libssh2.h +@@ -202,7 +202,16 @@ typedef off_t libssh2_struct_stat_size; + #endif + + #ifndef LIBSSH2_STRUCT_STAT_SIZE_FORMAT +-# define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%zd" ++# ifdef __VMS ++/* We have to roll our own format here because %z is a C99-ism we don't have. */ ++# if __USE_OFF64_T || __USING_STD_STAT ++# define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%Ld" ++# else ++# define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%d" ++# endif ++# else ++# define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%zd" ++# endif + typedef struct stat libssh2_struct_stat; + typedef off_t libssh2_struct_stat_size; + #endif +diff --git a/libssh2.pc.in b/libssh2.pc.in +index 084918a..9663816 100644 +--- a/libssh2.pc.in ++++ b/libssh2.pc.in +@@ -8,7 +8,7 @@ libdir=@libdir@ + includedir=@includedir@ + + Name: libssh2 +-URL: http://www.libssh2.org/ ++URL: https://www.libssh2.org/ + Description: Library for SSH-based communication + Version: @LIBSSH2VER@ + Requires.private: @LIBSREQUIRED@ diff --git a/mbedtls/buildmbedtls b/mbedtls/buildmbedtls new file mode 100755 index 0000000..2385a8b @@ -162,8 +381,39 @@ index 0000000..1f774ec + //#define MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT 384 /**< Maximum size of (re)seed buffer */ + + /* ECP options */ +diff --git a/nw/GNUmakefile b/nw/GNUmakefile +index 0a1d0b3..8899fdd 100644 +--- a/nw/GNUmakefile ++++ b/nw/GNUmakefile +@@ -38,7 +38,7 @@ DEVLARC = $(DEVLDIR).zip + TARGET = libssh2 + VERSION = $(LIBSSH2_VERSION) + CPRIGHT = Copyright (c) $(LIBSSH2_COPYRIGHT_STR) +-WWWURL = http://www.libssh2.org/ ++WWWURL = https://www.libssh2.org/ + DESCR = libssh2 $(LIBSSH2_VERSION_STR) ($(LIBARCH)) - $(WWWURL) + MTSAFE = YES + STACK = 64000 +@@ -223,7 +223,7 @@ include ../Makefile.inc + OBJECTS := $(patsubst %.c,%.o,$(CSOURCES)) + ifeq ($(LIBARCH),CLIB) + # CLIB lacks of snprint() function - here's a replacement: +-# http://www.ijs.si/software/snprintf/ ++# https://www.ijs.si/software/snprintf/ + OBJECTS += snprintf.o + vpath %.c $(SNPRINTF) + endif +@@ -388,7 +388,7 @@ libssh2_config.h: GNUmakefile + @echo $(DL)** All your changes will be lost!!$(DL) >> $@ + @echo $(DL)*/$(DL) >> $@ + @echo $(DL)#define VERSION "$(LIBSSH2_VERSION_STR)"$(DL) >> $@ +- @echo $(DL)#define PACKAGE_BUGREPORT "http://sourceforge.net/projects/libssh2"$(DL) >> $@ ++ @echo $(DL)#define PACKAGE_BUGREPORT "https://github.com/libssh2/libssh2/issues"$(DL) >> $@ + ifeq ($(LIBARCH),CLIB) + @echo $(DL)#define OS "i586-pc-clib-NetWare"$(DL) >> $@ + @echo $(DL)#define NETDB_USE_INTERNET 1$(DL) >> $@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index c29a2d8..987dfe0 100644 +index 1a76399..987dfe0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,7 +48,7 @@ set(CRYPTO_BACKEND @@ -175,7 +425,19 @@ index c29a2d8..987dfe0 100644 or empty to try any available") # If the crypto backend was given, rather than searching for the first -@@ -151,6 +151,21 @@ if(CRYPTO_BACKEND STREQUAL "WinCNG" OR NOT CRYPTO_BACKEND) +@@ -71,6 +71,11 @@ if(CRYPTO_BACKEND STREQUAL "OpenSSL" OR NOT CRYPTO_BACKEND) + list(APPEND PC_REQUIRES_PRIVATE libssl libcrypto) + + if (WIN32) ++ # Statically linking to OpenSSL requires crypt32 for some Windows APIs. ++ # This should really be handled by FindOpenSSL.cmake. ++ list(APPEND LIBRARIES crypt32) ++ list(APPEND PC_LIBS -lcrypt32) ++ + find_file(DLL_LIBEAY32 + NAMES libeay32.dll crypto.dll + HINTS ${_OPENSSL_ROOT_HINTS} PATHS ${_OPENSSL_ROOT_PATHS} +@@ -146,6 +151,21 @@ if(CRYPTO_BACKEND STREQUAL "WinCNG" OR NOT CRYPTO_BACKEND) endif() endif() @@ -197,7 +459,7 @@ index c29a2d8..987dfe0 100644 if(NOT CRYPTO_BACKEND) message(FATAL_ERROR "No suitable cryptography backend found.") endif() -@@ -209,6 +224,11 @@ target_include_directories(libssh2 +@@ -204,6 +224,11 @@ target_include_directories(libssh2 ## Options @@ -209,6 +471,19 @@ index c29a2d8..987dfe0 100644 add_feature_info("Shared library" BUILD_SHARED_LIBS "creating libssh2 as a shared library (.so/.dll)") +diff --git a/src/channel.c b/src/channel.c +index 32d914d..538a0ab 100644 +--- a/src/channel.c ++++ b/src/channel.c +@@ -270,7 +270,7 @@ _libssh2_channel_open(LIBSSH2_SESSION * session, const char *channel_type, + switch (reason_code) { + case SSH_OPEN_ADMINISTRATIVELY_PROHIBITED: + _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_FAILURE, +- "Channel open failure (admininstratively prohibited)"); ++ "Channel open failure (administratively prohibited)"); + break; + case SSH_OPEN_CONNECT_FAILED: + _libssh2_error(session, LIBSSH2_ERROR_CHANNEL_FAILURE, diff --git a/src/crypto.h b/src/crypto.h index caad19f..aa997a3 100644 --- a/src/crypto.h @@ -224,6 +499,48 @@ index caad19f..aa997a3 100644 int _libssh2_rsa_new(libssh2_rsa_ctx ** rsa, const unsigned char *edata, unsigned long elen, +diff --git a/src/kex.c b/src/kex.c +index e89b36c..65b722f 100644 +--- a/src/kex.c ++++ b/src/kex.c +@@ -133,7 +133,7 @@ static int diffie_hellman_sha1(LIBSSH2_SESSION *session, + memset(&exchange_state->req_state, 0, sizeof(packet_require_state_t)); + + /* Generate x and e */ +- _libssh2_bn_rand(exchange_state->x, group_order, 0, -1); ++ _libssh2_bn_rand(exchange_state->x, group_order * 8 - 1, 0, -1); + _libssh2_bn_mod_exp(exchange_state->e, g, exchange_state->x, p, + exchange_state->ctx); + +diff --git a/src/libgcrypt.c b/src/libgcrypt.c +index e85aecd..366d007 100644 +--- a/src/libgcrypt.c ++++ b/src/libgcrypt.c +@@ -409,6 +409,9 @@ _libssh2_rsa_sha1_sign(LIBSSH2_SESSION * session, + } + + *signature = LIBSSH2_ALLOC(session, size); ++ if (!*signature) { ++ return -1; ++ } + memcpy(*signature, tmp, size); + *signature_len = size; + +diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h +index ae691ad..b4296a2 100644 +--- a/src/libssh2_priv.h ++++ b/src/libssh2_priv.h +@@ -65,8 +65,8 @@ + consistent names of these fields. While arguable the best would to + change libssh2.h to use other names, that would break backwards + compatibility. For more information, see: +- http://www.mail-archive.com/libssh2-devel%40lists.sourceforge.net/msg00003.html +- http://www.mail-archive.com/libssh2-devel%40lists.sourceforge.net/msg00224.html ++ https://www.mail-archive.com/libssh2-devel%40lists.sourceforge.net/msg00003.html ++ https://www.mail-archive.com/libssh2-devel%40lists.sourceforge.net/msg00224.html + */ + #ifdef HAVE_POLL + # include diff --git a/src/mbedtls.c b/src/mbedtls.c new file mode 100644 index 0000000..98bc549 @@ -1174,3 +1491,209 @@ index 0000000..f594575 + const char *privatekeydata, + size_t privatekeydata_len, + const char *passphrase); +diff --git a/src/sftp.c b/src/sftp.c +index c142713..7c44116 100644 +--- a/src/sftp.c ++++ b/src/sftp.c +@@ -1527,7 +1527,7 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE * handle, char *buffer, + if (chunk->offset != filep->offset) { + /* This could happen if the server returns less bytes than + requested, which shouldn't happen for normal files. See: +- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-02 ++ https://tools.ietf.org/html/draft-ietf-secsh-filexfer-02 + #section-6.4 + */ + return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL, +diff --git a/src/wincng.c b/src/wincng.c +index 635b3e3..d3271b3 100755 +--- a/src/wincng.c ++++ b/src/wincng.c +@@ -861,7 +861,7 @@ _libssh2_wincng_rsa_new(libssh2_rsa_ctx **rsa, + memset(key, 0, keylen); + + +- /* http://msdn.microsoft.com/library/windows/desktop/aa375531.aspx */ ++ /* https://msdn.microsoft.com/library/windows/desktop/aa375531.aspx */ + rsakey = (BCRYPT_RSAKEY_BLOB *)key; + rsakey->BitLength = mlen * 8; + rsakey->cbPublicExp = elen; +@@ -1179,7 +1179,7 @@ _libssh2_wincng_dsa_new(libssh2_dsa_ctx **dsa, + memset(key, 0, keylen); + + +- /* http://msdn.microsoft.com/library/windows/desktop/aa833126.aspx */ ++ /* https://msdn.microsoft.com/library/windows/desktop/aa833126.aspx */ + dsakey = (BCRYPT_DSA_KEY_BLOB *)key; + dsakey->cbKey = length; + +@@ -1903,7 +1903,7 @@ _libssh2_wincng_bignum_mod_exp(_libssh2_bn *r, + return -1; + + +- /* http://msdn.microsoft.com/library/windows/desktop/aa375531.aspx */ ++ /* https://msdn.microsoft.com/library/windows/desktop/aa375531.aspx */ + rsakey = (BCRYPT_RSAKEY_BLOB *)key; + rsakey->Magic = BCRYPT_RSAPUBLIC_MAGIC; + rsakey->BitLength = m->length * 8; +diff --git a/vms/libssh2_config.h b/vms/libssh2_config.h +index 2eb09a8..b8f73e2 100644 +--- a/vms/libssh2_config.h ++++ b/vms/libssh2_config.h +@@ -14,6 +14,7 @@ typedef unsigned int socklen_t; /* missing in headers on VMS */ + /* Have's */ + + #define HAVE_UNISTD_H ++#define HAVE_STDLIB_H + #define HAVE_INTTYPES_H + #define HAVE_SYS_TIME_H + #define HAVE_SELECT +@@ -23,6 +24,8 @@ typedef unsigned int socklen_t; /* missing in headers on VMS */ + #define HAVE_NETINET_IN_H + #define HAVE_ARPA_INET_H + ++#define HAVE_GETTIMEOFDAY 1 ++ + #define POSIX_C_SOURCE + + /* Enable the possibility of using tracing */ +@@ -68,8 +71,11 @@ typedef unsigned int socklen_t; /* missing in headers on VMS */ + + #endif + ++/* Use OpenSSL */ ++#define LIBSSH2_OPENSSL 1 ++ + /* Compile in zlib support. We link against gnv$libzshr, as available +- * on encompasserve.com. ++ * from https://sourceforge.net/projects/vms-ports/files/. + */ + + #define LIBSSH2_HAVE_ZLIB +diff --git a/vms/libssh2_make_example.dcl b/vms/libssh2_make_example.dcl +index d8191f3..af4116d 100644 +--- a/vms/libssh2_make_example.dcl ++++ b/vms/libssh2_make_example.dcl +@@ -29,6 +29,7 @@ $ this = f$search("exadir:*.c;0") + $ if this .eqs. "" then goto EndLoop + $! + $ what = f$parse( this,,,"name") ++$ if what .eqs. "x11" then goto loop ! not portable yet + $ call Make + $! + $ goto Loop +@@ -84,7 +85,7 @@ $ define objdir 'objdir' + $ define exadir 'exadir' + $! + $ cc_include = "/include=([],[-.include])" +-$ cc_flags = "/name=shortened/show=all" ++$ cc_flags = "/name=shortened/show=all/define=(_USE_STD_STAT=1)" + $ link_opts = "objdir:libssh2_''thisid'.opt" + $! + $! +diff --git a/vms/libssh2_make_help.dcl b/vms/libssh2_make_help.dcl +index b28265d..b36512e 100644 +--- a/vms/libssh2_make_help.dcl ++++ b/vms/libssh2_make_help.dcl +@@ -11,23 +11,27 @@ $ man2help sys$input: libssh2.hlp -b 1 + + LIBSSH2 + +-OpenVMS port of the public domain libssh2 library, which +-provides an API to implement client SSH communciation. ++OpenVMS port of the libssh2 library, which provides an ++API to implement client SSH communication. + +-License information is available at the copying subtopic. ++License information is available at the Copying subtopic. + + $! + $ open/append mh libssh2.hlp + $ write mh helpversion + $ close mh + $! +-$ man2help -a [-]readme.; libssh2.hlp -b 2 +-$ man2help -a [-]authors.; libssh2.hlp -b 2 +-$ man2help -a [-]copying.; libssh2.hlp -b 2 +-$ man2help -a [-]news.; libssh2.hlp -b 2 +-$ man2help -a [-]release-notes.; libssh2.hlp -b 2 +-$ man2help -a [-]hacking.; libssh2.hlp -b 2 +-$ man2help -a [-]todo.; libssh2.hlp -b 2 ++$ man2help -a [-]README.; libssh2.hlp -b 2 ++$ man2help -a [-]COPYING.; libssh2.hlp -b 2 ++$ man2help -a [-]NEWS.; libssh2.hlp -b 2 ++$ man2help -a [-]RELEASE-NOTES.; libssh2.hlp -b 2 ++$ man2help -a [-.docs]AUTHORS.; libssh2.hlp -b 2 ++$ man2help -a [-.docs]BINDINGS.; libssh2.hlp -b 2 ++$ man2help -a [-.docs]HACKING.; libssh2.hlp -b 2 ++$ if f$search("[]HACKING_CRYPTO.") .nes. "" then delete []HACKING_CRYPTO.;* ++$ copy [-.docs]HACKING.CRYPTO; []HACKING_CRYPTO. ++$ man2help -a []HACKING_CRYPTO.; libssh2.hlp -b 2 ++$ man2help -a [-.docs]TODO.; libssh2.hlp -b 2 + $! + $ man2help -a sys$input: libssh2.hlp -b 2 + +diff --git a/vms/libssh2_make_kit.dcl b/vms/libssh2_make_kit.dcl +index dceca4f..6a14958 100644 +--- a/vms/libssh2_make_kit.dcl ++++ b/vms/libssh2_make_kit.dcl +@@ -194,7 +194,7 @@ $ write pt "=prompt JCB LIBSSH2 for OpenVMS" + $ write pt "" + $ write pt "libssh2 is an open source client side library that aims to implement" + $ write pt "the SSH protocol. This is the OpenVMS port of that library." +-$ write pt "Further information at http://www.libssh2.org." ++$ write pt "Further information at https://www.libssh2.org." + $ write pt "" + $ write pt "1 NEED_VMS83" + $ write pt "=prompt OpenVMS 8.3 or later is not installed on your system." +diff --git a/vms/libssh2_make_lib.dcl b/vms/libssh2_make_lib.dcl +index 6d8b13b..56d168f 100644 +--- a/vms/libssh2_make_lib.dcl ++++ b/vms/libssh2_make_lib.dcl +@@ -46,7 +46,8 @@ $! + $ define objdir 'objdir' + $ define srcdir 'srcdir' + $! +-$ cc_include = "/include=([],[-.include])" ++$ cc_include = "/include=([],[-.include],""/gnv$zlib_include"")" ++$ cc_define = "/DEFINE=(_USE_STD_STAT=1)" + $ link_opts = "objdir:libssh2_''thisid'.opt" + $! + $ pipe search [-.include]libssh2.h libssh2_version_major/nohead | (read sys$input l ; l = f$element(2," ",f$edit(l,"trim,compress")) ; - +@@ -137,7 +138,7 @@ $CaseLoop: + $! + $ if case .eq. 0 + $ then!camel case names +-$ cc_flags = "/names=(shortened,as_is)" ++$ cc_flags = "/names=(shortened,as_is)''cc_define'" + $ objlib = "libssh2_asis.olb" + $ endif + $! +@@ -149,7 +150,7 @@ $ rename [.cxx_repository]cxx$demangler_db.; *.lowercase + $ purge [.cxx_repository]cxx$demangler_db.lowercase + $ endif + $! +-$ cc_flags = "/names=(shortened)" ++$ cc_flags = "/names=(shortened)''cc_define'" + $ objlib = "libssh2_up.olb" + $ endif + $! +diff --git a/win32/libssh2_config.h b/win32/libssh2_config.h +index 3e3caf4..6ac2ef4 100644 +--- a/win32/libssh2_config.h ++++ b/win32/libssh2_config.h +@@ -24,6 +24,7 @@ + #define HAVE_SELECT + + #ifdef _MSC_VER ++#if _MSC_VER < 1900 + #define snprintf _snprintf + #if _MSC_VER < 1500 + #define vsnprintf _vsnprintf +@@ -31,6 +32,7 @@ + #define strdup _strdup + #define strncasecmp _strnicmp + #define strcasecmp _stricmp ++#endif + #else + #ifndef __MINGW32__ + #define strncasecmp strnicmp