diff --git a/src/crypto/Digest.h b/src/crypto/Digest.h
index c0a289550..1ddff993b 100644
--- a/src/crypto/Digest.h
+++ b/src/crypto/Digest.h
@@ -56,7 +56,11 @@
 #define URI_ECDSA_SHA384 "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384"
 #define URI_ECDSA_SHA512 "http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512"
 
+#ifdef LIBRESSL_VERSION_NUMBER
+using EVP_MD_CTX = struct env_md_ctx_st;
+#else
 using EVP_MD_CTX = struct evp_md_ctx_st;
+#endif
 
 namespace digidoc
 {