From aa066efd962198bbeed8e5bcee57572f9e15455a Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 28 Dec 2017 21:57:23 +0100 Subject: [PATCH] crypt: Rename init_random_seed_or_die() -> crypt_init(). At least the gcrypt implementation does more than just seed the PRNG. The new name is shorter and more descriptive. --- audiod.c | 2 +- client.c | 2 +- crypt.h | 11 ++++++----- gcrypt.c | 2 +- server.c | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/audiod.c b/audiod.c index 8d152fa6..4e6cf8e1 100644 --- a/audiod.c +++ b/audiod.c @@ -1493,7 +1493,7 @@ int main(int argc, char *argv[]) version_handle_flag("audiod", OPT_GIVEN(VERSION)); handle_help_flags(); parse_config_or_die(); - init_random_seed_or_die(); + crypt_init(); daemon_set_priority(OPT_UINT32_VAL(PRIORITY)); recv_init(); if (daemon_init_colors_or_die(OPT_UINT32_VAL(COLOR), COLOR_AUTO, diff --git a/client.c b/client.c index 3e9219fd..1d8a399a 100644 --- a/client.c +++ b/client.c @@ -618,7 +618,7 @@ int main(int argc, char *argv[]) { int ret; - init_random_seed_or_die(); + crypt_init(); sched.default_timeout.tv_sec = 1; ret = client_parse_config(argc, argv, &ct, &client_loglevel); diff --git a/crypt.h b/crypt.h index 3e5a8d31..9c09face 100644 --- a/crypt.h +++ b/crypt.h @@ -77,16 +77,17 @@ void apc_free_pubkey(struct asymmetric_key *key); void get_random_bytes_or_die(unsigned char *buf, int num); /** - * Seed pseudo random number generators. + * Initialize the crypto backend. * - * This function seeds the PRNG used by random() with a random seed obtained - * from the crypto implementation. On errors, an error message is logged and - * the function calls exit(). + * This function initializes the crypto library and seeds the pseudo random + * number generator used by random() with a random seed obtained from the + * crypto implementation. On errors, an error message is logged and the + * function calls exit(). * * \sa \ref get_random_bytes_or_die(), srandom(3), random(3), \ref * para_random(). */ -void init_random_seed_or_die(void); +void crypt_init(void); /** Opaque structure for stream ciphers. */ diff --git a/gcrypt.c b/gcrypt.c index 8d6db349..5c05ba20 100644 --- a/gcrypt.c +++ b/gcrypt.c @@ -56,7 +56,7 @@ void get_random_bytes_or_die(unsigned char *buf, int num) * call to gcry_check_version() initializes the gcrypt library and checks that * we have at least the minimal required version. */ -void init_random_seed_or_die(void) +void crypt_init(void) { const char *req_ver = "1.5.0"; int seed; diff --git a/server.c b/server.c index e9c1f12e..07a38f44 100644 --- a/server.c +++ b/server.c @@ -513,7 +513,7 @@ static void server_init(int argc, char **argv) /* become daemon */ if (OPT_GIVEN(DAEMON)) daemon_pipe = daemonize(true /* parent waits for SIGTERM */); - init_random_seed_or_die(); + crypt_init(); daemon_log_welcome("server"); init_ipc_or_die(); /* init mmd struct and mmd->lock */ daemon_set_start_time(); -- 2.30.2