diff options
author | Paul Gardiner <paul.gardiner@artifex.com> | 2018-02-01 13:19:48 +0000 |
---|---|---|
committer | Paul Gardiner <paul.gardiner@artifex.com> | 2018-02-02 12:38:36 +0000 |
commit | 8ec561d1bccc46e9db40a9f61310cd8b3763914e (patch) | |
tree | 9db671082225933f9429ac9c0cc9ec1f4aaea3a1 | |
parent | e0b3451e473885a39ed54c8bf7a98e48a3cf5502 (diff) | |
download | mupdf-8ec561d1bccc46e9db40a9f61310cd8b3763914e.tar.xz |
Signature support: add a null pdf_check_signature function
Add a version of pdf_check_signature function that reports no support,
for builds without openssl. This allows the removal of ifdefs from the
apps.
-rw-r--r-- | Makefile | 9 | ||||
-rw-r--r-- | platform/win32/mupdf.vcproj | 17 | ||||
-rw-r--r-- | platform/x11/pdfapp.c | 4 | ||||
-rw-r--r-- | source/helpers/pkcs7/pkcs7-check.c | 14 | ||||
-rw-r--r-- | source/tools/pdfsign.c | 4 |
5 files changed, 17 insertions, 31 deletions
@@ -141,7 +141,10 @@ CBZ_SRC := $(sort $(wildcard source/cbz/*.c)) HTML_SRC := $(sort $(wildcard source/html/*.c)) GPRF_SRC := $(sort $(wildcard source/gprf/*.c)) THREAD_SRC := $(sort $(wildcard source/helpers/mu-threads/*.c)) -PKCS7_SRC := $(sort $(wildcard source/helpers/pkcs7/*.c)) +PKCS7_SRC := $(wildcard source/helpers/pkcs7/pkcs7-check.c) +ifeq "$(HAVE_LIBCRYPTO)" "yes" +PKCS7_SRC += $(wildcard source/helpers/pkcs7/pkcs7-openssl.c) +endif FITZ_SRC_HDR := $(wildcard source/fitz/*.h) PDF_SRC_HDR := $(wildcard source/pdf/*.h) source/pdf/pdf-name-table.h @@ -325,9 +328,7 @@ generate: $(JAVASCRIPT_GEN) MUPDF_LIB = $(OUT)/libmupdf.a THIRD_LIB = $(OUT)/libmupdfthird.a THREAD_LIB = $(OUT)/libmuthreads.a -ifeq "$(HAVE_LIBCRYPTO)" "yes" PKCS7_LIB = $(OUT)/libmupkcs7.a -endif MUPDF_OBJ := \ $(FITZ_OBJ) \ @@ -357,9 +358,7 @@ THIRD_OBJ := \ $(MUPDF_LIB) : $(MUPDF_OBJ) $(THIRD_LIB) : $(THIRD_OBJ) $(THREAD_LIB) : $(THREAD_OBJ) -ifeq "$(HAVE_LIBCRYPTO)" "yes" $(PKCS7_LIB) : $(PKCS7_OBJ) -endif INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) diff --git a/platform/win32/mupdf.vcproj b/platform/win32/mupdf.vcproj index 84e3a359..d4c42ec8 100644 --- a/platform/win32/mupdf.vcproj +++ b/platform/win32/mupdf.vcproj @@ -1360,7 +1360,6 @@ > <FileConfiguration Name="Debug|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1368,7 +1367,6 @@ </FileConfiguration> <FileConfiguration Name="Debug|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1376,7 +1374,6 @@ </FileConfiguration> <FileConfiguration Name="Release|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1384,7 +1381,6 @@ </FileConfiguration> <FileConfiguration Name="Release|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1392,7 +1388,6 @@ </FileConfiguration> <FileConfiguration Name="Memento|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1400,7 +1395,6 @@ </FileConfiguration> <FileConfiguration Name="Memento|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1415,7 +1409,6 @@ </FileConfiguration> <FileConfiguration Name="DebugOpenssl|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1423,7 +1416,6 @@ </FileConfiguration> <FileConfiguration Name="ReleaseOpenssl|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1431,7 +1423,6 @@ </FileConfiguration> <FileConfiguration Name="ReleaseOpenssl|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1439,7 +1430,6 @@ </FileConfiguration> <FileConfiguration Name="DebugGProof|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1447,7 +1437,6 @@ </FileConfiguration> <FileConfiguration Name="DebugGProof|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1455,7 +1444,6 @@ </FileConfiguration> <FileConfiguration Name="MementoCommercial|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1463,7 +1451,6 @@ </FileConfiguration> <FileConfiguration Name="MementoCommercial|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1471,7 +1458,6 @@ </FileConfiguration> <FileConfiguration Name="DebugCommercial|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1479,7 +1465,6 @@ </FileConfiguration> <FileConfiguration Name="DebugCommercial|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1487,7 +1472,6 @@ </FileConfiguration> <FileConfiguration Name="ReleaseCommercial|Win32" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" @@ -1495,7 +1479,6 @@ </FileConfiguration> <FileConfiguration Name="ReleaseCommercial|x64" - ExcludedFromBuild="true" > <Tool Name="VCCLCompilerTool" diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index ca869f16..9ded94b3 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -1714,7 +1714,6 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta break; case PDF_WIDGET_TYPE_SIGNATURE: -#ifdef HAVE_LIBCRYPTO if (state == -1) { char ebuf[256]; @@ -1732,9 +1731,6 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta winwarn(app, ebuf); } } -#else - winwarn(app, "No support for signatures in this build"); -#endif break; } } diff --git a/source/helpers/pkcs7/pkcs7-check.c b/source/helpers/pkcs7/pkcs7-check.c index 4c70bb2c..225ec385 100644 --- a/source/helpers/pkcs7/pkcs7-check.c +++ b/source/helpers/pkcs7/pkcs7-check.c @@ -1,8 +1,10 @@ #include "mupdf/fitz.h" #include "mupdf/pdf.h" -#include "mupdf/helpers/pkcs7-openssl.h" + #include "mupdf/helpers/pkcs7-check.h" +#ifdef HAVE_LIBCRYPTO +#include "mupdf/helpers/pkcs7-openssl.h" #include <string.h> @@ -126,3 +128,13 @@ int pdf_check_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget, return res; } + +#else + +int pdf_check_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget, char *ebuf, int ebufsize) +{ + fz_strlcpy(ebuf, "No digital signing support in this build", ebufsize); + return 0; +} + +#endif diff --git a/source/tools/pdfsign.c b/source/tools/pdfsign.c index 434c9332..b9b1c862 100644 --- a/source/tools/pdfsign.c +++ b/source/tools/pdfsign.c @@ -23,14 +23,10 @@ static void usage(void) void verify_signature(fz_context *ctx, pdf_document *doc, int n, pdf_widget *widget) { -#ifdef HAVE_LIBCRYPTO char msg[256]; printf("verifying signature on page %d\n", n+1); pdf_check_signature(ctx, doc, widget, msg, sizeof msg); printf(" result: '%s'\n", msg); -#else - printf("No signature support in this build\n"); -#endif } void verify_page(fz_context *ctx, pdf_document *doc, int n, pdf_page *page) |