aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libutil/util.c15
-rw-r--r--src/rspamd.h1
2 files changed, 14 insertions, 2 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c
index 7f8272c0e..68366927f 100644
--- a/src/libutil/util.c
+++ b/src/libutil/util.c
@@ -1938,10 +1938,21 @@ rspamd_init_libs (void)
{
struct rlimit rlim;
struct rspamd_external_libs_ctx *ctx;
+ struct ottery_config *ottery_cfg;
ctx = g_slice_alloc0 (sizeof (*ctx));
ctx->crypto_ctx = rspamd_cryptobox_init ();
- ottery_init (NULL);
+ ottery_cfg = g_malloc0 (ottery_get_sizeof_config ());
+ ottery_config_init (ottery_cfg);
+ ctx->ottery_cfg = ottery_cfg;
+
+ /* Check if we have rdrand */
+ if ((ctx->crypto_ctx->cpu_config & CPUID_RDRAND) == 0) {
+ ottery_config_disable_entropy_sources (ottery_cfg,
+ OTTERY_ENTROPY_SRC_RDRAND);
+ }
+
+ ottery_init (ottery_cfg);
#ifdef HAVE_LOCALE_H
if (getenv ("LANG") == NULL) {
@@ -2012,8 +2023,8 @@ rspamd_deinit_libs (struct rspamd_external_libs_ctx *ctx)
magic_close (ctx->libmagic);
}
+ g_free (ctx->ottery_cfg);
g_slice_free1 (sizeof (*ctx), ctx);
-
g_mime_shutdown ();
#ifdef HAVE_OPENSSL
diff --git a/src/rspamd.h b/src/rspamd.h
index 304075c53..df5239357 100644
--- a/src/rspamd.h
+++ b/src/rspamd.h
@@ -194,6 +194,7 @@ struct rspamd_external_libs_ctx {
magic_t libmagic;
void **local_addrs;
struct rspamd_cryptobox_library_ctx *crypto_ctx;
+ struct ottery_config *ottery_cfg;
ref_entry_t ref;
};