summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-10-14 17:07:56 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-10-14 17:07:56 +0000
commita1933bd1847951b959016f59ee744d1b18a00142 (patch)
tree42392f2df048defd712fa12d290bf84a7a77df6d /configure
parenteaf9404b22bba7be5092672144b867380c602beb (diff)
downloadskalibs-a1933bd1847951b959016f59ee744d1b18a00142.tar.xz
Clean up and modernize librandom.
Correct random number generation has historically been suprisingly painful to achieve. There was no standard, every system behaved in a subtly different way, and there were a few userland initiatives to get decent randomness, all incompatible of course. The situation is a bit better now, we're heading towards some standardization. The arc4random() series of functions is a good API, and available on a lot of systems - unfortunately not Linux, but on Linux the new getrandom() makes using /dev/random obsolete. So I removed the old crap in librandom, dropped EGD support, dropped dynamic backend selection, made a single API series (random_* instead of goodrandom_* and badrandom_*), added an arc4random backend and a getrandom backend, and defaulted to /dev/urandom backed up by SURF in the worst case. This should be much smaller and logical. However, it's a major API break, so the skarnet.org stack will be changed to adapt.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure33
1 files changed, 2 insertions, 31 deletions
diff --git a/configure b/configure
index 55136cc..122eb42 100755
--- a/configure
+++ b/configure
@@ -38,13 +38,11 @@ Optional features:
$package options:
--enable-libc-replacements use independent low-level primitives [disabled]
- --enable-egd=PATH support an EGD daemon listening on PATH as RNG [disabled]
--disable-ipv6 do not build IPv6 support [enabled]
--enable-iopause-select prefer select() over poll() for iopause implementation [disabled]
--enable-tai-clock assume the system clock is TAI-10 instead of UTC [disabled]
--enable-clock use clock_gettime() instead of gettimeofday() [disabled]
--enable-monotonic count time with CLOCK_MONOTONIC instead of CLOCK_REALTIME
- --enable-force-devr assume /dev/random exists and is valid [autodetection takes time]
--with-default-path=PATH default executable search path [/usr/bin:/usr/sbin:/bin:/sbin]
EOF
@@ -214,13 +212,11 @@ shared=true
static=true
slashpackage=false
replacements=false
-egd=
ipv6=true
select=false
taiclock=false
clockrt=false
clockmon=false
-forcedevr=false
ddefaultpath=/usr/bin:/usr/sbin:/bin:/sbin
defaultpath=$ddefaultpath
dpathorig=true
@@ -257,8 +253,6 @@ for arg ; do
--disable-slashpackage) sproot= ; slashpackage=false ;;
--enable-libc-replacements|--enable-libc-replacements=yes) replacements=true ;;
--disable-libc-replacements|--enable-libc-replacements=no) replacements=false ;;
- --enable-egd=*) egd=${arg#*=} ;;
- --disable-egd) egd= ;;
--enable-ipv6|--enable-ipv6=yes) ipv6=true ;;
--disable-ipv6|--enable-ipv6=no) ipv6=false ;;
--enable-iopause-select|--enable-iopause-select=yes) select=true ;;
@@ -269,8 +263,6 @@ for arg ; do
--disable-clock|--enable-clock=no) clockrt=false ;;
--enable-monotonic|--enable-monotonic=yes) clockmon=true ;;
--disable-monotonic|--enable-monotonic=no) clockmon=false ;;
- --enable-force-devr|--enable-force-devr=yes) forcedevr=true ;;
- --disable-force-devr|--enable-force-devr=no) forcedevr=false ;;
--with-default-path=*) defaultpath=${arg#*=} ; dpathorig=false ;;
--without-default-path) defaultpath=$ddefaultpath ; dpathorig=true ;;
--enable-*|--disable-*|--with-*|--without-*|--*dir=*) ;;
@@ -403,10 +395,6 @@ if test -n "$sysdeps" ; then
sysclock_lib=$(cat $sysdeps/sysclock.lib)
tainnow_lib=$(cat $sysdeps/tainnow.lib)
util_lib=$(cat $sysdeps/util.lib)
- if test -n "$egd" ; then
- egd=$(grep -F egd: $sysdeps/sysdeps | cut -d' ' -f2-)
- echo "warning: --enable-egd option ignored, using sysdeps-provided value instead: $egd"
- fi
else
sysdeps=sysdeps.cfg
mkdir -p $sysdeps
@@ -500,21 +488,9 @@ EOF
choose c uint64t UINT64T 'uint64_t'
choose cl futimens FUTIMENS 'futimens()'
choose cl futimes FUTIMES 'futimes()'
+ choose cl arc4random ARC4RANDOM 'arc4random()'
+ choose cl getrandom GETRANDOM 'getrandom()'
- if $forcedevr ; then
- echo "/dev/random detection override required, assuming it exists and is working."
- echo "devrandom: yes" >> $sysdeps/sysdeps
- echo "#define ${package_macro_name}_HASDEVRANDOM" >> $sysdeps/sysdeps.h
- else
- choose clr devrandom DEVRANDOM /dev/random
- fi
- if test -n "$egd" ; then
- if echo "$egd" | grep -q '[^[:alnum:]/_-]' ; then
- fail "$0: invalid EGD path: $egd"
- fi
- echo "egd: $egd" >> $sysdeps/sysdeps
- echo "#define ${package_macro_name}_HASEGD \"$egd\"" >> $sysdeps/sysdeps.h
- fi
echo '#endif' >> $sysdeps/sysdeps.h
fi
@@ -626,11 +602,6 @@ if $select ; then
else
echo "#undef ${package_macro_name}_FLAG_PREFERSELECT"
fi
-if test -n "$egd" ; then
- echo "#define ${package_macro_name}_EGD $egd"
-else
- echo "#undef ${package_macro_name}_EGD"
-fi
echo
echo "#endif"