[vbox-dev] [PATCH] Fix compilation with LibreSSL <2.7.0
Stefan Strogin
stefan.strogin at gmail.com
Wed Jan 16 04:26:54 UTC 2019
BIO_up_ref() was provided since LibreSSL-2.7.0.
When 2.6.x is used we get an error:
src/VBox/Runtime/common/crypto/ssl-openssl.cpp:275:17: error: ‘BIO_up_ref’ was not declared in this scope
BIO_up_ref(pSession->pBio); /* our reference. */
^~~~~~~~~~
See also: https://bugs.gentoo.org/673800
The patch is submitted under MIT license.
---
src/VBox/Runtime/common/crypto/ssl-openssl.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/VBox/Runtime/common/crypto/ssl-openssl.cpp b/src/VBox/Runtime/common/crypto/ssl-openssl.cpp
index dbbf4940..5326de4e 100644
--- a/src/VBox/Runtime/common/crypto/ssl-openssl.cpp
+++ b/src/VBox/Runtime/common/crypto/ssl-openssl.cpp
@@ -272,7 +272,7 @@ RTDECL(int) RTCrSslCreateSessionForNativeSocket(RTCRSSL hSsl, RTHCINTPTR hNative
pSession->pBio = BIO_new_socket(hNativeSocket, BIO_NOCLOSE);
if (pSession->pBio)
{
-# if OPENSSL_VERSION_NUMBER >= 0x10100000
+# if (OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)) || LIBRESSL_VERSION_NUMBER >= 0x2070000f
BIO_up_ref(pSession->pBio); /* our reference. */
# endif
SSL_set_bio(pSession->pSsl, pSession->pBio, pSession->pBio);
@@ -320,7 +320,7 @@ static int rtCrSslSessionDestroy(RTCRSSLSESSIONINT *pThis)
ASMAtomicWriteU32(&pThis->u32Magic, ~RTCRSSLSESSIONINT_MAGIC);
SSL_free(pThis->pSsl);
pThis->pSsl = NULL;
-# if OPENSSL_VERSION_NUMBER >= 0x10100000
+# if (OPENSSL_VERSION_NUMBER >= 0x10100000 && !defined(LIBRESSL_VERSION_NUMBER)) || LIBRESSL_VERSION_NUMBER >= 0x2070000f
BIO_free(pThis->pBio);
# endif
pThis->pBio = NULL;
--
2.20.1
More information about the vbox-dev
mailing list