From 55783fa9e3adad72474b74e5b5f05d33dfb798cb Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Thu, 13 Oct 2022 07:33:54 +0200 Subject: [PATCH] rebase to 11.1.1 --- .gitignore | 2 + qpdf-relax.patch | 161 +++++++++++++++++++++++------------------------ qpdf.spec | 7 ++- sources | 4 +- 4 files changed, 88 insertions(+), 86 deletions(-) diff --git a/.gitignore b/.gitignore index b186531..fa8bb1f 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,5 @@ /qpdf-10.6.3.tar.gz /qpdf-11.1.0-doc.zip /qpdf-11.1.0.tar.gz +/qpdf-11.1.1-doc.zip +/qpdf-11.1.1.tar.gz diff --git a/qpdf-relax.patch b/qpdf-relax.patch index a39f1db..89d3994 100644 --- a/qpdf-relax.patch +++ b/qpdf-relax.patch @@ -1,7 +1,6 @@ -diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc -index dd6037c..2a26a85 100644 ---- a/libqpdf/QPDF.cc -+++ b/libqpdf/QPDF.cc +diff -up qpdf-11.1.1/libqpdf/QPDF.cc.relax qpdf-11.1.1/libqpdf/QPDF.cc +--- qpdf-11.1.1/libqpdf/QPDF.cc.relax 2022-10-01 18:04:50.000000000 +0200 ++++ qpdf-11.1.1/libqpdf/QPDF.cc 2022-10-13 07:13:29.024092866 +0200 @@ -13,6 +13,10 @@ #include #include @@ -13,7 +12,7 @@ index dd6037c..2a26a85 100644 #include #include #include -@@ -279,7 +283,13 @@ void +@@ -280,7 +284,13 @@ void QPDF::processFile(char const* filename, char const* password) { FileInputSource* fi = new FileInputSource(filename); @@ -27,7 +26,7 @@ index dd6037c..2a26a85 100644 } void -@@ -287,7 +297,13 @@ QPDF::processFile( +@@ -288,7 +298,13 @@ QPDF::processFile( char const* description, FILE* filep, bool close_file, char const* password) { FileInputSource* fi = new FileInputSource(description, filep, close_file); @@ -41,77 +40,9 @@ index dd6037c..2a26a85 100644 } void -diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc -index aad536b..ab02371 100644 ---- a/libqpdf/QPDFWriter.cc -+++ b/libqpdf/QPDFWriter.cc -@@ -25,6 +25,10 @@ - #include - #include - -+#ifdef USE_CRYPTO_GNUTLS -+#include -+#endif -+ - QPDFWriter::ProgressReporter::~ProgressReporter() - { - // Must be explicit and not inline -- see QPDF_DLL_CLASS in -@@ -342,6 +346,13 @@ void - QPDFWriter::setDeterministicID(bool val) - { - this->m->deterministic_id = val; -+ -+#ifdef USE_CRYPTO_GNUTLS -+ if (val) -+ GNUTLS_FIPS140_SET_LAX_MODE(); -+ else -+ GNUTLS_FIPS140_SET_STRICT_MODE(); -+#endif - } - - void -@@ -362,6 +373,13 @@ void - QPDFWriter::setPreserveEncryption(bool val) - { - this->m->preserve_encryption = val; -+ -+#ifdef USE_CRYPTO_GNUTLS -+ if (val) -+ GNUTLS_FIPS140_SET_STRICT_MODE(); -+ else -+ GNUTLS_FIPS140_SET_LAX_MODE(); -+#endif - } - - void -@@ -2109,12 +2127,23 @@ QPDFWriter::generateID() - } - } - -+#ifdef USE_CRYPTO_GNUTLS -+ unsigned oldmode = gnutls_fips140_mode_enabled(); -+ -+ gnutls_fips140_set_mode(GNUTLS_FIPS140_LAX, GNUTLS_FIPS140_SET_MODE_THREAD); -+#endif -+ - MD5 m; - m.encodeString(seed.c_str()); - MD5::Digest digest; - m.digest(digest); - result = - std::string(reinterpret_cast(digest), sizeof(MD5::Digest)); -+ -+#ifdef USE_CRYPTO_GNUTLS -+ gnutls_fips140_set_mode(static_cast(oldmode), GNUTLS_FIPS140_SET_MODE_THREAD); -+#endif -+ - } - - // If /ID already exists, follow the spec: use the original first -diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc -index 266907a..658a353 100644 ---- a/libqpdf/QPDF_encryption.cc -+++ b/libqpdf/QPDF_encryption.cc +diff -up qpdf-11.1.1/libqpdf/QPDF_encryption.cc.relax qpdf-11.1.1/libqpdf/QPDF_encryption.cc +--- qpdf-11.1.1/libqpdf/QPDF_encryption.cc.relax 2022-10-01 18:04:50.000000000 +0200 ++++ qpdf-11.1.1/libqpdf/QPDF_encryption.cc 2022-10-13 07:15:03.470151572 +0200 @@ -3,6 +3,8 @@ #include @@ -154,7 +85,7 @@ index 266907a..658a353 100644 return std::string( reinterpret_cast(digest), std::min(result.length(), toS(16))); } -@@ -1100,6 +1117,12 @@ QPDF::getKeyForObject( +@@ -1076,6 +1093,12 @@ QPDF::getKeyForObject( void QPDF::decryptString(std::string& str, QPDFObjGen const& og) { @@ -167,9 +98,9 @@ index 266907a..658a353 100644 if (!og.isIndirect()) { return; } -@@ -1174,6 +1197,10 @@ QPDF::decryptString(std::string& str, QPDFObjGen const& og) +@@ -1142,6 +1165,10 @@ QPDF::decryptString(std::string& str, QP "error decrypting string for object " + og.unparse() + ": " + - e.what()); + e.what()); } + +#ifdef USE_CRYPTO_GNUTLS @@ -178,7 +109,7 @@ index 266907a..658a353 100644 } void -@@ -1186,6 +1213,12 @@ QPDF::decryptStream( +@@ -1154,6 +1181,12 @@ QPDF::decryptStream( QPDFObjectHandle& stream_dict, std::vector>& heap) { @@ -191,7 +122,7 @@ index 266907a..658a353 100644 std::string type; if (stream_dict.getKey("/Type").isName()) { type = stream_dict.getKey("/Type").getName(); -@@ -1297,6 +1330,10 @@ QPDF::decryptStream( +@@ -1262,6 +1295,10 @@ QPDF::decryptStream( } pipeline = new_pipeline.get(); heap.push_back(new_pipeline); @@ -202,3 +133,69 @@ index 266907a..658a353 100644 } void +diff -up qpdf-11.1.1/libqpdf/QPDFWriter.cc.relax qpdf-11.1.1/libqpdf/QPDFWriter.cc +--- qpdf-11.1.1/libqpdf/QPDFWriter.cc.relax 2022-10-01 18:04:50.000000000 +0200 ++++ qpdf-11.1.1/libqpdf/QPDFWriter.cc 2022-10-13 07:13:29.025092856 +0200 +@@ -25,6 +25,10 @@ + #include + #include + ++#ifdef USE_CRYPTO_GNUTLS ++#include ++#endif ++ + QPDFWriter::ProgressReporter::~ProgressReporter() + { + // Must be explicit and not inline -- see QPDF_DLL_CLASS in +@@ -342,6 +346,13 @@ void + QPDFWriter::setDeterministicID(bool val) + { + this->m->deterministic_id = val; ++ ++#ifdef USE_CRYPTO_GNUTLS ++ if (val) ++ GNUTLS_FIPS140_SET_LAX_MODE(); ++ else ++ GNUTLS_FIPS140_SET_STRICT_MODE(); ++#endif + } + + void +@@ -362,6 +373,13 @@ void + QPDFWriter::setPreserveEncryption(bool val) + { + this->m->preserve_encryption = val; ++ ++#ifdef USE_CRYPTO_GNUTLS ++ if (val) ++ GNUTLS_FIPS140_SET_STRICT_MODE(); ++ else ++ GNUTLS_FIPS140_SET_LAX_MODE(); ++#endif + } + + void +@@ -2101,12 +2119,23 @@ QPDFWriter::generateID() + } + } + ++#ifdef USE_CRYPTO_GNUTLS ++ unsigned oldmode = gnutls_fips140_mode_enabled(); ++ ++ gnutls_fips140_set_mode(GNUTLS_FIPS140_LAX, GNUTLS_FIPS140_SET_MODE_THREAD); ++#endif ++ + MD5 m; + m.encodeString(seed.c_str()); + MD5::Digest digest; + m.digest(digest); + result = + std::string(reinterpret_cast(digest), sizeof(MD5::Digest)); ++ ++#ifdef USE_CRYPTO_GNUTLS ++ gnutls_fips140_set_mode(static_cast(oldmode), GNUTLS_FIPS140_SET_MODE_THREAD); ++#endif ++ + } + + // If /ID already exists, follow the spec: use the original first diff --git a/qpdf.spec b/qpdf.spec index 5f5d352..1ba7042 100644 --- a/qpdf.spec +++ b/qpdf.spec @@ -1,6 +1,6 @@ Summary: Command-line tools and library for transforming PDF files Name: qpdf -Version: 11.1.0 +Version: 11.1.1 Release: 1%{?dist} # MIT: e.g. libqpdf/sha2.c # upstream uses ASL 2.0 now, but he allowed other to distribute qpdf under @@ -125,7 +125,7 @@ install -m 0644 %{name}-%{version}-doc/%{name}-manual.pdf %{buildroot}/%{_pkgdoc %doc README.md TODO ChangeLog %license Artistic-2.0 %{_libdir}/libqpdf.so.29 -%{_libdir}/libqpdf.so.29.1.0 +%{_libdir}/libqpdf.so.29.1.1 %files devel %doc examples/*.cc examples/*.c @@ -138,6 +138,9 @@ install -m 0644 %{name}-%{version}-doc/%{name}-manual.pdf %{buildroot}/%{_pkgdoc %changelog +* Thu Oct 13 2022 Zdenek Dohnal - 11.1.1-1 +- 2125823 - qpdf-11.1.1 is available + * Thu Sep 22 2022 Zdenek Dohnal - 11.1.0-1 - 2125823 - qpdf-11.1.0 is available, move to cmake diff --git a/sources b/sources index 89ceefc..85c5ca5 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (qpdf-11.1.0-doc.zip) = 300dca6495ff9770138b7166e584cff1f2d26c60f273030211a895cf0f0147124240c2f22e79fae4f66595b863e2ce9dcdd7e8144c8b64357bf9a9e9b92ca6ea -SHA512 (qpdf-11.1.0.tar.gz) = 4c4daf3e6ae40e57d0d099abb7c9e694b7bec0c6657ffa4dc084f295d57799b8a5cbe5827d346fcbb89fa88a84c4dbd9a5437cc649b617cd479231c9ecc3fb5a +SHA512 (qpdf-11.1.1-doc.zip) = 6e4b87abefedcaf1e3407d1630f9c6e796db64b3cdae25a9489d8f0b1d5c06673821436877c36f015d6a5d126feefda17bb246f0b8ea87c0617238254816f7c2 +SHA512 (qpdf-11.1.1.tar.gz) = da7540152a82cbb853089afa2503ece04086513bab662171758f1e0e928ac09cc7c00e61470bd5ec5285d99ef586b59ad66d5ff90e9060b1361d837fe18cbc24