From 3481d16b0f3df5ad1dfb8d96ee2d87736bfa7755 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 10 Apr 2021 14:45:24 +0100 Subject: [PATCH] Remove #ifdef COVERITY. Turns out that the precautions against winelib builds failing, which I put in years ago because I was using winelib as a build setup for Coverity testing, are all obsolete. My Coverity build scripts runs fine now without any of them. --- Buildscr.cv | 2 +- windows/wincapi.c | 25 +------------------------ windows/winhsock.c | 2 +- windows/winmisc.c | 8 +++----- windows/winnet.c | 10 ---------- 5 files changed, 6 insertions(+), 41 deletions(-) diff --git a/Buildscr.cv b/Buildscr.cv index deaf8beb..fab61dc0 100644 --- a/Buildscr.cv +++ b/Buildscr.cv @@ -25,7 +25,7 @@ enddelegate # Windows scanner for download). delegate covscan32wine in putty do tar xzvf cov-int.tar.gz - in putty/windows do cov-build --dir ../cov-int make -f Makefile.mgw CC=winegcc RC=wrc XFLAGS="-DCOVERITY -DNO_SECUREZEROMEMORY -D_FORCE_SOFTWARE_AES" + in putty/windows do cov-build --dir ../cov-int make -f Makefile.mgw CC=winegcc RC=wrc in putty do tar czvf cov-int.tar.gz cov-int return putty/cov-int.tar.gz enddelegate diff --git a/windows/wincapi.c b/windows/wincapi.c index b1852922..8059f753 100644 --- a/windows/wincapi.c +++ b/windows/wincapi.c @@ -23,34 +23,11 @@ bool got_crypt(void) attempted = true; crypt = load_system32_dll("crypt32.dll"); successful = crypt && -#ifdef COVERITY - /* The build toolchain I use with Coverity doesn't know - * about this function, so can't type-check it */ - GET_WINDOWS_FUNCTION_NO_TYPECHECK(crypt, CryptProtectMemory) -#else - GET_WINDOWS_FUNCTION(crypt, CryptProtectMemory) -#endif - ; + GET_WINDOWS_FUNCTION(crypt, CryptProtectMemory); } return successful; } -#ifdef COVERITY -/* - * The hack I use to build for Coverity scanning, using winegcc and - * Makefile.mgw, didn't provide some defines in wincrypt.h last time I - * looked. Therefore, define them myself here, but enclosed in #ifdef - * COVERITY to ensure I don't make up random nonsense values for any - * real build. - */ -#ifndef CRYPTPROTECTMEMORY_BLOCK_SIZE -#define CRYPTPROTECTMEMORY_BLOCK_SIZE 16 -#endif -#ifndef CRYPTPROTECTMEMORY_CROSS_PROCESS -#define CRYPTPROTECTMEMORY_CROSS_PROCESS 1 -#endif -#endif - char *capi_obfuscate_string(const char *realname) { char *cryptdata; diff --git a/windows/winhsock.c b/windows/winhsock.c index 6fdf2ba2..543b77b6 100644 --- a/windows/winhsock.c +++ b/windows/winhsock.c @@ -272,7 +272,7 @@ static SocketPeerInfo *sk_handle_peer_info(Socket *s) if (!kernel32_module) { kernel32_module = load_system32_dll("kernel32.dll"); -#if (defined _MSC_VER && _MSC_VER < 1900) || defined __MINGW32__ || defined COVERITY +#if (defined _MSC_VER && _MSC_VER < 1900) || defined __MINGW32__ /* For older Visual Studio, and MinGW too (at least as of * Ubuntu 16.04), this function isn't available in the header * files to type-check. Ditto the toolchain I use for diff --git a/windows/winmisc.c b/windows/winmisc.c index 8cbdda08..759df011 100644 --- a/windows/winmisc.c +++ b/windows/winmisc.c @@ -157,11 +157,9 @@ void dll_hijacking_protection(void) if (!kernel32_module) { kernel32_module = load_system32_dll("kernel32.dll"); -#if (defined _MSC_VER && _MSC_VER < 1900) || defined COVERITY - /* For older Visual Studio, and also for the system I - * currently use for Coveritying the Windows code, this - * function isn't available in the header files to - * type-check */ +#if (defined _MSC_VER && _MSC_VER < 1900) + /* For older Visual Studio, this function isn't available in + * the header files to type-check */ GET_WINDOWS_FUNCTION_NO_TYPECHECK( kernel32_module, SetDefaultDllDirectories); #else diff --git a/windows/winnet.c b/windows/winnet.c index f607560e..3b4da3cc 100644 --- a/windows/winnet.c +++ b/windows/winnet.c @@ -279,21 +279,11 @@ void sk_init(void) GET_WINDOWS_FUNCTION(winsock_module, WSAStartup); GET_WINDOWS_FUNCTION(winsock_module, WSACleanup); GET_WINDOWS_FUNCTION(winsock_module, closesocket); -#ifndef COVERITY GET_WINDOWS_FUNCTION(winsock_module, ntohl); GET_WINDOWS_FUNCTION(winsock_module, htonl); GET_WINDOWS_FUNCTION(winsock_module, htons); GET_WINDOWS_FUNCTION(winsock_module, ntohs); GET_WINDOWS_FUNCTION_NO_TYPECHECK(winsock_module, gethostname); -#else - /* The toolchain I use for Windows Coverity builds doesn't know - * the type signatures of these */ - GET_WINDOWS_FUNCTION_NO_TYPECHECK(winsock_module, ntohl); - GET_WINDOWS_FUNCTION_NO_TYPECHECK(winsock_module, htonl); - GET_WINDOWS_FUNCTION_NO_TYPECHECK(winsock_module, htons); - GET_WINDOWS_FUNCTION_NO_TYPECHECK(winsock_module, ntohs); - GET_WINDOWS_FUNCTION_NO_TYPECHECK(winsock_module, gethostname); -#endif GET_WINDOWS_FUNCTION(winsock_module, gethostbyname); GET_WINDOWS_FUNCTION(winsock_module, getservbyname); GET_WINDOWS_FUNCTION(winsock_module, inet_addr);