summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-05-02 08:18:48 -0400
committerNick Mathewson <nickm@torproject.org>2018-05-02 08:22:05 -0400
commit75f3fbaa3c7316fcef3509ef1e3813b94d8c4c8a (patch)
tree4546aa6dc9ae1f1d47431535d0569832b260df06 /src/common
parent34e7dca9c9e902a58fe8942cef666f1d99d06030 (diff)
downloadtor-75f3fbaa3c7316fcef3509ef1e3813b94d8c4c8a.tar.gz
tor-75f3fbaa3c7316fcef3509ef1e3813b94d8c4c8a.zip
LibreSSL compatibility fixes.
LibreSSL, despite not having the OpenSSL 1.1 API, does define OPENSSL_VERSION in crypto.h. Additionally, it apparently annotates some functions as returning NULL, so that our unit tests need to be more careful about checking for NULL so they don't get compilation warnings. Closes ticket 26006.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/compat_openssl.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/compat_openssl.h b/src/common/compat_openssl.h
index 1bfe188075..76679872bc 100644
--- a/src/common/compat_openssl.h
+++ b/src/common/compat_openssl.h
@@ -8,6 +8,8 @@
#define TOR_COMPAT_OPENSSL_H
#include <openssl/opensslv.h>
+// workaround for libressl; not needed in later Tor versions.
+#include <openssl/crypto.h>
/**
* \file compat_openssl.h
@@ -27,8 +29,11 @@
#define OPENSSL_1_1_API
#endif
-#ifndef OPENSSL_1_1_API
+#ifndef OPENSSL_VERSION
#define OPENSSL_VERSION SSLEAY_VERSION
+#endif
+
+#ifndef OPENSSL_1_1_API
#define OpenSSL_version(v) SSLeay_version(v)
#define OpenSSL_version_num() SSLeay()
#define RAND_OpenSSL() RAND_SSLeay()