summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2018-07-12 12:25:12 -0400
committerZack Weinberg <zackw@panix.com>2018-07-12 12:25:12 -0400
commitb3ee64bf08082367ea2116ea1fb2007e1a2896cd (patch)
treeefc30a65452525c93b2bee7c36343c5bdbc5abb6 /Makefile.am
parent9f728b79718a8e8b371f48b75592beed638f9c2b (diff)
downloadlibxcrypt-b3ee64bf08082367ea2116ea1fb2007e1a2896cd.tar.gz
libxcrypt-b3ee64bf08082367ea2116ea1fb2007e1a2896cd.tar.bz2
libxcrypt-b3ee64bf08082367ea2116ea1fb2007e1a2896cd.zip
Add tests for get_random_bytes.
It turns out not to be *that* hard to exercise the fallback logic in get_random_bytes, thanks to GNU ld's --wrap feature. There is also some basic black-box testing of the get_random_bytes interface. The change to randombytes.c itself ensures 100% predictable behavior if get_random_bytes should ever be called with buflen zero.
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am10
1 files changed, 9 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 51cba76..f99f842 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -127,7 +127,8 @@ check_PROGRAMS = \
test-crypt-pbkdf1-sha1 test-crypt-sha256 test-crypt-sha512 \
test-crypt-sunmd5 \
test-byteorder test-badsalt test-badsetting test-gensalt \
- test-short-outbuf
+ test-short-outbuf \
+ test-getrandom-interface test-getrandom-fallbacks
if ENABLE_OBSOLETE_API
libcrypt_la_SOURCES += crypt-des-obsolete.c
@@ -183,6 +184,13 @@ test_alg_sha1_LDADD = alg-sha1.lo
test_alg_sha256_LDADD = alg-sha256.lo
test_alg_sha512_LDADD = alg-sha512.lo
+test_getrandom_interface_LDADD = randombytes.lo
+test_getrandom_fallbacks_LDADD = randombytes.lo
+if HAVE_LD_WRAP
+test_getrandom_fallbacks_LDFLAGS = \
+ -Wl,--wrap,getentropy -Wl,--wrap,getrandom -Wl,--wrap,syscall \
+ -Wl,--wrap,open -Wl,--wrap,read -Wl,--wrap,close
+endif
# Every object file depends on crypt-symbol-vers.h and crypt-hashes.h,
# which are generated files, so automatic dependency generation is not