random: Add a feature to close device file descriptors.
authorWerner Koch <wk@gnupg.org>
Wed, 11 Dec 2013 15:59:41 +0000 (16:59 +0100)
committerWerner Koch <wk@gnupg.org>
Wed, 11 Dec 2013 16:01:15 +0000 (17:01 +0100)
commitcd548ba2dc777b8b27d8d33182ba733c20222120
tree58b2151b8e12bf23958e946554de4fd0ee86ee97
parenteae1e7712e1b687bd77eb37d0eb505fc9d46d93c
random: Add a feature to close device file descriptors.

* src/gcrypt.h.in (GCRYCTL_CLOSE_RANDOM_DEVICE): New.
* src/global.c (_gcry_vcontrol): Call _gcry_random_close_fds.
* random/random.c (_gcry_random_close_fds): New.
* random/random-csprng.c (_gcry_rngcsprng_close_fds): New.
* random/random-fips.c (_gcry_rngfips_close_fds): New.
* random/random-system.c (_gcry_rngsystem_close_fds): New.
* random/rndlinux.c (open_device): Add arg retry.
(_gcry_rndlinux_gather_random): Add mode to close open fds.

* tests/random.c (check_close_random_device): New.
(main): Call new test.

Signed-off-by: Werner Koch <wk@gnupg.org>
12 files changed:
NEWS
doc/gcrypt.texi
random/rand-internal.h
random/random-csprng.c
random/random-fips.c
random/random-system.c
random/random.c
random/random.h
random/rndlinux.c
src/gcrypt.h.in
src/global.c
tests/random.c