1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
From f5da3b4d9e35a2df272f2f4056c3647454eaea95 Mon Sep 17 00:00:00 2001
From: Zac Medico <zmedico@gmail.com>
Date: Sun, 15 Oct 2017 23:04:57 -0700
Subject: [PATCH] podofosign: fix compile errors with openssl-1.1.0f
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://sourceforge.net/p/podofo/mailman/message/36077904/
This fixes the following compile errors with openssl-1.1.0f:
tools/podofosign/podofosign.cpp:877:32: error: ‘OpenSSL_add_all_algorithms’ was not declared in this scope
OpenSSL_add_all_algorithms();
^
tools/podofosign/podofosign.cpp:878:29: error: ‘ERR_load_crypto_strings’ was not declared in this scope
ERR_load_crypto_strings();
^
tools/podofosign/podofosign.cpp:1085:22: error: ‘ERR_free_strings’ was not declared in this scope
ERR_free_strings();
^
This patch has been tested on Linux with openssl-1.0.2l and
openssl-1.1.0f.
Bug: https://bugs.gentoo.org/614756
---
CMakeLists.txt | 12 ++++++++++--
tools/podofosign/podofosign.cpp | 7 +++++++
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0c9a2ce..b4f7b3c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -325,6 +325,14 @@ ENDIF(CMAKE_COMPILER_IS_GNUCXX)
FIND_PACKAGE(ZLIB REQUIRED)
MESSAGE("Found zlib headers in ${ZLIB_INCLUDE_DIR}, library at ${ZLIB_LIBRARIES}")
+FIND_PACKAGE(OpenSSL)
+if(OpenSSL_FOUND)
+ SET(PODOFO_HAVE_OPENSSL TRUE)
+ INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIRS})
+ LINK_DIRECTORIES(${OPENSSL_LIBRARIES})
+ MESSAGE(STATUS "Using OpenSSL ${OPENSSL_VERSION}")
+ MESSAGE("Found OpenSSL ${OPENSSL_VERSION} headers in ${OPENSSL_INCLUDE_DIRS}, library at ${OPENSSL_LIBRARIES}")
+ELSE(OpenSSL_FOUND)
FIND_PACKAGE(LIBCRYPTO)
IF(LIBCRYPTO_FOUND)
@@ -334,6 +342,7 @@ IF(LIBCRYPTO_FOUND)
ELSE(LIBCRYPTO_FOUND)
MESSAGE("OpenSSL's libCrypto not found. Encryption support will be disabled")
ENDIF(LIBCRYPTO_FOUND)
+ENDIF(OpenSSL_FOUND)
FIND_PACKAGE(LIBIDN)
@@ -393,8 +402,6 @@ ENDIF(CppUnit_FOUND)
ENDIF(NOT PODOFO_BUILD_LIB_ONLY)
-FIND_PACKAGE(OpenSSL)
-
FIND_PACKAGE(FREETYPE REQUIRED)
MESSAGE("Found freetype library at ${FREETYPE_LIBRARIES}, headers ${FREETYPE_INCLUDE_DIR}")
@@ -499,6 +506,7 @@ SET(PODOFO_LIB_DEPENDS
${LIBCRYPTO_LDFLAGS}
${LIBCRYPTO_LIBRARIES}
${LIBJPEG_LIBRARIES}
+ ${OPENSSL_LIBRARIES}
${PLATFORM_SYSTEM_LIBRARIES}
${stlport_libraries_if_use_stlport}
${FREETYPE_LIBRARIES}
diff --git a/tools/podofosign/podofosign.cpp b/tools/podofosign/podofosign.cpp
index b8f5f61..a7be1e5 100644
--- a/tools/podofosign/podofosign.cpp
+++ b/tools/podofosign/podofosign.cpp
@@ -27,6 +27,7 @@
#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/pem.h>
+#include <openssl/ssl.h>
#include <openssl/x509.h>
#if defined(_WIN64)
@@ -874,11 +875,15 @@ int main( int argc, char* argv[] )
outputfile = NULL;
}
+#ifdef PODOFO_HAVE_OPENSSL_1_1
+ OPENSSL_init_ssl(0, NULL);
+#else
OpenSSL_add_all_algorithms();
ERR_load_crypto_strings();
ERR_load_PEM_strings();
ERR_load_ASN1_strings();
ERR_load_EVP_strings();
+#endif
X509* cert = NULL;
EVP_PKEY* pkey = NULL;
@@ -1082,7 +1087,9 @@ int main( int argc, char* argv[] )
result = e.GetError();
}
+#ifndef PODOFO_HAVE_OPENSSL_1_1
ERR_free_strings();
+#endif
if( pSignField )
delete pSignField;
--
|