crypt: Rename init_random_seed_or_die() -> crypt_init().
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 28 Dec 2017 20:57:23 +0000 (21:57 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 25 Feb 2018 23:10:28 +0000 (00:10 +0100)
At least the gcrypt implementation does more than just seed the
PRNG. The new name is shorter and more descriptive.

audiod.c
client.c
crypt.h
gcrypt.c
server.c

index 8d152fa6dfeb4b6aeb9441be02287e163ebc90c2..4e6cf8e148aeb3156a584f20e0752b8b2e30c41d 100644 (file)
--- 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,
index 3e9219fd9226a1f1f37c5010e0237b982da9c59d..1d8a399ae948cae059e71c51ec141f7de3f4edfa 100644 (file)
--- 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 3e5a8d313b5ffd10273c27717c135e150f1c6d04..9c09face115ab7f4b465cdb1504a754a61ffa673 100644 (file)
--- 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. */
index 8d6db3490db95057b32168c3302fd0e2a0ee4e48..5c05ba20badce165aa1f1369136ab90e5d9b41d9 100644 (file)
--- 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;
index e9c1f12eeda3d4bfea1f59524ffacdad44201547..07a38f44a80436ae79dc89136478e4498d4ca9d8 100644 (file)
--- 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();