--- src/plugins/preauth/pkinit/pkinit_crypto_openssl.c.orig
+++ src/plugins/preauth/pkinit/pkinit_crypto_openssl.c
@@ -191,7 +191,7 @@
     (*_x509_pp) = PKCS7_cert_from_signer_info(_p7,_si)
 #endif
 
-#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
 
 /* 1.1 standardizes constructor and destructor names, renaming
  * EVP_MD_CTX_{create,destroy} and deprecating ASN1_STRING_data. */
@@ -3059,7 +3059,7 @@
     return retval;
 }
 
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
 
 /*
  * We need to decode DomainParameters from RFC 3279 section 2.3.3.  We would
@@ -3122,6 +3122,7 @@
 
 #else /* OPENSSL_VERSION_NUMBER < 0x10100000L */
 
+#include <openssl/asn1_mac.h>
 /*
  * Do the same decoding (except without decoding j and vparams or checking the
  * sequence length) using the pre-OpenSSL-1.1 asn1_mac.h.  Define an internal
