[Libreoffice-commits] core.git: config_host/config_gpgme.h.in configure.ac xmlsecurity/source

Thorsten Behrens thorsten.behrens at cib.de
Thu Nov 23 11:14:14 UTC 2017


 config_host/config_gpgme.h.in                          |    3 +++
 configure.ac                                           |    1 +
 xmlsecurity/source/helper/documentsignaturemanager.cxx |    6 ++++--
 xmlsecurity/source/helper/xsecctl.cxx                  |    5 +++--
 xmlsecurity/source/helper/xsecverify.cxx               |    3 ++-
 xmlsecurity/source/xmlsec/xsec_xmlsec.cxx              |    5 +++--
 6 files changed, 16 insertions(+), 7 deletions(-)

New commits:
commit 43ac50dcccdf4f1954e666d6b18452b37a19d31e
Author: Thorsten Behrens <thorsten.behrens at cib.de>
Date:   Wed Nov 22 19:06:26 2017 +0100

    gpg4libre: conditional-compile gpgme code
    
    Change-Id: I1d139a7b6df271d61bedd107c6b3a0535d233606
    Reviewed-on: https://gerrit.libreoffice.org/45124
    Reviewed-by: Siegmund Gorr <siegmund.gorr at cib.de>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/config_host/config_gpgme.h.in b/config_host/config_gpgme.h.in
index 50f9edd8f8a0..86f3f07931f6 100644
--- a/config_host/config_gpgme.h.in
+++ b/config_host/config_gpgme.h.in
@@ -10,6 +10,9 @@
 /* Configuration for gpgme++.
  */
 
+// Defined if gpgme support is available
+#define GPGME_HAVE_GPGME 0
+
 // Defined if gpgme supports exporting minimal key.
 #define GPGME_CAN_EXPORT_MINIMAL_KEY 0
 
diff --git a/configure.ac b/configure.ac
index d36e75b472b6..8e0822caac64 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10169,6 +10169,7 @@ if test "$_os" = "Linux" -o "$_os" = "Darwin" \
             LIBASSUAN_LIBS="-L${WORKDIR}/UnpackedTarball/libassuan/src/.libs -lassuan"
         fi
     fi
+    AC_DEFINE([GPGME_HAVE_GPGME])
 fi
 AC_SUBST(SYSTEM_GPGMEPP)
 AC_SUBST(GPG_ERROR_CFLAGS)
diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx b/xmlsecurity/source/helper/documentsignaturemanager.cxx
index 78ce27d18dae..7cfeb2728ae8 100644
--- a/xmlsecurity/source/helper/documentsignaturemanager.cxx
+++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_gpgme.h>
+
 #include <documentsignaturemanager.hxx>
 #include <gpg/SEInitializer.hxx>
 
@@ -64,14 +66,14 @@ bool DocumentSignatureManager::init()
     initXmlSec();
 
     mxSEInitializer = xml::crypto::SEInitializer::create(mxContext);
-#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
+#if GPGME_HAVE_GPGME
     mxGpgSEInitializer.set(new SEInitializerGpg());
 #endif
 
     if (mxSEInitializer.is())
         mxSecurityContext = mxSEInitializer->createSecurityContext(OUString());
 
-#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
+#if GPGME_HAVE_GPGME
     if (mxGpgSEInitializer.is())
         mxGpgSecurityContext = mxGpgSEInitializer->createSecurityContext(OUString());
 
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index a64883d842b1..c746f8012f95 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -17,12 +17,13 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_gpgme.h>
 
 #include <xsecctl.hxx>
 #include <documentsignaturehelper.hxx>
 #include <framework/saxeventkeeperimpl.hxx>
 #include <xmlsec/xmldocumentwrapper_xmlsecimpl.hxx>
-#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
+#if GPGME_HAVE_GPGME
 # include <gpg/xmlsignature_gpgimpl.hxx>
 #endif
 
@@ -160,7 +161,7 @@ void XSecController::createXSecComponent( )
 
     cssu::Reference< cssl::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() );
 
-#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
+#if GPGME_HAVE_GPGME
     uno::Reference< lang::XServiceInfo > xServiceInfo( m_xSecurityContext, cssu::UNO_QUERY );
     if (xServiceInfo->getImplementationName() == "com.sun.star.xml.security.gpg.XMLSecurityContext_GpgImpl")
         m_xXMLSignature.set(new XMLSignature_GpgImpl());
diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx
index 72474337a7e7..707527d3acdb 100644
--- a/xmlsecurity/source/helper/xsecverify.cxx
+++ b/xmlsecurity/source/helper/xsecverify.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_gpgme.h>
 
 #include <xsecctl.hxx>
 #include "xsecparser.hxx"
@@ -119,7 +120,7 @@ void XSecController::addSignature()
 
 void XSecController::switchGpgSignature()
 {
-#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
+#if GPGME_HAVE_GPGME
     // swap signature verifier for the Gpg one
     m_xXMLSignature.set(new XMLSignature_GpgImpl());
     if (!m_vInternalSignatureInformations.empty())
diff --git a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
index 807eff2cddee..265ab2f8f960 100644
--- a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
+++ b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx
@@ -27,7 +27,8 @@
 #include <xmlsec/xmldocumentwrapper_xmlsecimpl.hxx>
 #include "xsec_xmlsec.hxx"
 
-#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
+#include <config_gpgme.h>
+#if GPGME_HAVE_GPGME
 # include <gpg/xmlsignature_gpgimpl.hxx>
 #endif
 
@@ -44,7 +45,7 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_xmlsec_component_getFactory( const sal_
     Reference< XInterface > xFactory ;
 
     if( pImplName != nullptr ) {
-#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
+#if GPGME_HAVE_GPGME
         if( XMLSignature_GpgImpl::impl_getImplementationName().equalsAscii( pImplName ) )
         {
             xFactory = XMLSignature_GpgImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;


More information about the Libreoffice-commits mailing list