--- host/superscript.com/net/ucspi-ssl-0.99b/src/ssl_env.c.orig
+++ host/superscript.com/net/ucspi-ssl-0.99b/src/ssl_env.c
@@ -47,7 +47,7 @@
   int n;
 
   if (!env) return 1;
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   for (m = 0; m < sk_X509_NAME_ENTRY_num(xname->entries); m++) {
     xne = sk_X509_NAME_ENTRY_value(xname->entries,m);
     n = OBJ_obj2nid(xne->object);
@@ -76,7 +76,7 @@
   if (!env_str("SSL_PROTOCOL",SSL_get_version(ssl)))
     return 0;
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   session = SSL_get_session(ssl);
   x = session->session_id;
   n = session->session_id_length;
@@ -227,7 +227,7 @@
   set_env_id(xname,"SSL_CLIENT_I_DN_Email",NID_pkcs9_emailAddress);
 
 /* Signature Algorithm for PubKey */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   n = OBJ_obj2nid(cert->cert_info->signature->algorithm);
 #else
   sigalg = X509_get0_tbs_sigalg(cert);
@@ -238,7 +238,7 @@
     return 0;
 
 /* Algorithm for PubKey */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   n = OBJ_obj2nid(cert->cert_info->key->algor->algorithm);
 #else
   pubkey = X509_get_X509_PUBKEY(cert);
@@ -371,7 +371,7 @@
   set_env_id(xname,"SSL_SERVER_I_DN_Email",NID_pkcs9_emailAddress);
 
 /* Signature Algorithm of PubKey */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   n = OBJ_obj2nid(cert->cert_info->signature->algorithm);
 #else
   sigalg = X509_get0_tbs_sigalg(cert);
@@ -382,7 +382,7 @@
     return 0;
 
 /* Algorithm of PubKey */
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
   n = OBJ_obj2nid(cert->cert_info->key->algor->algorithm);
 #else
   pubkey = X509_get_X509_PUBKEY(cert);
