aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-12-09 21:17:57 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-12-09 21:17:57 +0000
commit0710f3c93cb530bb52274e501002c2a3c6254080 (patch)
tree56e08e1fb8fe408ee228230ba37fc48525498f60 /src/main.c
parent2e6ede7291931e9ef53debca53dfe83986836ee2 (diff)
downloadrspamd-0710f3c93cb530bb52274e501002c2a3c6254080.tar.gz
rspamd-0710f3c93cb530bb52274e501002c2a3c6254080.zip
Move PRNG seeding function to the util set.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index 11da41921..7bbe63199 100644
--- a/src/main.c
+++ b/src/main.c
@@ -991,10 +991,6 @@ main (gint argc, gchar **argv, gchar **env)
GList *l;
worker_t **pworker;
GQuark type;
-#ifdef HAVE_OPENSSL
- gchar rand_bytes[sizeof (guint32)];
- guint32 rand_seed;
-#endif
#ifdef HAVE_SA_SIGINFO
signals_info = g_queue_new ();
@@ -1049,21 +1045,13 @@ main (gint argc, gchar **argv, gchar **env)
#ifdef HAVE_OPENSSL
ERR_load_crypto_strings ();
- /* Init random generator */
- if (RAND_bytes (rand_bytes, sizeof (rand_bytes)) != 1) {
- msg_err ("cannot seed random generator using openssl: %s, using time", ERR_error_string (ERR_get_error (), NULL));
- g_random_set_seed (time (NULL));
- }
- else {
- memcpy (&rand_seed, rand_bytes, sizeof (guint32));
- g_random_set_seed (rand_seed);
- }
-
OpenSSL_add_all_algorithms ();
OpenSSL_add_all_digests ();
OpenSSL_add_all_ciphers ();
#endif
+ rspamd_prng_seed ();
+
/* First set logger to console logger */
rspamd_set_logger (RSPAMD_LOG_CONSOLE, type, rspamd_main);
(void)open_log (rspamd_main->logger);