Kaydet (Commit) 511ae02c authored tarafından Gautam Prajapati's avatar Gautam Prajapati Kaydeden (comit) Miklos Vajna

Android: Enable HAVE_FEATURE_NSS and package the NSS libraries with apk

This commit enables HAVE_FEATURE_NSS for Android and fixes the svl/ vcl/
and xmlsecurity/ module to use NSS.

xmlsecurity/ wasn't built for Android previously, this commit enables
building xmlsecurity/ for Android and disables the support of gpgme
in the same module(Only for Android).

It also enables the linking of NSS shared libraries with
liblo-native-code.so and adds a rule to package them along with the apk.

Change-Id: I7d0341688ac979ae92e9145c37dd107670417fe1
Reviewed-on: https://gerrit.libreoffice.org/41308Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst f8fa4631
......@@ -3268,12 +3268,6 @@ endif # USING_X11
gb_ExternalProject__use_nss3:=
ifeq ($(OS),ANDROID)
gb_LinkTarget__use_nss3:=
gb_LinkTarget__use_plc4:=
else
ifneq ($(SYSTEM_NSS),)
......@@ -3369,8 +3363,6 @@ endef
endif # SYSTEM_NSS
endif # DESKTOP
ifeq ($(ENABLE_BREAKPAD),TRUE)
define gb_LinkTarget__use_breakpad
......
......@@ -35,10 +35,24 @@ LIBS = \
$(ALL_STATIC_LIBS) \
-Wl,--end-group
NSSLIBS = freebl3 \
nspr4 \
nss3 \
nssckbi \
nssdbm3 \
nssutil3 \
plc4 \
plds4 \
smime3 \
softokn3 \
sqlite3 \
ssl3 \
WHOLELIBS = \
-Wl,--whole-archive \
$(addprefix -l,$(strip \
juh \
$(NSSLIBS) \
)) \
-Wl,--no-whole-archive
......@@ -53,7 +67,11 @@ $(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
$(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so
#to keep some symbols, eg.: $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so -w -K 'Java*'
link-so: $(SODEST)/liblo-native-code.so
$(SODEST)/nss-libraries :
mkdir -p $(SODEST)
$(foreach lib,$(NSSLIBS),$(STRIP) -o $(SODEST)/lib$(lib).so $(INSTDIR)/$(LIBO_LIB_FOLDER)/lib$(lib).so;)
link-so: $(SODEST)/liblo-native-code.so $(SODEST)/nss-libraries
# If you reinstall an app several times *on the emulator*, even if you
# uninstall it between, disk space seems to leak that won't get recycled until
......
......@@ -41,6 +41,8 @@ ANDROID)
oslibs="$oslibs $WORKDIR/UnpackedTarball/freetype/objs/.libs/libfreetype.a"
oslibs="$oslibs $WORKDIR/UnpackedTarball/pixman/pixman/.libs/libpixman-1.a"
oslibs="$oslibs $WORKDIR/UnpackedTarball/cairo/src/.libs/libcairo.a"
oslibs="$oslibs $WORKDIR/UnpackedTarball/xmlsec/src/.libs/libxmlsec1.a"
oslibs="$oslibs $WORKDIR/UnpackedTarball/xmlsec/src/nss/.libs/libxmlsec1-nss.a"
# Only liblo-bootstrap.a ends up here:
oslibs="$oslibs $WORKDIR/LinkTarget/Library/lib*.a"
oslibs="$oslibs $WORKDIR/UnpackedTarball/openssl/*.a"
......
......@@ -8816,7 +8816,7 @@ AC_SUBST(SYSTEM_OPENLDAP)
dnl ===================================================================
dnl Check for system NSS
dnl ===================================================================
if test $_os != iOS -a $_os != Android -a "$enable_fuzzers" != "yes"; then
if test $_os != iOS -a "$enable_fuzzers" != "yes"; then
libo_CHECK_SYSTEM_MODULE([nss],[NSS],[nss >= 3.9.3 nspr >= 4.8])
AC_DEFINE(HAVE_FEATURE_NSS)
ENABLE_NSS="TRUE"
......
......@@ -21,7 +21,7 @@ $(eval $(call gb_Library_Library,svl))
$(eval $(call gb_Library_use_externals,svl,\
boost_headers \
$(if $(filter LINUX MACOSX %BSD SOLARIS,$(OS)), \
$(if $(filter LINUX MACOSX ANDROID %BSD SOLARIS,$(OS)), \
curl) \
icu_headers \
icuuc \
......@@ -103,7 +103,7 @@ $(eval $(call gb_Library_use_system_win32_libs,svl,\
crypt32 \
))
else
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
ifneq (,$(filter DESKTOP,$(BUILD_TYPE))$(filter ANDROID,$(OS)))
$(eval $(call gb_Library_add_defs,svl,\
-DSVL_CRYPTO_NSS \
))
......
......@@ -252,6 +252,9 @@ const SEC_ASN1Template IssuerSerialTemplate[] =
* issuerSerial IssuerSerial OPTIONAL
* }
*/
SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate)
const SEC_ASN1Template ESSCertIDv2Template[] =
{
{SEC_ASN1_SEQUENCE, 0, nullptr, sizeof(ESSCertIDv2)},
......
......@@ -56,7 +56,7 @@ $(eval $(call gb_Library_use_custom_headers,vcl,\
))
$(eval $(call gb_Library_use_externals,vcl,\
$(if $(filter LINUX MACOSX %BSD SOLARIS,$(OS)), \
$(if $(filter LINUX MACOSX ANDROID %BSD SOLARIS,$(OS)), \
curl) \
jpeg \
libeot \
......
......@@ -79,7 +79,7 @@ $(eval $(call gb_Library_use_system_win32_libs,xmlsecurity,\
crypt32 \
))
else
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
ifneq (,$(filter DESKTOP,$(BUILD_TYPE))$(filter ANDROID,$(OS)))
$(eval $(call gb_Library_add_defs,xmlsecurity,\
-DXMLSEC_CRYPTO_NSS \
))
......
......@@ -126,13 +126,6 @@ $(eval $(call gb_Library_add_defs,xsec_xmlsec,\
-DXMLSEC_CRYPTO_NSS \
))
ifeq ($(OS),ANDROID)
$(eval $(call gb_Library_add_libs,xsec_xmlsec,\
$(call gb_UnpackedTarball_get_dir,xmlsec)/src/openssl/.libs/libxmlsec1-openssl.a \
$(call gb_UnpackedTarball_get_dir,xmlsec)/src/.libs/libxmlsec1.a \
))
else
ifeq ($(SYSTEM_XMLSEC),)
$(eval $(call gb_Library_add_libs,xsec_xmlsec,\
$(call gb_UnpackedTarball_get_dir,xmlsec)/src/nss/.libs/libxmlsec1-nss.a \
......@@ -140,8 +133,6 @@ $(eval $(call gb_Library_add_libs,xsec_xmlsec,\
))
endif
endif
$(eval $(call gb_Library_use_externals,xsec_xmlsec,\
plc4 \
))
......
......@@ -10,8 +10,6 @@
$(eval $(call gb_Module_Module,xmlsecurity))
ifeq ($(ENABLE_NSS),TRUE)
#FIXME: ^^^, get nss&libxmlsec building on ios and android
#chromium has patches to build statically FWIW
$(eval $(call gb_Module_add_targets,xmlsecurity,\
Library_xmlsecurity \
......
......@@ -64,14 +64,14 @@ bool DocumentSignatureManager::init()
initXmlSec();
mxSEInitializer = xml::crypto::SEInitializer::create(mxContext);
#if !defined(MACOSX) && !defined(WNT)
#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
mxGpgSEInitializer.set(new SEInitializerGpg());
#endif
if (mxSEInitializer.is())
mxSecurityContext = mxSEInitializer->createSecurityContext(OUString());
#if !defined(MACOSX) && !defined(WNT)
#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
if (mxGpgSEInitializer.is())
mxGpgSecurityContext = mxGpgSEInitializer->createSecurityContext(OUString());
......
......@@ -22,7 +22,7 @@
#include "documentsignaturehelper.hxx"
#include "framework/saxeventkeeperimpl.hxx"
#include "xmlsec/xmldocumentwrapper_xmlsecimpl.hxx"
#if !defined(MACOSX) && !defined(WNT)
#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
# include "gpg/xmlsignature_gpgimpl.hxx"
#endif
......@@ -127,7 +127,7 @@ void XSecController::createXSecComponent( )
cssu::Reference< cssl::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() );
#if !defined(MACOSX) && !defined(WNT)
#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
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());
......
......@@ -110,7 +110,7 @@ void XSecController::addSignature()
void XSecController::switchGpgSignature()
{
#if !defined(MACOSX) && !defined(WNT)
#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
// swap signature verifier for the Gpg one
m_xXMLSignature.set(new XMLSignature_GpgImpl());
if (!m_vInternalSignatureInformations.empty())
......
......@@ -27,7 +27,7 @@
#include "xmlsec/xmldocumentwrapper_xmlsecimpl.hxx"
#include "xsec_xmlsec.hxx"
#if !defined(MACOSX) && !defined(WNT)
#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
# include "gpg/xmlsignature_gpgimpl.hxx"
#endif
......@@ -44,7 +44,7 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_xmlsec_component_getFactory( const sal_
Reference< XInterface > xFactory ;
if( pImplName != nullptr ) {
#if !defined(MACOSX) && !defined(WNT)
#if !defined(MACOSX) && !defined(WNT) && !defined(ANDROID)
if( XMLSignature_GpgImpl::impl_getImplementationName().equalsAscii( pImplName ) )
{
xFactory = XMLSignature_GpgImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment