summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-random-util.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/test/test-random-util.c b/src/test/test-random-util.c
index 9652a0af05..a59c6374b2 100644
--- a/src/test/test-random-util.c
+++ b/src/test/test-random-util.c
@@ -5,14 +5,14 @@
#include "log.h"
#include "tests.h"
-static void test_acquire_random_bytes(bool high_quality_required) {
+static void test_genuine_random_bytes(RandomFlags flags) {
uint8_t buf[16] = {};
unsigned i;
log_info("/* %s */", __func__);
for (i = 1; i < sizeof buf; i++) {
- assert_se(acquire_random_bytes(buf, i, high_quality_required) == 0);
+ assert_se(genuine_random_bytes(buf, i, flags) == 0);
if (i + 1 < sizeof buf)
assert_se(buf[i] == 0);
@@ -20,14 +20,14 @@ static void test_acquire_random_bytes(bool high_quality_required) {
}
}
-static void test_pseudorandom_bytes(void) {
+static void test_pseudo_random_bytes(void) {
uint8_t buf[16] = {};
unsigned i;
log_info("/* %s */", __func__);
for (i = 1; i < sizeof buf; i++) {
- pseudorandom_bytes(buf, i);
+ pseudo_random_bytes(buf, i);
if (i + 1 < sizeof buf)
assert_se(buf[i] == 0);
@@ -54,10 +54,12 @@ static void test_rdrand64(void) {
int main(int argc, char **argv) {
test_setup_logging(LOG_DEBUG);
- test_acquire_random_bytes(false);
- test_acquire_random_bytes(true);
+ test_genuine_random_bytes(RANDOM_EXTEND_WITH_PSEUDO);
+ test_genuine_random_bytes(0);
+ test_genuine_random_bytes(RANDOM_BLOCK);
+ test_genuine_random_bytes(RANDOM_ALLOW_RDRAND);
- test_pseudorandom_bytes();
+ test_pseudo_random_bytes();
test_rdrand64();