aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-24 15:49:07 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-09-24 15:49:07 +0100
commitd838161a48eee9651ffdc5a73367769e466d6948 (patch)
tree61ab1aa271739b6b4f56178bbe47c3f400d4b479
parent1aaa5ef8c665781a8ed2c7cd4200d6938be4ef38 (diff)
downloadrspamd-d838161a48eee9651ffdc5a73367769e466d6948.tar.gz
rspamd-d838161a48eee9651ffdc5a73367769e466d6948.zip
Check openssl version for using EVP.
-rw-r--r--src/main.c5
-rw-r--r--src/rcl/rcl_util.c11
2 files changed, 13 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index c2447454e..4b78b4173 100644
--- a/src/main.c
+++ b/src/main.c
@@ -891,6 +891,10 @@ perform_configs_sign (void)
msg_err ("cannot sign files without openssl support");
return EXIT_FAILURE;
#else
+# if (OPENSSL_VERSION_NUMBER < 0x10000000L)
+ msg_err ("must have openssl at least 1.0.0 to perform this action");
+ return EXIT_FAILURE;
+# else
gint i, tests_num, res = EXIT_SUCCESS, fd;
guint diglen;
gchar *cur_file, in_file[PATH_MAX],
@@ -1007,6 +1011,7 @@ perform_configs_sign (void)
BIO_free (fbio);
return res;
+# endif
#endif
}
diff --git a/src/rcl/rcl_util.c b/src/rcl/rcl_util.c
index b1729fd27..b5aabaf89 100644
--- a/src/rcl/rcl_util.c
+++ b/src/rcl/rcl_util.c
@@ -217,6 +217,10 @@ rspamd_cl_pubkey_add (struct rspamd_cl_parser *parser, const guchar *key, gsize
g_set_error (err, RCL_ERROR, RSPAMD_CL_EINTERNAL, "cannot check signatures without openssl");
return FALSE;
#else
+# if (OPENSSL_VERSION_NUMBER < 0x10000000L)
+ g_set_error (err, RCL_ERROR, RSPAMD_CL_EINTERNAL, "cannot check signatures, openssl version is unsupported");
+ return EXIT_FAILURE;
+# else
BIO *mem;
mem = BIO_new_mem_buf ((void *)key, len);
@@ -230,6 +234,7 @@ rspamd_cl_pubkey_add (struct rspamd_cl_parser *parser, const guchar *key, gsize
return FALSE;
}
LL_PREPEND (parser->keys, nkey);
+# endif
#endif
return TRUE;
}
@@ -387,7 +392,7 @@ rspamd_cl_fetch_file (const guchar *filename, guchar **buf, gsize *buflen, GErro
}
-#ifdef HAVE_OPENSSL
+#if (defined(HAVE_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10000000L)
static inline gboolean
rspamd_cl_sig_check (const guchar *data, gsize datalen,
const guchar *sig, gsize siglen, struct rspamd_cl_parser *parser)
@@ -461,7 +466,7 @@ rspamd_cl_include_url (const guchar *data, gsize len,
}
if (check_signature) {
-#ifdef HAVE_OPENSSL
+#if (defined(HAVE_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10000000L)
/* We need to check signature first */
rspamd_snprintf (urlbuf, sizeof (urlbuf), "%*s.sig", len, data);
if (!rspamd_cl_fetch_file (urlbuf, &sigbuf, &siglen, err)) {
@@ -523,7 +528,7 @@ rspamd_cl_include_file (const guchar *data, gsize len,
}
if (check_signature) {
-#ifdef HAVE_OPENSSL
+#if (defined(HAVE_OPENSSL) && OPENSSL_VERSION_NUMBER >= 0x10000000L)
/* We need to check signature first */
rspamd_snprintf (filebuf, sizeof (filebuf), "%s.sig", realbuf);
if (!rspamd_cl_fetch_file (filebuf, &sigbuf, &siglen, err)) {