]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix some of the moved functions
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 13 Feb 2020 17:10:35 +0000 (17:10 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 13 Feb 2020 17:10:35 +0000 (17:10 +0000)
src/libserver/cfg_file.h
src/libserver/cfg_utils.c
src/libserver/http/http_context.c
src/libserver/ssl_util.c
src/libserver/ssl_util.h

index e37bccc69a5731d2d25341fb429318a33678559f..1d782dd8b7da266d92803f027630992d780e5d13 100644 (file)
@@ -856,7 +856,6 @@ gboolean rspamd_ip_is_local_cfg (struct rspamd_config *cfg,
  */
 gboolean rspamd_config_libs (struct rspamd_external_libs_ctx *ctx,
                                                         struct rspamd_config *cfg);
-void rspamd_openssl_maybe_init (void);
 
 #define msg_err_config(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \
         cfg->cfg_pool->tag.tagname, cfg->checksum, \
index dac2e13c47fe699faeaa8b3a4dd9e4b0358ce04e..0d4953d5127be77eaabb6497f6b0d138179a9b16 100644 (file)
@@ -46,7 +46,6 @@
 #include <openssl/evp.h>
 #include <openssl/ssl.h>
 #include <openssl/conf.h>
-#include <openssl/engine.h>
 #endif
 #ifdef HAVE_LOCALE_H
 #include <locale.h>
@@ -2639,44 +2638,6 @@ rspamd_config_ev_backend_to_string (int ev_backend, gboolean *effective)
 #undef SET_EFFECTIVE
 }
 
-void
-rspamd_openssl_maybe_init (void)
-{
-       static gboolean openssl_initialized = FALSE;
-
-       if (!openssl_initialized) {
-               ERR_load_crypto_strings ();
-               SSL_load_error_strings ();
-
-               OpenSSL_add_all_algorithms ();
-               OpenSSL_add_all_digests ();
-               OpenSSL_add_all_ciphers ();
-
-#if OPENSSL_VERSION_NUMBER >= 0x1000104fL && !defined(LIBRESSL_VERSION_NUMBER)
-               ENGINE_load_builtin_engines ();
-#endif
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-               SSL_library_init ();
-#else
-               OPENSSL_init_ssl (0, NULL);
-#endif
-
-#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-               OPENSSL_config (NULL);
-#endif
-               if (RAND_status () == 0) {
-                       guchar seed[128];
-
-                       /* Try to use ottery to seed rand */
-                       ottery_rand_bytes (seed, sizeof (seed));
-                       RAND_seed (seed, sizeof (seed));
-                       rspamd_explicit_memzero (seed, sizeof (seed));
-               }
-
-               openssl_initialized = TRUE;
-       }
-}
-
 struct rspamd_external_libs_ctx *
 rspamd_init_libs (void)
 {
index d7e530d56239463253e16253ff1ef00e0e160ca9..8db43841d8730a6171d5cb97b4236ceb38313f17 100644 (file)
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include <contrib/http-parser/http_parser.h>
 #include "http_context.h"
 #include "http_private.h"
 #include "keypair.h"
@@ -22,6 +21,7 @@
 #include "cfg_file.h"
 #include "contrib/libottery/ottery.h"
 #include "contrib/http-parser/http_parser.h"
+#include "ssl_util.h"
 #include "rspamd.h"
 #include "libev_helper.h"
 
index f4e55fbea50017163519c6561d1330e12bd28de4..a094eaf4527e5bf73e165dd5dd7a37de9d232b6d 100644 (file)
 #include "libserver/logger.h"
 #include "ssl_util.h"
 #include "unix-std.h"
+#include "cryptobox.h"
+#include "contrib/libottery/ottery.h"
 
 #include <openssl/ssl.h>
 #include <openssl/err.h>
 #include <openssl/rand.h>
 #include <openssl/conf.h>
+#include <openssl/evp.h>
+#include <openssl/engine.h>
 #include <openssl/x509v3.h>
 
 enum rspamd_ssl_state {
@@ -970,4 +974,42 @@ gpointer rspamd_init_ssl_ctx_noverify (void)
 #endif
 
        return ssl_ctx_noverify;
+}
+
+void
+rspamd_openssl_maybe_init (void)
+{
+       static gboolean openssl_initialized = FALSE;
+
+       if (!openssl_initialized) {
+               ERR_load_crypto_strings ();
+               SSL_load_error_strings ();
+
+               OpenSSL_add_all_algorithms ();
+               OpenSSL_add_all_digests ();
+               OpenSSL_add_all_ciphers ();
+
+#if OPENSSL_VERSION_NUMBER >= 0x1000104fL && !defined(LIBRESSL_VERSION_NUMBER)
+               ENGINE_load_builtin_engines ();
+#endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+               SSL_library_init ();
+#else
+               OPENSSL_init_ssl (0, NULL);
+#endif
+
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+               OPENSSL_config (NULL);
+#endif
+               if (RAND_status () == 0) {
+                       guchar seed[128];
+
+                       /* Try to use ottery to seed rand */
+                       ottery_rand_bytes (seed, sizeof (seed));
+                       RAND_seed (seed, sizeof (seed));
+                       rspamd_explicit_memzero (seed, sizeof (seed));
+               }
+
+               openssl_initialized = TRUE;
+       }
 }
\ No newline at end of file
index 708c07930ce5c4394ebb74bdef10d0d8c72fba65..9118c3e8cd645027e926387b6cc91a4b70651373 100644 (file)
@@ -96,6 +96,7 @@ void rspamd_ssl_connection_free (struct rspamd_ssl_connection *conn);
 
 gpointer rspamd_init_ssl_ctx (void);
 gpointer rspamd_init_ssl_ctx_noverify (void);
+void rspamd_openssl_maybe_init (void);
 
 #ifdef  __cplusplus
 }