From 198774c03553fd775e70d238af243ed1c4e2323a Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Mon, 18 Dec 2023 14:47:08 +0100 Subject: [PATCH] [compat,libressl] fix compilation issues --- libfreerdp/crypto/cert_common.c | 8 +++++++- libfreerdp/crypto/privatekey.c | 8 +++++++- libfreerdp/crypto/tls.c | 4 ++-- winpr/tools/makecert/makecert.c | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/libfreerdp/crypto/cert_common.c b/libfreerdp/crypto/cert_common.c index cfa40290c..60ef60ff0 100644 --- a/libfreerdp/crypto/cert_common.c +++ b/libfreerdp/crypto/cert_common.c @@ -180,7 +180,13 @@ X509* x509_from_rsa(const RSA* rsa) { EVP_PKEY* pubkey = NULL; X509* x509 = NULL; - BIO* bio = BIO_new(BIO_s_secmem()); + BIO* bio = BIO_new( +#if defined(LIBRESSL_VERSION_NUMBER) + BIO_s_mem() +#else + BIO_s_secmem() +#endif + ); if (!bio) return NULL; diff --git a/libfreerdp/crypto/privatekey.c b/libfreerdp/crypto/privatekey.c index f05347e74..b27752a29 100644 --- a/libfreerdp/crypto/privatekey.c +++ b/libfreerdp/crypto/privatekey.c @@ -99,7 +99,13 @@ static RSA* evp_pkey_to_rsa(const rdpPrivateKey* key) } RSA* rsa = NULL; - BIO* bio = BIO_new(BIO_s_secmem()); + BIO* bio = BIO_new( +#if defined(LIBRESSL_VERSION_NUMBER) + BIO_s_mem() +#else + BIO_s_secmem() +#endif + ); if (!bio) return NULL; const int rc = PEM_write_bio_PrivateKey(bio, key->evp, NULL, NULL, 0, NULL, NULL); diff --git a/libfreerdp/crypto/tls.c b/libfreerdp/crypto/tls.c index 1a56a53f8..9a38493c4 100644 --- a/libfreerdp/crypto/tls.c +++ b/libfreerdp/crypto/tls.c @@ -1107,8 +1107,8 @@ TlsHandshakeResult freerdp_tls_accept_ex(rdpTls* tls, BIO* underlying, rdpSettin * Disable SSL client site renegotiation. */ -#if (OPENSSL_VERSION_NUMBER >= 0x10100000L && OPENSSL_VERSION_NUMBER < 0x30000000L) || \ - defined(LIBRESSL_VERSION_NUMBER) +#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && (OPENSSL_VERSION_NUMBER < 0x30000000L) && \ + !defined(LIBRESSL_VERSION_NUMBER) options |= SSL_OP_NO_RENEGOTIATION; #endif diff --git a/winpr/tools/makecert/makecert.c b/winpr/tools/makecert/makecert.c index f1505a27d..60826c5f7 100644 --- a/winpr/tools/makecert/makecert.c +++ b/winpr/tools/makecert/makecert.c @@ -103,7 +103,7 @@ static char* makecert_read_str(BIO* bio, size_t* pOffset) length = new_len; x509_str = new_str; ERR_clear_error(); -#if OPENSSL_VERSION_NUMBER >= 0x10101000L +#if OPENSSL_VERSION_NUMBER >= 0x10101000L && !defined(LIBRESSL_VERSION_NUMBER) status = BIO_read_ex(bio, &x509_str[offset], length - offset, &readBytes); #else status = BIO_read(bio, &x509_str[offset], length - offset);