diff --git a/src/tds/sec_negotiate_openssl.h b/src/tds/sec_negotiate_openssl.h
index 86af768..426d4a0 100644
--- a/src/tds/sec_negotiate_openssl.h
+++ b/src/tds/sec_negotiate_openssl.h
@@ -40,7 +40,7 @@
 static inline const BIGNUM*
 rsa_get_n(const RSA *rsa)
 {
-#if OPENSSL_VERSION_NUMBER >= 0x1010000FL
+#if OPENSSL_VERSION_NUMBER >= 0x1010000FL && !defined(LIBRESSL_VERSION_NUMBER)
 	const BIGNUM *n, *e, *d;
 	RSA_get0_key(rsa, &n, &e, &d);
 	return n;
diff --git a/src/tds/tls.c b/src/tds/tls.c
index 2738a2c..670ecb1 100644
--- a/src/tds/tls.c
+++ b/src/tds/tls.c
@@ -73,7 +73,7 @@
 #else
 
 /* some compatibility layer */
-#if OPENSSL_VERSION_NUMBER < 0x1010000FL
+#if OPENSSL_VERSION_NUMBER < 0x1010000FL || defined(LIBRESSL_VERSION_NUMBER)
 static inline void
 BIO_set_init(BIO *b, int init)
 {
@@ -590,7 +590,7 @@ tds_ssl_free(BIO *a)
 	return 1;
 }
 
-#if OPENSSL_VERSION_NUMBER < 0x1010000FL
+#if OPENSSL_VERSION_NUMBER < 0x1010000FL || defined(LIBRESSL_VERSION_NUMBER)
 static BIO_METHOD tds_method_login[1] = {
 {
 	BIO_TYPE_MEM,
