Commit a14613fc authored by Brian Wellington's avatar Brian Wellington

--with-randomdev sets HAVE_RANDOMDEV, use that instead of /dev/random.

parent 708c4ac0
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: acconfig.h,v 1.25 2000/08/01 01:10:56 tale Exp $ */
/* $Id: acconfig.h,v 1.26 2000/08/17 18:56:38 bwelling Exp $ */
/***
*** This file is not to be included by any public header files, because
......@@ -102,3 +102,6 @@ int sigwait(const unsigned int *set, int *sig);
ap = (va_list)(_u.var + __va_words(__typeof(last))); \
} while (0)
#endif /* SHUTUP_STDARG_CAST && __GNUC__ */
/* define if the system has a random number generating device */
#undef HAVE_RANDOMDEV
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssectool.c,v 1.18 2000/08/17 01:22:10 gson Exp $ */
/* $Id: dnssectool.c,v 1.19 2000/08/17 18:56:44 bwelling Exp $ */
#include <config.h>
......@@ -190,7 +190,7 @@ kbdstart(isc_entropysource_t *source, void *arg, isc_boolean_t blocking) {
if (!wantkeyboard) {
fprintf(stderr, "You must use the keyboard to create "
"entropy, since your system is lacking\n");
fprintf(stderr, "/dev/random\n\n");
fprintf(stderr, "/dev/random (or equivalent)\n\n");
}
first = ISC_FALSE;
}
......@@ -258,13 +258,15 @@ setup_entropy(isc_mem_t *mctx, const char *randomfile, isc_entropy_t **ectx) {
isc_result_totext(result));
}
else {
#ifdef HAVE_RANDOMDEV
if (randomfile == NULL) {
result = isc_entropy_createfilesource(*ectx,
"/dev/random");
HAVE_RANDOMDEV);
if (result == ISC_R_SUCCESS)
return;
}
else
#endif
wantkeyboard = ISC_TRUE;
result = isc_entropy_createcallbacksource(*ectx, kbdstart,
kbdget, kbdstop,
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: main.c,v 1.79 2000/08/17 01:30:31 gson Exp $ */
/* $Id: main.c,v 1.80 2000/08/17 18:56:45 bwelling Exp $ */
#include <config.h>
......@@ -425,7 +425,9 @@ create_managers(void) {
return (ISC_R_UNEXPECTED);
}
(void)isc_entropy_createfilesource(ns_g_entropy, "/dev/random");
#ifdef HAVE_RANDOMDEV
(void)isc_entropy_createfilesource(ns_g_entropy, HAVE_RANDOMDEV);
#endif
return (ISC_R_SUCCESS);
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dst_test.c,v 1.30 2000/08/01 01:13:40 tale Exp $ */
/* $Id: dst_test.c,v 1.31 2000/08/17 18:56:48 bwelling Exp $ */
#include <config.h>
......@@ -243,7 +243,9 @@ main(void) {
dns_result_register();
isc_entropy_create(mctx, &ectx);
isc_entropy_createfilesource(ectx, "/dev/random");
#ifdef HAVE_RANDOMDEV
isc_entropy_createfilesource(ectx, HAVE_RANDOMDEV);
#endif
isc_entropy_createfilesource(ectx, "randomfile");
dst_lib_init(mctx, ectx, ISC_ENTROPY_BLOCKING|ISC_ENTROPY_GOODONLY);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_dst.c,v 1.36 2000/08/01 01:13:41 tale Exp $ */
/* $Id: t_dst.c,v 1.37 2000/08/17 18:56:49 bwelling Exp $ */
#include <config.h>
......@@ -370,7 +370,9 @@ t1(void) {
t_result(T_UNRESOLVED);
return;
}
isc_entropy_createfilesource(ectx, "/dev/random");
#ifdef HAVE_RANDOMDEV
isc_entropy_createfilesource(ectx, HAVE_RANDOMDEV);
#endif
result = isc_entropy_createfilesource(ectx, "randomfile");
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %d\n",
......@@ -844,7 +846,9 @@ t2_vfy(char **av) {
isc_result_totext(isc_result));
return(T_UNRESOLVED);
}
isc_entropy_createfilesource(ectx, "/dev/random");
#ifdef HAVE_RANDOMDEV
isc_entropy_createfilesource(ectx, HAVE_RANDOMDEV);
#endif
result = isc_entropy_createfilesource(ectx, "randomfile");
if (isc_result != ISC_R_SUCCESS) {
t_info("isc_entropy_create failed %d\n",
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: tkey_test.c,v 1.29 2000/08/01 01:13:27 tale Exp $ */
/* $Id: tkey_test.c,v 1.30 2000/08/17 18:56:46 bwelling Exp $ */
/*
* Principal Author: Brian Wellington (core copied from res_test.c)
......@@ -375,10 +375,14 @@ main(int argc, char *argv[]) {
ectx = NULL;
RUNTIME_CHECK(isc_entropy_create(mctx, &ectx) == ISC_R_SUCCESS);
result = isc_entropy_createfilesource(ectx, "/dev/random");
#ifdef HAVE_RANDOMDEV
result = isc_entropy_createfilesource(ectx, HAVE_RANDOMDEV);
#else
result = ISC_R_NOTFOUND;
#endif
if (result != ISC_R_SUCCESS) {
fprintf(stderr,
"%s only runs when /dev/random is available.\n",
"%s only runs when a random device is available.\n",
argv[0]);
exit(-1);
}
......
......@@ -6,16 +6,18 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.h.in,v 1.35 2000/08/17 18:56:39 bwelling Exp $ */
/***
*** This file is not to be included by any public header files, because
*** it does not get installed.
......@@ -112,6 +114,9 @@ int sigwait(const unsigned int *set, int *sig);
} while (0)
#endif /* SHUTUP_STDARG_CAST && __GNUC__ */
/* define if the system has a random number generating device */
#undef HAVE_RANDOMDEV
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
......
This diff is collapsed.
......@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.176 $)
AC_REVISION($Revision: 1.177 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.13)
......@@ -242,7 +242,7 @@ case "$use_gssapi" in
USE_GSSAPI=''
DST_GSSAPI_INC=''
DNS_GSSAPI_LIBS=''
AC_MSG_RESULT(none found)
AC_MSG_RESULT(not specified)
;;
yes)
AC_MSG_ERROR([--with-gssapi must specify a path])
......@@ -259,6 +259,39 @@ AC_SUBST(USE_GSSAPI)
AC_SUBST(DST_GSSAPI_INC)
AC_SUBST(DNS_GSSAPI_LIBS)
#
# was --with-randomdev specified?
#
AC_MSG_CHECKING(for random device)
AC_ARG_WITH(randomdev,
[ --with-randomdev=PATH Specify path for random device],
use_randomdev="$withval", use_randomdev="unspec")
case "$use_randomdev" in
unspec)
case "$host" in
*-openbsd*)
AC_DEFINE(HAVE_RANDOMDEV, "/dev/srandom")
AC_MSG_RESULT(using /dev/srandom)
;;
*-linux*|*-freebsd*|*-netbsd*)
AC_DEFINE(HAVE_RANDOMDEV, "/dev/random")
AC_MSG_RESULT(using /dev/random)
;;
*)
AC_MSG_RESULT(not found)
;;
esac
;;
yes)
AC_MSG_ERROR([--with-randomdev must specify a path])
;;
*)
AC_DEFINE_UNQUOTED(HAVE_RANDOMDEV, "$use_randomdev")
AC_MSG_RESULT(using "$use_randomdev")
;;
esac
#
# NetBSD has multiple pthreads implementations. The recommended
# one to use is "unproven-pthreads". The older "mit-pthreads"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment