Fixed openssl=no build issues (#38)

This commit is contained in:
Manoj Ampalam 2016-12-27 13:47:09 -08:00 committed by GitHub
parent 15a99f6142
commit f207a12b78
4 changed files with 18 additions and 12 deletions

View File

@ -876,7 +876,7 @@
/* #undef HAVE_SET_ID */ /* #undef HAVE_SET_ID */
/* Define to 1 if you have the `SHA256_Update' function. */ /* 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 <sha2.h> header file. */ /* Define to 1 if you have the <sha2.h> header file. */
/* #undef HAVE_SHA2_H */ /* #undef HAVE_SHA2_H */

View File

@ -194,7 +194,7 @@
<ExcludedFromBuild Condition="$(UseOpenSSL)==false">true</ExcludedFromBuild> <ExcludedFromBuild Condition="$(UseOpenSSL)==false">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="$(OpenSSH-Src-Path)digest-libc.c"> <ClCompile Include="$(OpenSSH-Src-Path)digest-libc.c">
<ExcludedFromBuild Condition="$(UseOpenSSL)==false">true</ExcludedFromBuild> <ExcludedFromBuild Condition="$(UseOpenSSL)==true">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="$(OpenSSH-Src-Path)dispatch.c" /> <ClCompile Include="$(OpenSSH-Src-Path)dispatch.c" />
<ClCompile Include="$(OpenSSH-Src-Path)dns.c" /> <ClCompile Include="$(OpenSSH-Src-Path)dns.c" />
@ -285,7 +285,9 @@
<ClCompile Include="$(OpenSSH-Src-Path)sandbox-pledge.c" /> <ClCompile Include="$(OpenSSH-Src-Path)sandbox-pledge.c" />
<ClCompile Include="$(OpenSSH-Src-Path)utf8.c" /> <ClCompile Include="$(OpenSSH-Src-Path)utf8.c" />
<ClCompile Include="$(OpenSSH-Src-Path)contrib\win32\win32compat\ttymodes_windows.c" /> <ClCompile Include="$(OpenSSH-Src-Path)contrib\win32\win32compat\ttymodes_windows.c" />
<ClCompile Include="..\..\..\digest-openssl.c" /> <ClCompile Include="$(OpenSSH-Src-Path)digest-openssl.c">
<ExcludedFromBuild Condition="$(UseOpenSSL)==false">true</ExcludedFromBuild>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="$(OpenSSH-Src-Path)crypto-wrap.h" /> <ClInclude Include="$(OpenSSH-Src-Path)crypto-wrap.h" />

View File

@ -614,15 +614,6 @@ w32_mkdir(const char *path_utf8, unsigned short mode) {
return returnStatus; 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 int
w32_stat(const char *path, struct w32_stat *buf) { w32_stat(const char *path, struct w32_stat *buf) {
return fileio_stat(sanitized_path(path), (struct _stat64*)buf); return fileio_stat(sanitized_path(path), (struct _stat64*)buf);

View File

@ -78,6 +78,18 @@ _rs_init(u_char *buf, size_t n)
} }
#ifndef WITH_OPENSSL #ifndef WITH_OPENSSL
#ifdef WINDOWS
#include <Wincrypt.h>
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" #define SSH_RANDOM_DEV "/dev/urandom"
/* XXX use getrandom() if supported on Linux */ /* XXX use getrandom() if supported on Linux */
static void static void
@ -101,6 +113,7 @@ getrnd(u_char *s, size_t len)
} }
close(fd); close(fd);
} }
#endif /* !WINDOWS */
#endif #endif
static void static void