random-util: rename acquire_random_bytes() → genuine_random_bytes()

It's more descriptive, since we also have a function random_bytes()
which sounds very similar.

Also rename pseudorandom_bytes() to pseudo_random_bytes(). This way the
two functions are nicely systematic, one returning genuine random bytes
and the other pseudo random ones.
This commit is contained in:
Lennart Poettering
2018-11-08 09:44:27 +01:00
parent 8d2411f693
commit 3335dc2d75
5 changed files with 20 additions and 22 deletions
+7 -7
View File
@@ -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(bool high_quality_required) {
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, high_quality_required) == 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,10 @@ 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(false);
test_genuine_random_bytes(true);
test_pseudorandom_bytes();
test_pseudo_random_bytes();
test_rdrand64();