Hello everyone, On 13.03.2014 20:39, Peter Stuge wrote: > Yes, we should find a solution for this. Marc, did you notice if > there *is* a reason not to always compile those first functions? > Let's see if we can hammer this one out.
no, I did not find a reason not to always compile those functions. Attached you will find patch 0002 which removes the ifdef-checks before the WinCNG patch. > Yes, I overlooked the define. :( Please have a look at the attached > patch. If you think it's OK I'll push it. It's much better than my initial patch, thanks. Since I had some trouble with your patch using CRLF line endings for all files, even the non-Windows specific ones, I reformatted the patch using msysgit and the latest master branch with core.autocrlf being false. Please see attached patch 0001. I also found a warning while compiling with the win32/GNUmakefile, please see attached patch 0003. It would be great if you could merge these patches, so I can rebase the WinCNG patch onto them. Thanks in advance. Best regards, Marc
From f5b5b7c2492ed415bd10886dbefdbf30129e2448 Mon Sep 17 00:00:00 2001 From: Peter Stuge <pe...@stuge.se> Date: Thu, 13 Mar 2014 20:30:32 +0100 Subject: [PATCH 1/3] Fix non-autotools builds: Always define the LIBSSH2_OPENSSL CPP macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit d512b25f69a1b6778881f6b4b5ff9cfc6023be42 introduced a crypto library abstraction in the autotools build system, to allow us to more easily support new crypto libraries. In that process it was found that all other build system which we support are hard-coded to build with OpenSSL. Commit f5c1a0d98bd51aeb24aca3d49c7c81dcf8bd858d fixes automake introduced into non-autotools build systems but still overlooked the CPP macro saying that we are using OpenSSL. Thanks to Marc Hörsken for identifying this issue and proposing a fix for win32/{GNUmakefile,config.mk}. This commit uses a slightly different approach but the end result is the same. --- nw/GNUmakefile | 1 + win32/GNUmakefile | 1 + win32/Makefile.Watcom | 1 + win32/config.mk | 2 +- win32/msvcproj.head | 17 +++++++++-------- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/nw/GNUmakefile b/nw/GNUmakefile index e666e29..0fde45a 100644 --- a/nw/GNUmakefile +++ b/nw/GNUmakefile @@ -214,6 +214,7 @@ endif vpath %.c . ../src # only OpenSSL is supported with this build system +CFLAGS += -DLIBSSH2_OPENSSL include ../Makefile.OpenSSL.inc # include Makefile.inc to get CSOURCES define diff --git a/win32/GNUmakefile b/win32/GNUmakefile index c0cc20a..90e06d4 100644 --- a/win32/GNUmakefile +++ b/win32/GNUmakefile @@ -180,6 +180,7 @@ CFLAGS += $(INCLUDES) vpath %.c . ../src # only OpenSSL is supported with this build system +CFLAGS += -DLIBSSH2_OPENSSL include ../Makefile.OpenSSL.inc # include Makefile.inc to get CSOURCES define diff --git a/win32/Makefile.Watcom b/win32/Makefile.Watcom index 5847cf7..f0f0408 100644 --- a/win32/Makefile.Watcom +++ b/win32/Makefile.Watcom @@ -94,6 +94,7 @@ LIB_ARG = $(OBJ_BASE)\stat\wlib.arg !error You MUST call wmake with the -u switch! !else # only OpenSSL is supported with this build system +CFLAGS += -dLIBSSH2_OPENSSL !include ..\Makefile.OpenSSL.inc !include ..\Makefile.inc !endif diff --git a/win32/config.mk b/win32/config.mk index 4c8eb2a..f0e514a 100644 --- a/win32/config.mk +++ b/win32/config.mk @@ -29,7 +29,7 @@ CPPFLAGS=/Oi /O2 /Oy /GF /Y- /MD /DNDEBUG DLLFLAGS=/DEBUG /LD !endif -CPPFLAGS=/nologo /GL /Zi /EHsc $(CPPFLAGS) /Iwin32 /Iinclude /I$(OPENSSLINC) $(ZLIBINC) +CPPFLAGS=/nologo /GL /Zi /EHsc $(CPPFLAGS) /Iwin32 /Iinclude /DLIBSSH2_OPENSSL /I$(OPENSSLINC) $(ZLIBINC) CFLAGS=$(CPPFLAGS) RCFLAGS=/Iinclude DLLFLAGS=$(CFLAGS) $(DLLFLAGS) diff --git a/win32/msvcproj.head b/win32/msvcproj.head index ded6343..eda5021 100644 --- a/win32/msvcproj.head +++ b/win32/msvcproj.head @@ -1,6 +1,7 @@ # Microsoft Developer Studio Project File - Name="libssh2" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** +# only OpenSSL is supported with this build system # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 # TARGTYPE "Win32 (x86) Static Library" 0x0104 @@ -45,8 +46,8 @@ RSC=rc.exe # PROP Intermediate_Dir "Release_dll" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\win32" /I "..\include" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "LIBSSH2_OPENSSL" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\win32" /I "..\include" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "LIBSSH2_OPENSSL" /D "_MBCS" /D "_LIB" /YX /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -72,8 +73,8 @@ LINK32=link.exe # PROP Intermediate_Dir "Debug_dll" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "..\win32" /I "..\include" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /D "LIBSSH2DEBUG" /YX /FD /GZ /c +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "LIBSSH2_OPENSSL" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "..\win32" /I "..\include" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "LIBSSH2_OPENSSL" /D "_MBCS" /D "_LIB" /D "LIBSSH2DEBUG" /YX /FD /GZ /c # SUBTRACT CPP /WX /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 @@ -99,8 +100,8 @@ LINK32=link.exe # PROP Output_Dir "Release_lib" # PROP Intermediate_Dir "Release_lib" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\win32" /I "..\include" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "LIBSSH2_OPENSSL" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\win32" /I "..\include" /D "WIN32" /D "NDEBUG" /D "LIBSSH2_WIN32" /D "LIBSSH2_OPENSSL" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -123,8 +124,8 @@ LIB32=link.exe -lib # PROP Output_Dir "Debug_lib" # PROP Intermediate_Dir "Debug_lib" # PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "..\win32" /I "..\include" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "_MBCS" /D "_LIB" /D "LIBSSH2DEBUG" /YX /FD /GZ /c +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "LIBSSH2_OPENSSL" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /MD /W3 /Gm /GX /ZI /Od /I "..\win32" /I "..\include" /D "WIN32" /D "_DEBUG" /D "LIBSSH2_WIN32" /D "LIBSSH2_OPENSSL" /D "_MBCS" /D "_LIB" /D "LIBSSH2DEBUG" /YX /FD /GZ /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe -- 1.8.1.msysgit.1
>From 085f86203f0c4b1f067b2d1b8718dffadb0a4fcf Mon Sep 17 00:00:00 2001 From: Marc Hoersken <i...@marc-hoersken.de> Date: Sun, 16 Mar 2014 00:25:09 +0100 Subject: [PATCH 2/3] pem.c: always compile pem.c independently of crypto backend --- src/pem.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/pem.c b/src/pem.c index 5749bc8..9059477 100644 --- a/src/pem.c +++ b/src/pem.c @@ -38,8 +38,6 @@ #include "libssh2_priv.h" -#ifdef LIBSSH2_LIBGCRYPT /* compile only if we build with libgcrypt */ - static int readline(char *line, int line_size, FILE * fp) { @@ -209,5 +207,3 @@ _libssh2_pem_decode_integer(unsigned char **data, unsigned int *datalen, return 0; } - -#endif /* LIBSSH2_LIBGCRYPT */ -- 1.8.1.msysgit.1
>From 40e528316aac8208d5e860581f773c588112cbdd Mon Sep 17 00:00:00 2001 From: Marc Hoersken <i...@marc-hoersken.de> Date: Sun, 16 Mar 2014 00:26:28 +0100 Subject: [PATCH 3/3] knownhost.c: fixed that 'key_type_len' may be used uninitialized ../src/knownhost.c: In function 'libssh2_knownhost_readline': ../src/knownhost.c:651:16: warning: 'key_type_len' may be used uninitialized in this function [-Wmaybe-uninitialized] rc = knownhost_add(hosts, hostbuf, NULL, ^ ../src/knownhost.c:745:12: note: 'key_type_len' was declared here size_t key_type_len; ^ --- src/knownhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/knownhost.c b/src/knownhost.c index 9537d9e..9b3b79a 100644 --- a/src/knownhost.c +++ b/src/knownhost.c @@ -742,7 +742,7 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts, const char *comment = NULL; const char *key_type_name = NULL; size_t commentlen = 0; - size_t key_type_len; + size_t key_type_len = 0; int key_type; /* make some checks that the lengths seem sensible */ -- 1.8.1.msysgit.1
_______________________________________________ libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel