Browse Source

Merge pull request #12201 from SoWhich/master

Adjust openssl #defines to be libressl compatible

[ci skip]
Rémi Verschelde 7 years ago
parent
commit
f52ab8d864

+ 3 - 3
modules/openssl/stream_peer_openssl.cpp

@@ -30,7 +30,7 @@
 #include "stream_peer_openssl.h"
 #include "stream_peer_openssl.h"
 
 
 // Compatibility with OpenSSL 1.1.0.
 // Compatibility with OpenSSL 1.1.0.
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
 #define BIO_set_num(b, n)
 #define BIO_set_num(b, n)
 #else
 #else
 #define BIO_set_num(b, n) ((b)->num = (n))
 #define BIO_set_num(b, n) ((b)->num = (n))
@@ -269,7 +269,7 @@ int StreamPeerOpenSSL::_bio_puts(BIO *b, const char *str) {
 	return _bio_write(b, str, strlen(str));
 	return _bio_write(b, str, strlen(str));
 }
 }
 
 
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
 BIO_METHOD *StreamPeerOpenSSL::_bio_method = NULL;
 BIO_METHOD *StreamPeerOpenSSL::_bio_method = NULL;
 
 
 BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() {
 BIO_METHOD *StreamPeerOpenSSL::_get_bio_method() {
@@ -568,7 +568,7 @@ void StreamPeerOpenSSL::initialize_ssl() {
 	load_certs_func = _load_certs;
 	load_certs_func = _load_certs;
 
 
 	_create = _create_func;
 	_create = _create_func;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
 	CRYPTO_malloc_init(); // Initialize malloc, free, etc for OpenSSL's use
 	CRYPTO_malloc_init(); // Initialize malloc, free, etc for OpenSSL's use
 #endif
 #endif
 	SSL_library_init(); // Initialize OpenSSL's SSL libraries
 	SSL_library_init(); // Initialize OpenSSL's SSL libraries

+ 1 - 1
modules/openssl/stream_peer_openssl.h

@@ -53,7 +53,7 @@ private:
 	static int _bio_gets(BIO *b, char *buf, int len);
 	static int _bio_gets(BIO *b, char *buf, int len);
 	static int _bio_puts(BIO *b, const char *str);
 	static int _bio_puts(BIO *b, const char *str);
 
 
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
 	static BIO_METHOD *_bio_method;
 	static BIO_METHOD *_bio_method;
 #else
 #else
 	static BIO_METHOD _bio_method;
 	static BIO_METHOD _bio_method;