diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2021-02-25 18:30:36 -0500 |
---|---|---|
committer | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2021-02-25 23:17:25 -0500 |
commit | 26b4b395e91c76e7168751d8de269f7b9eec3912 (patch) | |
tree | 61001f8a963a0c7c59268128c3b86c498260eb99 /test | |
parent | 0b0cc29d2e6593f73e1d54eb983b57c8109a7288 (diff) | |
download | libfaketime-26b4b395e91c76e7168751d8de269f7b9eec3912.tar.gz |
Include a check for getentropy interception
This snippet applies to both the library constructors and variable
data test frameworks.
Diffstat (limited to 'test')
-rw-r--r-- | test/snippets/getentropy.c | 6 | ||||
-rw-r--r-- | test/snippets/getentropy.variable | 1 | ||||
-rw-r--r-- | test/snippets/include_headers.h | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/test/snippets/getentropy.c b/test/snippets/getentropy.c new file mode 100644 index 0000000..333c826 --- /dev/null +++ b/test/snippets/getentropy.c @@ -0,0 +1,6 @@ +unsigned int targ; +if (getentropy(&targ, sizeof(targ)) == 0) { + printf("[%s] getentropy() yielded 0x%08x\n", where, targ); +} else { + printf("[%s] getentropy() failed with %d (%s)\n", where, errno, strerror(errno)); +} diff --git a/test/snippets/getentropy.variable b/test/snippets/getentropy.variable new file mode 100644 index 0000000..d9d942d --- /dev/null +++ b/test/snippets/getentropy.variable @@ -0,0 +1 @@ +FAKERANDOM_SEED 0x0123456789ABCDEF diff --git a/test/snippets/include_headers.h b/test/snippets/include_headers.h index 4ac8398..0c1bd85 100644 --- a/test/snippets/include_headers.h +++ b/test/snippets/include_headers.h @@ -3,3 +3,5 @@ #include <unistd.h> #include <sys/random.h> #include <sys/syscall.h> +#include <string.h> +#include <errno.h> |