From cc14523440c99ff970e9a002f600133deab4b5dd Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 4 Nov 2019 22:13:13 -0500 Subject: Update autoconf to support crypto selection --- libqpdf/QPDFCryptoProvider.cc | 9 +++++++-- libqpdf/build.mk | 2 ++ libqpdf/qpdf/qpdf-config.h.in | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'libqpdf') diff --git a/libqpdf/QPDFCryptoProvider.cc b/libqpdf/QPDFCryptoProvider.cc index 8d795534..58712f54 100644 --- a/libqpdf/QPDFCryptoProvider.cc +++ b/libqpdf/QPDFCryptoProvider.cc @@ -1,7 +1,10 @@ #include +#include #include -#include +#ifdef USE_CRYPTO_NATIVE +# include +#endif std::shared_ptr QPDFCryptoProvider::getImpl() @@ -37,8 +40,10 @@ QPDFCryptoProvider::setDefaultProvider(std::string const& name) QPDFCryptoProvider::QPDFCryptoProvider() : m(std::make_shared()) { +#ifdef USE_CRYPTO_NATIVE registerImpl_internal("native"); - setDefaultProvider_internal("native"); +#endif + setDefaultProvider_internal(DEFAULT_CRYPTO); } QPDFCryptoProvider& diff --git a/libqpdf/build.mk b/libqpdf/build.mk index 24ff682d..7e5f4aa3 100644 --- a/libqpdf/build.mk +++ b/libqpdf/build.mk @@ -90,7 +90,9 @@ SRCS_libqpdf = \ libqpdf/SparseOHArray.cc \ libqpdf/qpdf-c.cc +ifeq ($(USE_CRYPTO_NATIVE), 1) SRCS_libqpdf += $(CRYPTO_NATIVE) +endif # ----- diff --git a/libqpdf/qpdf/qpdf-config.h.in b/libqpdf/qpdf/qpdf-config.h.in index 4eeff555..20441efd 100644 --- a/libqpdf/qpdf/qpdf-config.h.in +++ b/libqpdf/qpdf/qpdf-config.h.in @@ -3,6 +3,9 @@ /* Whether to avoid use of HANDLE in Windows */ #undef AVOID_WINDOWS_HANDLE +/* Default crypto provider */ +#undef DEFAULT_CRYPTO + /* define if the compiler supports basic C++11 syntax */ #undef HAVE_CXX11 @@ -81,6 +84,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Whether to use the native crypto provider */ +#undef USE_CRYPTO_NATIVE + /* Whether to use insecure random numbers */ #undef USE_INSECURE_RANDOM -- cgit v1.2.3-70-g09d2