1From c21cde9010175e2355df17d4e81fedd6020603f8 Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Sat, 14 May 2022 00:03:51 +0200
4Subject: [PATCH] fix build with libressl >= 3.5.0
5
6Fix the following build failure with libressl >= 3.5.0:
7
8crypto-openssl-10.cpp:78:18: error: field 'ctx' has incomplete type 'HMAC_CTX' {aka 'hmac_ctx_st'}
9   78 |         HMAC_CTX ctx;
10      |                  ^~~
11
12Fixes:
13 - http://autobuild.buildroot.org/results/98747d470c2ad59280934e160d24bd3fdad1503c
14
15Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
16[Upstream status: https://github.com/AGWA/git-crypt/pull/249]
17---
18 crypto-openssl-10.cpp | 4 +++-
19 crypto-openssl-11.cpp | 4 +++-
20 2 files changed, 6 insertions(+), 2 deletions(-)
21
22diff --git a/crypto-openssl-10.cpp b/crypto-openssl-10.cpp
23index f0f2c53..a7a5d52 100644
24--- a/crypto-openssl-10.cpp
25+++ b/crypto-openssl-10.cpp
26@@ -29,8 +29,10 @@
27  */
28
29 #include <openssl/opensslconf.h>
30+#include <openssl/opensslv.h>
31
32-#if !defined(OPENSSL_API_COMPAT)
33+#if !defined(OPENSSL_API_COMPAT) && \
34+	!(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x30500000L)
35
36 #include "crypto.hpp"
37 #include "key.hpp"
38diff --git a/crypto-openssl-11.cpp b/crypto-openssl-11.cpp
39index adf03bb..32c2483 100644
40--- a/crypto-openssl-11.cpp
41+++ b/crypto-openssl-11.cpp
42@@ -29,8 +29,10 @@
43  */
44
45 #include <openssl/opensslconf.h>
46+#include <openssl/opensslv.h>
47
48-#if defined(OPENSSL_API_COMPAT)
49+#if defined(OPENSSL_API_COMPAT) || \
50+	(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x30500000L)
51
52 #include "crypto.hpp"
53 #include "key.hpp"
54--
552.35.1
56
57