From f207a12b78b3647621c2b25d153fd4e8e5dce114 Mon Sep 17 00:00:00 2001 From: Manoj Ampalam Date: Tue, 27 Dec 2016 13:47:09 -0800 Subject: [PATCH] Fixed openssl=no build issues (#38) --- contrib/win32/openssh/config.h.vs | 2 +- contrib/win32/openssh/libssh.vcxproj | 6 ++++-- contrib/win32/win32compat/misc.c | 9 --------- openbsd-compat/arc4random.c | 13 +++++++++++++ 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/contrib/win32/openssh/config.h.vs b/contrib/win32/openssh/config.h.vs index e798289b2..f7a8f00cb 100644 --- a/contrib/win32/openssh/config.h.vs +++ b/contrib/win32/openssh/config.h.vs @@ -876,7 +876,7 @@ /* #undef HAVE_SET_ID */ /* Define to 1 if you have the `SHA256_Update' function. */ -#define HAVE_SHA256_UPDATE 1 +/* #undef HAVE_SHA256_UPDATE */ /* Define to 1 if you have the header file. */ /* #undef HAVE_SHA2_H */ diff --git a/contrib/win32/openssh/libssh.vcxproj b/contrib/win32/openssh/libssh.vcxproj index deffb3d68..1205b58dc 100644 --- a/contrib/win32/openssh/libssh.vcxproj +++ b/contrib/win32/openssh/libssh.vcxproj @@ -194,7 +194,7 @@ true - true + true @@ -285,7 +285,9 @@ - + + true + diff --git a/contrib/win32/win32compat/misc.c b/contrib/win32/win32compat/misc.c index bedda09fb..32b2ddc82 100644 --- a/contrib/win32/win32compat/misc.c +++ b/contrib/win32/win32compat/misc.c @@ -614,15 +614,6 @@ w32_mkdir(const char *path_utf8, unsigned short mode) { return returnStatus; } -void -getrnd(u_char *s, size_t len) { - HCRYPTPROV hProvider; - if (CryptAcquireContextW(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT) == FALSE || - CryptGenRandom(hProvider, len, s) == FALSE || - CryptReleaseContext(hProvider, 0) == FALSE) - DebugBreak(); -} - int w32_stat(const char *path, struct w32_stat *buf) { return fileio_stat(sanitized_path(path), (struct _stat64*)buf); diff --git a/openbsd-compat/arc4random.c b/openbsd-compat/arc4random.c index b6256b4f8..128f9b6e7 100644 --- a/openbsd-compat/arc4random.c +++ b/openbsd-compat/arc4random.c @@ -78,6 +78,18 @@ _rs_init(u_char *buf, size_t n) } #ifndef WITH_OPENSSL +#ifdef WINDOWS +#include +static void +getrnd(u_char *s, size_t len) { + HCRYPTPROV hProvider; + if (CryptAcquireContextW(&hProvider, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT) == FALSE || + CryptGenRandom(hProvider, len, s) == FALSE || + CryptReleaseContext(hProvider, 0) == FALSE) + DebugBreak(); +} + +#else /* !WINDOWS */ #define SSH_RANDOM_DEV "/dev/urandom" /* XXX use getrandom() if supported on Linux */ static void @@ -101,6 +113,7 @@ getrnd(u_char *s, size_t len) } close(fd); } +#endif /* !WINDOWS */ #endif static void