set(HAVE_SUSECONDS_T 1)
endif()
-if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING AND
- (NOT DEFINED RANDOM_FILE OR RANDOM_FILE))
- find_file(RANDOM_FILE "urandom" "/dev")
- mark_as_advanced(RANDOM_FILE)
-endif()
-
# Check for some functions that are used
if(WIN32)
set(CMAKE_REQUIRED_LIBRARIES "ws2_32")
/* Define this to 'int' if ssize_t is not an available typedefed type */
#undef ssize_t
-/* Define this as a suitable file to read random data from */
-#undef RANDOM_FILE
-
/* Define to 1 if you have the alarm function. */
#define HAVE_ALARM 1
#define PACKAGE_STRING "curl -"
#define PACKAGE_TARNAME "curl"
#define PACKAGE_VERSION "-"
-#define RANDOM_FILE "/dev/random"
#define VERSION "0.0.0" /* TODO */
#define STDC_HEADERS 1
/* Define this to 'int' if ssize_t is not an available typedefed type */
#undef ssize_t
-/* Define this as a suitable file to read random data from */
-#undef RANDOM_FILE
-
/* Define if you have the alarm function. */
#define HAVE_ALARM
/* Define to the version of this package. */
#cmakedefine PACKAGE_VERSION ${PACKAGE_VERSION}
-/* a suitable file to read random data from */
-#cmakedefine RANDOM_FILE "${RANDOM_FILE}"
-
/*
Note: SIZEOF_* variables are fetched with CMake through check_type_size().
As per CMake documentation on CheckTypeSize, C preprocessor code is
}
#endif
-#if defined(RANDOM_FILE) && !defined(_WIN32)
- if(!seeded) {
- /* if there is a random file to read a seed from, use it */
- int fd = open(RANDOM_FILE, O_RDONLY);
- if(fd > -1) {
- /* read random data into the randseed variable */
- ssize_t nread = read(fd, &randseed, sizeof(randseed));
- if(nread == sizeof(randseed))
- seeded = TRUE;
- close(fd);
- }
- }
-#endif
-
if(!seeded) {
struct curltime now = Curl_now();
infof(data, "WARNING: using weak random seed");
return CURLE_SSL_CONNECT_ERROR;
#else
-#ifdef RANDOM_FILE
- RAND_load_file(RANDOM_FILE, RAND_LOAD_LENGTH);
- if(rand_enough())
- return CURLE_OK;
-#endif
-
/* fallback to a custom seeding of the PRNG using a hash based on a current
time */
do {
AC_MSG_ERROR([--with-openssl was given but OpenSSL could not be detected])
fi
-dnl **********************************************************************
-dnl Check for the random seed preferences
-dnl **********************************************************************
-
-if test X"$OPENSSL_ENABLED" = X"1"; then
- dnl Check for user-specified random device
- AC_ARG_WITH(random,
- AS_HELP_STRING([--with-random=FILE],
- [read randomness from FILE (default=/dev/urandom)]),
- [ RANDOM_FILE="$withval" ],
- [
- if test x$cross_compiling != xyes; then
- dnl Check for random device
- AC_CHECK_FILE("/dev/urandom", [ RANDOM_FILE="/dev/urandom"] )
- else
- AC_MSG_WARN([skipped the /dev/urandom detection when cross-compiling])
- fi
- ]
- )
- if test -n "$RANDOM_FILE" && test X"$RANDOM_FILE" != Xno; then
- AC_SUBST(RANDOM_FILE)
- AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE",
- [a suitable file to read random data from])
- fi
-fi
-
dnl ---
dnl We require OpenSSL with SRP support.
dnl ---