~ubuntu-branches/ubuntu/dapper/gnutls12/dapper-updates

« back to all changes in this revision

Viewing changes to m4/gc_random.m4

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Urlichs
  • Date: 2005-11-15 19:26:02 UTC
  • Revision ID: james.westby@ubuntu.com-20051115192602-milf548iripaq3jh
Tags: 1.2.9-2
* Install /usr/lib/pkgconfig/*.pc files.
* Depend on texinfo (>= 4.8, for the @euro{} sign).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# gc_random.m4 serial 1
 
2
# Copyright (C) 2004 Simon Josefsson
 
3
#
 
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.
 
9
 
 
10
# Usage: GC_RANDOM
 
11
AC_DEFUN([GC_RANDOM],
 
12
[
 
13
  AC_REQUIRE([AC_CANONICAL_TARGET])
 
14
 
 
15
  # Devices with randomness.
 
16
  # FIXME: Are these the best defaults?
 
17
  case "${target}" in
 
18
    *-openbsd*)
 
19
        NAME_OF_RANDOM_DEVICE="/dev/srandom"
 
20
        NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/prandom"
 
21
        NAME_OF_NONCE_DEVICE="/dev/urandom"
 
22
        ;;
 
23
 
 
24
    *-netbsd*)
 
25
        NAME_OF_RANDOM_DEVICE="/dev/srandom"
 
26
        NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/urandom"
 
27
        NAME_OF_NONCE_DEVICE="/dev/urandom"
 
28
        ;;
 
29
 
 
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"
 
34
        ;;
 
35
 
 
36
    *)
 
37
        NAME_OF_RANDOM_DEVICE="/dev/random"
 
38
        NAME_OF_PSEUDO_RANDOM_DEVICE="/dev/urandom"
 
39
        NAME_OF_NONCE_DEVICE="/dev/urandom"
 
40
        ;;
 
41
  esac
 
42
 
 
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)
 
49
 
 
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)
 
56
 
 
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)
 
63
 
 
64
  AC_CHECK_FILE($NAME_OF_RANDOM_DEVICE,, AC_MSG_ERROR([[
 
65
*** Device for (strong) random data $NAME_OF_RANDOM_DEVICE does not exist
 
66
]]))
 
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
 
69
]]))
 
70
  AC_CHECK_FILE($NAME_OF_NONCE_DEVICE,, AC_MSG_ERROR([[
 
71
*** Device for unpredictable nonces $NAME_OF_NONCE_DEVICE does not exist
 
72
]]))
 
73
 
 
74
  # FIXME: Open+read 42 bytes+close twice and compare data.  Should differ.
 
75
 
 
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])
 
83
])