# HG changeset patch # User Simon Josefsson # Date 1141825230 0 # Node ID 6a7edbad1cdf80c8de4a675bca627782e84eb333 # Parent 9afb952794eef77a8c1a83c4399a8367a561a23f Fix gc-random module. diff --git a/lib/ChangeLog b/lib/ChangeLog --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2006-03-08 Simon Josefsson + + * gc-gnulib.c (randomize): Don't open files called 'no', they + signal that configure disabled the device. + 2006-03-07 Paul Eggert * c-stack.c: Include unistd.h unconditionally, since we now assume diff --git a/lib/gc-gnulib.c b/lib/gc-gnulib.c --- a/lib/gc-gnulib.c +++ b/lib/gc-gnulib.c @@ -109,6 +109,9 @@ break; } + if (strcmp (device, "no") == 0) + return GC_RANDOM_ERROR; + fd = open (device, O_RDONLY); if (fd < 0) return GC_RANDOM_ERROR; diff --git a/m4/ChangeLog b/m4/ChangeLog --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,8 @@ +2006-03-08 Simon Josefsson + + * gc-random.m4: Permit 'no' as variable values and fix warnings, + suggested by Ralf Wildenhues . + 2006-03-08 Simon Josefsson * gc-random.m4: Call AC_CANONICAL_HOST and use $host_os instead of diff --git a/m4/gc-random.m4 b/m4/gc-random.m4 --- a/m4/gc-random.m4 +++ b/m4/gc-random.m4 @@ -41,30 +41,36 @@ AC_ARG_ENABLE(random-device, AC_HELP_STRING([--enable-random-device], [device with (strong) randomness (for Nettle)]), - test "$enableval" != "no" && NAME_OF_RANDOM_DEVICE=$enableval) + NAME_OF_RANDOM_DEVICE=$enableval) AC_MSG_RESULT($NAME_OF_RANDOM_DEVICE) AC_MSG_CHECKING([device with pseudo random data...]) AC_ARG_ENABLE(pseudo-random-device, AC_HELP_STRING([--enable-pseudo-random-device], [device with pseudo randomness (for Nettle)]), - test "$enableval" != "no" && NAME_OF_PSEUDO_RANDOM_DEVICE=$enableval) + NAME_OF_PSEUDO_RANDOM_DEVICE=$enableval) AC_MSG_RESULT($NAME_OF_PSEUDO_RANDOM_DEVICE) AC_MSG_CHECKING([device with unpredictable data for nonces...]) AC_ARG_ENABLE(nonce-device, AC_HELP_STRING([--enable-nonce-device], [device with unpredictable nonces (for Nettle)]), - test "$enableval" != "no" && NAME_OF_NONCE_DEVICE=$enableval) + NAME_OF_NONCE_DEVICE=$enableval) AC_MSG_RESULT($NAME_OF_NONCE_DEVICE) if test "$cross_compiling" != yes; then - AC_CHECK_FILE($NAME_OF_RANDOM_DEVICE,, - AC_MSG_WARN([[device for (strong) random data `$NAME_OF_RANDOM_DEVICE' does not exist]])) - AC_CHECK_FILE($NAME_OF_PSEUDO_RANDOM_DEVICE,, - AC_MSG_WARN([[device for pseudo-random data `$NAME_OF_PSEUDO_RANDOM_DEVICE' does not exist]])) - AC_CHECK_FILE($NAME_OF_NONCE_DEVICE,, - AC_MSG_WARN([[device for unpredictable nonces `$NAME_OF_NONCE_DEVICE' does not exist]])) + if test "$NAME_OF_RANDOM_DEVICE" != "no"; then + AC_CHECK_FILE($NAME_OF_RANDOM_DEVICE,, + AC_MSG_WARN([[Device `$NAME_OF_RANDOM_DEVICE' does not exist, consider to use --enable-random-device]])) + fi + if test "$NAME_OF_PSEUDO_RANDOM_DEVICE" != "no"; then + AC_CHECK_FILE($NAME_OF_PSEUDO_RANDOM_DEVICE,, + AC_MSG_WARN([[Device `$NAME_OF_PSEUDO_RANDOM_DEVICE' does not exist, consider to use --enable-pseudo-random-device]])) + fi + if test "$NAME_OF_NONCE_RANDOM_DEVICE" != "no"; then + AC_CHECK_FILE($NAME_OF_NONCE_DEVICE,, + AC_MSG_WARN([[Device `$NAME_OF_NONCE_RANDOM_DEVICE' does not exist, consider to use --enable-nonce-device]])) + fi else AC_MSG_NOTICE([[Cross compiling, assuming random devices exists on the target host...]]) fi