mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-30 13:01:23 +03:00
libcrypto: Fix Windows build with ssh_reseed().
gettimeofday() is not available on Windows and we need it only in case of forking. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -53,6 +53,7 @@ check_include_file(termios.h HAVE_TERMIOS_H)
|
|||||||
check_include_file(unistd.h HAVE_UNISTD_H)
|
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||||
check_include_file(util.h HAVE_UTIL_H)
|
check_include_file(util.h HAVE_UTIL_H)
|
||||||
check_include_file(libutil.h HAVE_LIBUTIL_H)
|
check_include_file(libutil.h HAVE_LIBUTIL_H)
|
||||||
|
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
check_include_files("winsock2.h;ws2tcpip.h;wspiapi.h" HAVE_WSPIAPI_H)
|
check_include_files("winsock2.h;ws2tcpip.h;wspiapi.h" HAVE_WSPIAPI_H)
|
||||||
|
|||||||
@@ -29,6 +29,9 @@
|
|||||||
/* Define to 1 if you have the <libutil.h> header file. */
|
/* Define to 1 if you have the <libutil.h> header file. */
|
||||||
#cmakedefine HAVE_LIBUTIL_H 1
|
#cmakedefine HAVE_LIBUTIL_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <termios.h> header file. */
|
/* Define to 1 if you have the <termios.h> header file. */
|
||||||
#cmakedefine HAVE_TERMIOS_H 1
|
#cmakedefine HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,14 @@
|
|||||||
* MA 02111-1307, USA.
|
* MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef HAVE_SYS_TIME_H
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "libssh/priv.h"
|
#include "libssh/priv.h"
|
||||||
#include "libssh/session.h"
|
#include "libssh/session.h"
|
||||||
@@ -80,9 +83,11 @@ static int alloc_key(struct ssh_cipher_struct *cipher) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ssh_reseed(void){
|
void ssh_reseed(void){
|
||||||
|
#ifndef _WIN32
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
RAND_add(&tv, sizeof(tv), 0.0);
|
RAND_add(&tv, sizeof(tv), 0.0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SHACTX sha1_init(void) {
|
SHACTX sha1_init(void) {
|
||||||
|
|||||||
Reference in New Issue
Block a user