1 # gc_random.m4 serial 1
2 # Copyright (C) 2004 Simon Josefsson
4 # This file is free software, distributed under the terms of the GNU
5 # General Public License. As a special exception to the GNU General
6 # Public License, this file may be distributed as part of a program
7 # that contains a configuration script generated by Autoconf, under
8 # the same distribution terms as the rest of that program.
13 AC_REQUIRE([AC_CANONICAL_TARGET])
15 # Devices with randomness.
16 # FIXME: Are these the best defaults?
19 NAME_OF_RANDOM_DEVICE="/dev/srandom"
20 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/prandom"
21 NAME_OF_NONCE_DEVICE="/dev/urandom"
25 NAME_OF_RANDOM_DEVICE="/dev/srandom"
26 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/urandom"
27 NAME_OF_NONCE_DEVICE="/dev/urandom"
30 *-solaris* | *-irix* | *-dec-osf* )
31 NAME_OF_RANDOM_DEVICE="/dev/random"
32 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/random"
33 NAME_OF_NONCE_DEVICE="/dev/random"
37 NAME_OF_RANDOM_DEVICE="/dev/random"
38 NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/urandom"
39 NAME_OF_NONCE_DEVICE="/dev/urandom"
43 AC_MSG_CHECKING([device with (strong) random data...])
44 AC_ARG_ENABLE(random-device,
45 AC_HELP_STRING([--enable-random-device],
46 [device with (strong) randomness (for Nettle)]),
47 NAME_OF_RANDOM_DEVICE=$enableval)
48 AC_MSG_RESULT($NAME_OF_RANDOM_DEVICE)
50 AC_MSG_CHECKING([device with pseudo random data...])
51 AC_ARG_ENABLE(pseudo-random-device,
52 AC_HELP_STRING([--enable-pseudo-random-device],
53 [device with pseudo randomness (for Nettle)]),
54 NAME_OF_PSEUDO_RANDOM_DEVICE=$enableval)
55 AC_MSG_RESULT($NAME_OF_PSEUDO_RANDOM_DEVICE)
57 AC_MSG_CHECKING([device with unpredictable data for nonces...])
58 AC_ARG_ENABLE(nonce-device,
59 AC_HELP_STRING([--enable-nonce-device],
60 [device with unpredictable nonces (for Nettle)]),
61 NAME_OF_NONCE_DEVICE=$enableval)
62 AC_MSG_RESULT($NAME_OF_NONCE_DEVICE)
64 AC_CHECK_FILE($NAME_OF_RANDOM_DEVICE,, AC_MSG_ERROR([[
65 *** Device for (strong) random data $NAME_OF_RANDOM_DEVICE does not exist
67 AC_CHECK_FILE($NAME_OF_PSEUDO_RANDOM_DEVICE,, AC_MSG_ERROR([[
68 *** Device for pseudo-random data $NAME_OF_PSEUDO_RANDOM_DEVICE does not exist
70 AC_CHECK_FILE($NAME_OF_NONCE_DEVICE,, AC_MSG_ERROR([[
71 *** Device for unpredictable nonces $NAME_OF_NONCE_DEVICE does not exist
74 # FIXME: Open+read 42 bytes+close twice and compare data. Should differ.
76 AC_DEFINE_UNQUOTED(NAME_OF_RANDOM_DEVICE, "$NAME_OF_RANDOM_DEVICE",
77 [defined to the name of the (strong) random device])
78 AC_DEFINE_UNQUOTED(NAME_OF_PSEUDO_RANDOM_DEVICE,
79 "$NAME_OF_PSEUDO_RANDOM_DEVICE",
80 [defined to the name of the pseudo random device])
81 AC_DEFINE_UNQUOTED(NAME_OF_NONCE_DEVICE, "$NAME_OF_NONCE_DEVICE",
82 [defined to the name of the unpredictable nonce device])