aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-11-05 04:13:13 +0100
committerJay Berkenbilt <ejb@ql.org>2019-11-09 14:18:02 +0100
commitcc14523440c99ff970e9a002f600133deab4b5dd (patch)
treeee0ffd929612b0c2e5cd1fc5d4bc6a064fa1806c /libqpdf
parentd0a53cd3ea89c4720c8de645f5347a55653d66d4 (diff)
downloadqpdf-cc14523440c99ff970e9a002f600133deab4b5dd.tar.zst
Update autoconf to support crypto selection
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDFCryptoProvider.cc9
-rw-r--r--libqpdf/build.mk2
-rw-r--r--libqpdf/qpdf/qpdf-config.h.in6
3 files changed, 15 insertions, 2 deletions
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 <qpdf/QPDFCryptoProvider.hh>
+#include <qpdf/qpdf-config.h>
#include <stdexcept>
-#include <qpdf/QPDFCrypto_native.hh>
+#ifdef USE_CRYPTO_NATIVE
+# include <qpdf/QPDFCrypto_native.hh>
+#endif
std::shared_ptr<QPDFCryptoImpl>
QPDFCryptoProvider::getImpl()
@@ -37,8 +40,10 @@ QPDFCryptoProvider::setDefaultProvider(std::string const& name)
QPDFCryptoProvider::QPDFCryptoProvider() :
m(std::make_shared<Members>())
{
+#ifdef USE_CRYPTO_NATIVE
registerImpl_internal<QPDFCrypto_native>("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