Split xmlsecurity components based on the config

One non-obvious hunk is the dependency of GPG based on NSS. While
it doesn't need NSS per-se, the signature validation code uses
NSS functions.

This is mainly an improvement / has the same origin then commit
1c6382b256 ("xmlsec: handle missing
EqualDistinguishedNames").

Change-Id: I12416139e1e391822d878c61b4ed06f3a409c334
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127913
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
This commit is contained in:
Jan-Marek Glogowski 2022-01-03 19:54:04 +01:00
parent 9f33f046f0
commit 13c6497512
9 changed files with 55 additions and 3 deletions

View file

@ -12346,7 +12346,8 @@ elif test "$enable_mpl_subset" = "yes"; then
AC_MSG_RESULT([no (MPL only])
elif test "$enable_fuzzers" = "yes"; then
AC_MSG_RESULT([no (oss-fuzz)])
elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
elif test \( \( "$_os" = "Linux" -o "$_os" = "Darwin" \) -a "$ENABLE_NSS" = TRUE \) -o "$_os" = "WINNT" ; then
AC_MSG_RESULT([yes])
dnl ===================================================================
dnl Check for system gpgme
dnl ===================================================================
@ -12422,7 +12423,7 @@ elif test "$_os" = "Linux" -o "$_os" = "Darwin" -o "$_os" = "WINNT" ; then
fi
fi
else
AC_MSG_RESULT([no (unsupported OS)])
AC_MSG_RESULT([no (unsupported OS or missing NSS)])
fi
AC_SUBST(ENABLE_GPGMEPP)
AC_SUBST(SYSTEM_GPGMEPP)

View file

@ -79,6 +79,8 @@ $(eval $(call gb_Library_add_exception_objects,xmlsecurity,\
xmlsecurity/source/helper/xmlsignaturehelper \
xmlsecurity/source/helper/xsecverify \
))
$(eval $(call gb_Library_add_componentimpl,xmlsecurity,dds))
endif
$(eval $(call gb_Library_use_externals,xmlsecurity,\

View file

@ -11,6 +11,12 @@ $(eval $(call gb_Library_Library,xsec_xmlsec))
$(eval $(call gb_Library_set_componentfile,xsec_xmlsec,xmlsecurity/util/xsec_xmlsec,services))
$(eval $(call gb_Library_add_componentimpls,xsec_xmlsec, \
$(if $(ENABLE_GPGMEPP),gpg) \
$(if $(or $(ENABLE_NSS),$(filter WNT,$(OS))),nss_mscrypt) \
$(if $(ENABLE_NSS),nss) \
))
$(eval $(call gb_Library_set_include,xsec_xmlsec,\
$$(INCLUDE) \
-I$(SRCDIR)/xmlsecurity/inc \
@ -126,13 +132,18 @@ else # !$(OS),WNT
ifeq ($(SYSTEM_XMLSEC),)
$(eval $(call gb_Library_add_libs,xsec_xmlsec,\
$(call gb_UnpackedTarball_get_dir,xmlsec)/src/nss/.libs/libxmlsec1-nss.a \
$(call gb_UnpackedTarball_get_dir,xmlsec)/src/.libs/libxmlsec1.a \
))
endif
ifeq ($(ENABLE_NSS),TRUE)
ifeq ($(SYSTEM_XMLSEC),)
$(eval $(call gb_Library_add_libs,xsec_xmlsec,\
$(call gb_UnpackedTarball_get_dir,xmlsec)/src/nss/.libs/libxmlsec1-nss.a \
))
endif
$(eval $(call gb_Library_add_exception_objects,xsec_xmlsec,\
xmlsecurity/source/xmlsec/nss/ciphercontext \
xmlsecurity/source/xmlsec/nss/digestcontext \

View file

@ -26,5 +26,6 @@
<implementation name="com.sun.star.security.DocumentDigitalSignatures"
constructor="com_sun_star_security_DocumentDigitalSignatures_get_implementation">
<service name="com.sun.star.security.DocumentDigitalSignatures"/>
<optional/>
</implementation>
</component>

View file

@ -0,0 +1,7 @@
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
com.sun.star.security.DocumentDigitalSignatures

View file

@ -22,18 +22,22 @@
<implementation name="com.sun.star.xml.crypto.NSSInitializer"
constructor="com_sun_star_xml_crypto_NSSInitializer_get_implementation">
<service name="com.sun.star.xml.crypto.NSSInitializer"/>
<optional/>
</implementation>
<implementation name="com.sun.star.xml.crypto.SEInitializer"
constructor="com_sun_star_xml_crypto_SEInitializer_get_implementation">
<service name="com.sun.star.xml.crypto.SEInitializer"/>
<optional/>
</implementation>
<implementation name="com.sun.star.xml.security.SEInitializer_Gpg"
constructor="com_sun_star_xml_security_SEInitializer_Gpg_get_implementation">
<service name="com.sun.star.xml.crypto.GPGSEInitializer"/>
<optional/>
</implementation>
<implementation name="com.sun.star.xml.crypto.SecurityEnvironment"
constructor="com_sun_star_xml_crypto_SecurityEnvironment_get_implementation">
<service name="com.sun.star.xml.crypto.SecurityEnvironment"/>
<optional/>
</implementation>
<implementation name="com.sun.star.xml.wrapper.XMLDocumentWrapper"
constructor="com_sun_star_xml_wrapper_XMLDocumentWrapper_get_implementation">
@ -46,9 +50,11 @@
<implementation name="com.sun.star.xml.crypto.XMLSecurityContext"
constructor="com_sun_star_xml_crypto_XMLSecurityContext_get_implementation">
<service name="com.sun.star.xml.crypto.XMLSecurityContext"/>
<optional/>
</implementation>
<implementation name="com.sun.star.xml.crypto.XMLSignature"
constructor="com_sun_star_xml_crypto_XMLSignature_get_implementation">
<service name="com.sun.star.xml.crypto.XMLSignature"/>
<optional/>
</implementation>
</component>

View file

@ -0,0 +1,7 @@
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
com.sun.star.xml.security.SEInitializer_Gpg

View file

@ -0,0 +1,7 @@
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
com.sun.star.xml.crypto.NSSInitializer

View file

@ -0,0 +1,10 @@
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
com.sun.star.xml.crypto.SecurityEnvironment
com.sun.star.xml.crypto.SEInitializer
com.sun.star.xml.crypto.XMLSecurityContext
com.sun.star.xml.crypto.XMLSignature