[Libreoffice-commits] core.git: xmlsecurity/source xmlsecurity/uiconfig

2023-08-23 Thread TokieSan (via logerrit)
 xmlsecurity/source/dialogs/certificatechooser.cxx  |   17 ++---
 xmlsecurity/uiconfig/ui/selectcertificatedialog.ui |   36 -
 2 files changed, 5 insertions(+), 48 deletions(-)

New commits:
commit 9f327102c435887bbae650b3a573f44500b6f534
Author: TokieSan 
AuthorDate: Thu Aug 10 04:05:23 2023 +0300
Commit: Heiko Tietze 
CommitDate: Wed Aug 23 08:42:27 2023 +0200

Removed Type and Usage Columns from Certificate Chooser

Both columns are irrelevant in the main dialog's view, can be viewed
through viewing certificate's details.

Change-Id: I265a7e125c2679f3a05dba4414f4104f3a5cac2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155746
Tested-by: Jenkins
Reviewed-by: Heiko Tietze 

diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx 
b/xmlsecurity/source/dialogs/certificatechooser.cxx
index c7f055deea16..be3e88f9d453 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -57,14 +57,6 @@ CertificateChooser::CertificateChooser(weld::Window* 
_pParent,
 m_xCertLB->set_size_request(nControlWidth, m_xCertLB->get_height_rows(12));
 m_xCertLB->make_sorted();
 
-std::vector aWidths
-{
-o3tl::narrowing(30*nControlWidth/100),
-o3tl::narrowing(30*nControlWidth/100),
-o3tl::narrowing(10*nControlWidth/100),
-o3tl::narrowing(20*nControlWidth/100)
-};
-m_xCertLB->set_column_fixed_widths(aWidths);
 m_xCertLB->connect_changed( LINK( this, CertificateChooser, 
CertificateHighlightHdl ) );
 m_xCertLB->connect_row_activated( LINK( this, CertificateChooser, 
CertificateSelectHdl ) );
 m_xViewBtn->connect_clicked( LINK( this, CertificateChooser, ViewButtonHdl 
) );
@@ -225,6 +217,7 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
 mvUserData.push_back(userData);
 
 OUString sIssuer = xmlsec::GetContentPart( xCert->getIssuerName(), 
xCert->getCertificateKind());
+OUString sExpDate = utl::GetDateString(xCert->getNotValidAfter());
 
 // If we are searching and there is no match skip
 if (mbSearch
@@ -235,13 +228,11 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
 
 m_xCertLB->append();
 int nRow = m_xCertLB->n_children() - 1;
-m_xCertLB->set_text(nRow, 
xmlsec::GetContentPart(xCert->getSubjectName(), xCert->getCertificateKind()), 
0);
-m_xCertLB->set_text(nRow, sIssuer, 1);
-m_xCertLB->set_text(nRow, 
xmlsec::GetCertificateKind(xCert->getCertificateKind()), 2);
-m_xCertLB->set_text(nRow, 
utl::GetDateString(xCert->getNotValidAfter()), 3);
-m_xCertLB->set_text(nRow, 
UsageInClearText(xCert->getCertificateUsage()), 4);
 OUString sId(weld::toId(userData.get()));
 m_xCertLB->set_id(nRow, sId);
+m_xCertLB->set_text(nRow, 
xmlsec::GetContentPart(xCert->getSubjectName(), xCert->getCertificateKind()), 
0);
+m_xCertLB->set_text(nRow, sIssuer, 1);
+m_xCertLB->set_text(nRow, sExpDate, 2);
 
 #if HAVE_FEATURE_GPGME
 // only GPG has preferred keys
diff --git a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui 
b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
index b6fb9a9c5610..e476a7ddd61a 100644
--- a/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
+++ b/xmlsecurity/uiconfig/ui/selectcertificatedialog.ui
@@ -8,12 +8,8 @@
   
   
   
-  
-  
   
   
-  
-  
   
   
 
@@ -172,7 +168,7 @@
   
 True
 6
-Type
+Expiration date
 True
 2
 
@@ -183,36 +179,6 @@
 
   
 
-
-  
-True
-6
-Expiration date
-True
-3
-
-  
-  
-3
-  
-
-  
-
-
-  
-True
-6
-Certificate usage
-True
-4
-
-  
-  
-4
-  
-
-  
-
 
   
 Select the 
certificate that you want to digitally sign the current document 
with.


[Libreoffice-commits] core.git: xmlsecurity/source

2023-08-07 Thread Arnaud VERSINI (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |  112 +++--
 1 file changed, 48 insertions(+), 64 deletions(-)

New commits:
commit 127a55391c90e8503aa1007c35d8f683a4b8acbc
Author: Arnaud VERSINI 
AuthorDate: Sun Jul 16 17:06:54 2023 +0200
Commit: Arnaud Versini 
CommitDate: Mon Aug 7 11:28:40 2023 +0200

xmlsecurity : simplify DigitalSignaturesDialog

Change-Id: I460d56a5a13dde1bd77f21e0bb6467dd00cb3f40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154498
Tested-by: Jenkins
Reviewed-by: Arnaud Versini 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 4c8c2fea56b7..4e29cbf836d2 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -110,29 +110,21 @@ namespace
 nullptr );
 }
 
-std::vector& GetGUIServers()
-{
-
 #ifdef _WIN32
-static std::vector aGUIServers
-= { u"Gpg4win\\kleopatra.exe",
-u"Gpg4win\\bin\\kleopatra.exe",
-u"GNU\\GnuPG\\kleopatra.exe",
-u"GNU\\GnuPG\\launch-gpa.exe",
-u"GNU\\GnuPG\\gpa.exe",
-u"GnuPG\\bin\\gpa.exe",
-u"GNU\\GnuPG\\bin\\kleopatra.exe",
-u"GNU\\GnuPG\\bin\\launch-gpa.exe",
-u"GNU\\GnuPG\\bin\\gpa.exe",
-
officecfg::Office::Common::Security::Scripting::CertMgrPath::get() };
+constexpr std::u16string_view aGUIServers[]
+= { u"Gpg4win\\kleopatra.exe",
+u"Gpg4win\\bin\\kleopatra.exe",
+u"GNU\\GnuPG\\kleopatra.exe",
+u"GNU\\GnuPG\\launch-gpa.exe",
+u"GNU\\GnuPG\\gpa.exe",
+u"GnuPG\\bin\\gpa.exe",
+u"GNU\\GnuPG\\bin\\kleopatra.exe",
+u"GNU\\GnuPG\\bin\\launch-gpa.exe",
+u"GNU\\GnuPG\\bin\\gpa.exe"};
 #else
-static std::vector aGUIServers
-= { u"kleopatra", u"seahorse", u"gpa", u"kgpg",
-
officecfg::Office::Common::Security::Scripting::CertMgrPath::get() };
+constexpr std::u16string_view aGUIServers[]
+= { u"kleopatra", u"seahorse", u"gpa", u"kgpg"};
 #endif
-return aGUIServers;
-}
-
 }
 
 DigitalSignaturesDialog::DigitalSignaturesDialog(
@@ -272,16 +264,14 @@ bool DigitalSignaturesDialog::canAddRemove()
 {
 //FIXME: this func needs some cleanup, such as real split between
 //'canAdd' and 'canRemove' case
-bool ret = true;
-
 uno::Reference xNameAccess = 
maSignatureManager.getStore();
 if (xNameAccess.is() && xNameAccess->hasByName("[Content_Types].xml"))
 // It's always possible to append an OOXML signature.
-return ret;
+return true;
 
 if (!maSignatureManager.getStore().is())
 // It's always possible to append a PDF signature.
-return ret;
+return true;
 
 OSL_ASSERT(maSignatureManager.getStore().is());
 bool bDoc1_1 = DocumentSignatureHelper::isODFPre_1_2(m_sODFVersion);
@@ -298,14 +288,13 @@ bool DigitalSignaturesDialog::canAddRemove()
   VclMessageType::Warning, 
VclButtonsType::Ok,
   
XsResId(STR_XMLSECDLG_OLD_ODF_FORMAT)));
 xBox->run();
-ret = false;
+return false;
 }
 
 //As of OOo 3.2 the document signature includes in macrosignatures.xml. 
That is
 //adding a macro signature will break an existing document signature.
 //The sfx2 will remove the documentsignature when the user adds a macro 
signature
-if (maSignatureManager.getSignatureMode() == DocumentSignatureMode::Macros
-&& ret)
+if (maSignatureManager.getSignatureMode() == DocumentSignatureMode::Macros)
 {
 if (m_bHasDocumentSignature && !m_bWarningShowSignMacro)
 {
@@ -318,12 +307,12 @@ bool DigitalSignaturesDialog::canAddRemove()
 m_xDialog.get(), VclMessageType::Question, 
VclButtonsType::YesNo,
 XsResId(STR_XMLSECDLG_QUERY_REMOVEDOCSIGNBEFORESIGN)));
 if (xBox->run() == RET_NO)
-ret = false;
-else
-m_bWarningShowSignMacro = true;
+return false;
+
+m_bWarningShowSignMacro = true;
 }
 }
-return ret;
+return true;
 }
 
 bool DigitalSignaturesDialog::canAdd() { return canAddRemove(); }
@@ -517,44 +506,36 @@ bool DigitalSignaturesDialog::GetPathAllOS(OUString& 
aPath)
 void DigitalSignaturesDialog::GetCertificateManager(OUString& aPath, OUString& 
sExecutable,
 OUString& sFoundGUIServer)
 {
-GetGUIServers().pop_back();
-
GetGUIServers().push_back(officecfg::Office::Common::Security::Scripting::CertMgrPath::get());
-
-for (auto it = GetGUIServers().rbegin(); it != GetGUIServers().rend(); 
++it)
+OUString 

[Libreoffice-commits] core.git: xmlsecurity/source

2023-07-17 Thread Arnaud VERSINI (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

New commits:
commit d22ab7b444a4e16dc2bd1f7d15fa36a848eaaaed
Author: Arnaud VERSINI 
AuthorDate: Mon Jul 10 21:26:15 2023 +0200
Commit: Arnaud Versini 
CommitDate: Mon Jul 17 10:58:27 2023 +0200

xmlsecurity : simplify DigitalSignaturesDialog::canAddRemove.

(!a && b) || (a && b) => b

Change-Id: Iee9ae38d9dc5f6aa94eaff61b3937633f5da7af1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154285
Tested-by: Jenkins
Reviewed-by: Arnaud Versini 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 9a6222c59e1e..2e14e609773f 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -91,11 +91,6 @@ namespace
 public:
 virtual void Notify( const css::uno::Sequence< OUString >& aPropertyNames 
) override;
 SaveODFItem();
-//See group ODF in Common.xcs
-bool isLessODF1_2() const
-{
-return m_nODF < 3;
-}
 };
 
 void SaveODFItem::ImplCommit() {}
@@ -295,13 +290,12 @@ bool DigitalSignaturesDialog::canAddRemove()
 OSL_ASSERT(maSignatureManager.getStore().is());
 bool bDoc1_1 = DocumentSignatureHelper::isODFPre_1_2(m_sODFVersion);
 SaveODFItem item;
-bool bSave1_1 = item.isLessODF1_2();
 
 // see specification
 //cvs: specs/www/appwide/security/Electronic_Signatures_and_Security.sxw
 //Paragraph 'Behavior with regard to ODF 1.2'
 //For both, macro and document
-if ( (!bSave1_1  && bDoc1_1) || (bSave1_1 && bDoc1_1) )
+if ( bDoc1_1 )
 {
 //#4
 std::unique_ptr 
xBox(Application::CreateMessageDialog(m_xDialog.get(),


[Libreoffice-commits] core.git: xmlsecurity/source

2023-07-12 Thread Miklos Vajna (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   44 +
 1 file changed, 25 insertions(+), 19 deletions(-)

New commits:
commit a0471ec6e9a000a4985af2ad2967498c71004085
Author: Miklos Vajna 
AuthorDate: Wed Jul 12 14:34:43 2023 +0200
Commit: Miklos Vajna 
CommitDate: Wed Jul 12 15:41:26 2023 +0200

xmlsecurity: fix deadlock on preloading libsdlo.so

The trouble is that calling into the configmgr would require recursive
access to the service manager, but that's protected by a non-recursive
mutex.

See


for details.

Change-Id: If75779a995c2ad8855073bd6538832a18953d4cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154356
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 7ce82fd9f943..9a6222c59e1e 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -118,23 +118,29 @@ namespace
 
 m_nODF = nTmp;
 }
+
+std::vector& GetGUIServers()
+{
+
 #ifdef _WIN32
-std::vector aGUIServers
-= { u"Gpg4win\\kleopatra.exe",
-u"Gpg4win\\bin\\kleopatra.exe",
-u"GNU\\GnuPG\\kleopatra.exe",
-u"GNU\\GnuPG\\launch-gpa.exe",
-u"GNU\\GnuPG\\gpa.exe",
-u"GnuPG\\bin\\gpa.exe",
-u"GNU\\GnuPG\\bin\\kleopatra.exe",
-u"GNU\\GnuPG\\bin\\launch-gpa.exe",
-u"GNU\\GnuPG\\bin\\gpa.exe",
-officecfg::Office::Common::Security::Scripting::CertMgrPath::get() };
+static std::vector aGUIServers
+= { u"Gpg4win\\kleopatra.exe",
+u"Gpg4win\\bin\\kleopatra.exe",
+u"GNU\\GnuPG\\kleopatra.exe",
+u"GNU\\GnuPG\\launch-gpa.exe",
+u"GNU\\GnuPG\\gpa.exe",
+u"GnuPG\\bin\\gpa.exe",
+u"GNU\\GnuPG\\bin\\kleopatra.exe",
+u"GNU\\GnuPG\\bin\\launch-gpa.exe",
+u"GNU\\GnuPG\\bin\\gpa.exe",
+
officecfg::Office::Common::Security::Scripting::CertMgrPath::get() };
 #else
-std::vector aGUIServers
-= { u"kleopatra", u"seahorse", u"gpa", u"kgpg",
-officecfg::Office::Common::Security::Scripting::CertMgrPath::get() };
+static std::vector aGUIServers
+= { u"kleopatra", u"seahorse", u"gpa", u"kgpg",
+
officecfg::Office::Common::Security::Scripting::CertMgrPath::get() };
 #endif
+return aGUIServers;
+}
 
 }
 
@@ -521,17 +527,17 @@ bool DigitalSignaturesDialog::GetPathAllOS(OUString& 
aPath)
 void DigitalSignaturesDialog::GetCertificateManager(OUString& aPath, OUString& 
sExecutable,
 OUString& sFoundGUIServer)
 {
-aGUIServers.pop_back();
-
aGUIServers.push_back(officecfg::Office::Common::Security::Scripting::CertMgrPath::get());
+GetGUIServers().pop_back();
+
GetGUIServers().push_back(officecfg::Office::Common::Security::Scripting::CertMgrPath::get());
 
-for (auto it = aGUIServers.rbegin(); it != aGUIServers.rend(); ++it)
+for (auto it = GetGUIServers().rbegin(); it != GetGUIServers().rend(); 
++it)
 {
 const auto& rServer = *it;
 
 if (rServer.empty())
 continue;
 
-bool bValidSetMgr = (it == aGUIServers.rbegin() && rServer.size() > 0);
+bool bValidSetMgr = (it == GetGUIServers().rbegin() && rServer.size() 
> 0);
 sal_Int32 nLastBackslashIndex = -1;
 
 if (bValidSetMgr)
@@ -549,7 +555,7 @@ void 
DigitalSignaturesDialog::GetCertificateManager(OUString& aPath, OUString& s
 if (searchError == osl::FileBase::E_None)
 {
 osl::File::getSystemPathFromFileURL(sFoundGUIServer, sExecutable);
-if (it != aGUIServers.rbegin())
+if (it != GetGUIServers().rbegin())
 {
 std::shared_ptr pBatch(
 comphelper::ConfigurationChanges::create());


[Libreoffice-commits] core.git: xmlsecurity/source

2023-07-07 Thread Arnaud VERSINI (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

New commits:
commit f57bb8bbadf086873155401445b03bdb971ecc6f
Author: Arnaud VERSINI 
AuthorDate: Sun Jul 2 22:07:15 2023 +0200
Commit: Arnaud Versini 
CommitDate: Fri Jul 7 07:59:51 2023 +0200

xmlsecurity : remove deadcode and usage of array template

Change-Id: I282e2af395471aa4818bfb4586ac06c7850c8a61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153862
Reviewed-by: Mike Kaganski 
Reviewed-by: Arnaud Versini 
Tested-by: Arnaud Versini 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 2a3cd3049a13..921dedbca49d 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -19,7 +19,6 @@
 
 #include 
 
-#include 
 #include 
 
 #include 
@@ -117,7 +116,7 @@ namespace
 m_nODF = nTmp;
 }
 #ifdef _WIN32
-constexpr std::array aGUIServers = { 
u"Gpg4win\\kleopatra.exe",
+constexpr std::u16string_view aGUIServers[]  = { u"Gpg4win\\kleopatra.exe",

u"Gpg4win\\bin\\kleopatra.exe",

u"GNU\\GnuPG\\kleopatra.exe",

u"GNU\\GnuPG\\launch-gpa.exe",
@@ -127,7 +126,7 @@ namespace

u"GNU\\GnuPG\\bin\\launch-gpa.exe",

u"GNU\\GnuPG\\bin\\gpa.exe"};
 #else
-constexpr std::array aGUIServers = { u"kleopatra", 
u"seahorse", u"gpa", u"kgpg" };
+constexpr std::u16string_view aGUIServers[] = { u"kleopatra", u"seahorse", 
u"gpa", u"kgpg" };
 #endif
 
 }
@@ -551,9 +550,6 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, 
weld::Button&, void)
 OUString aPath(cPath, strlen(cPath), osl_getThreadTextEncoding());
 #endif
 
-if (aGUIServers.empty())
-return;
-
 OUString sFoundGUIServer, sExecutable;
 
 for ( auto const  : aGUIServers)


[Libreoffice-commits] core.git: xmlsecurity/source

2023-06-25 Thread Arnaud VERSINI (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   18 ++---
 1 file changed, 7 insertions(+), 11 deletions(-)

New commits:
commit 66e25cfe4f50c142077a54f005d09cee2bb63dab
Author: Arnaud VERSINI 
AuthorDate: Sun Jun 25 20:13:36 2023 +0200
Commit: Noel Grandin 
CommitDate: Mon Jun 26 07:56:01 2023 +0200

xmlsecurity : remove unneccessary static variables

Change-Id: Ie7ecba234f33cc09ebd4cf5a390919acb4bc7e08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153567
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index ed73366234df..2a3cd3049a13 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -115,7 +116,8 @@ namespace
 
 m_nODF = nTmp;
 }
-const std::vector aGUIServersWindows = { 
u"Gpg4win\\kleopatra.exe",
+#ifdef _WIN32
+constexpr std::array aGUIServers = { 
u"Gpg4win\\kleopatra.exe",

u"Gpg4win\\bin\\kleopatra.exe",

u"GNU\\GnuPG\\kleopatra.exe",

u"GNU\\GnuPG\\launch-gpa.exe",
@@ -124,7 +126,10 @@ namespace

u"GNU\\GnuPG\\bin\\kleopatra.exe",

u"GNU\\GnuPG\\bin\\launch-gpa.exe",

u"GNU\\GnuPG\\bin\\gpa.exe"};
-const std::vector aGUIServersNix = { u"kleopatra", 
u"seahorse", u"gpa", u"kgpg" };
+#else
+constexpr std::array aGUIServers = { u"kleopatra", 
u"seahorse", u"gpa", u"kgpg" };
+#endif
+
 }
 
 DigitalSignaturesDialog::DigitalSignaturesDialog(
@@ -490,7 +495,6 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, RemoveButtonHdl, 
weld::Button&, void)
 
 bool DigitalSignaturesDialog::IsThereCertificateMgr()
 {
-static std::vector aGUIServers;
 #ifdef _WIN32
 static const OUString aPath = [] {
 sal::systools::CoTaskMemAllocated sPath;
@@ -502,18 +506,13 @@ bool DigitalSignaturesDialog::IsThereCertificateMgr()
 }();
 if (aPath.isEmpty())
 return false;
-aGUIServers = aGUIServersWindows;
 #else
 const char* cPath = getenv("PATH");
 if (!cPath)
 return false;
 OUString aPath(cPath, strlen(cPath), osl_getThreadTextEncoding());
-aGUIServers = aGUIServersNix;
 #endif
 
-if (aGUIServers.empty())
-return false;
-
 OUString sFoundGUIServer, sExecutable;
 
 for ( auto const  : aGUIServers )
@@ -531,7 +530,6 @@ bool DigitalSignaturesDialog::IsThereCertificateMgr()
 
 IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, weld::Button&, void)
 {
-static std::vector aGUIServers;
 #ifdef _WIN32
 // FIXME: call GpgME::dirInfo("bindir") somewhere in
 // SecurityEnvironmentGpg or whatnot
@@ -546,13 +544,11 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, 
CertMgrButtonHdl, weld::Button&, void)
 }();
 if (aPath.isEmpty())
 return;
-aGUIServers = aGUIServersWindows;
 #else
 const char* cPath = getenv("PATH");
 if (!cPath)
 return;
 OUString aPath(cPath, strlen(cPath), osl_getThreadTextEncoding());
-aGUIServers = aGUIServersNix;
 #endif
 
 if (aGUIServers.empty())


[Libreoffice-commits] core.git: xmlsecurity/source

2023-04-17 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 1ccb5a63cd3f16f46c3d8cb7d86374805705804d
Author: Stephan Bergmann 
AuthorDate: Mon Apr 17 09:25:05 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Apr 17 16:11:59 2023 +0200

loplugin:stringadd

Change-Id: I3bbb2df7b77ab971553b646690806385e5dea75d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150482
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index 9c671d0c21c0..bd4ef701e6ed 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -690,8 +690,7 @@ static OUString CompatDNNSS(OUString const& rDN)
 {
 if (rDN[i] == '+' || rDN[i] == ',' || rDN[i] == ';')
 {
-buf.append('"');
-buf.append(rDN[i]);
+buf.append("\"" + OUStringChar(rDN[i]));
 state = DEFAULT;
 }
 else if (rDN[i] == '\\')


[Libreoffice-commits] core.git: xmlsecurity/source

2023-01-14 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/gpg/CertificateImpl.cxx |   13 -
 xmlsecurity/source/gpg/CertificateImpl.hxx |7 ---
 xmlsecurity/source/gpg/SecurityEnvironment.cxx |4 ++--
 3 files changed, 2 insertions(+), 22 deletions(-)

New commits:
commit 748ab2f420caafa6739cc5bb41d5cc04bf91
Author: Noel Grandin 
AuthorDate: Fri Jan 13 09:20:39 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 14 17:24:33 2023 +

XUnoTunnel->dynamic_cast in CertificateImpl

Change-Id: I31c03fd894691681401e2ea104ba0d45c95a3c3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145502
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx 
b/xmlsecurity/source/gpg/CertificateImpl.cxx
index a0a08fc807a8..b771c1282fa0 100644
--- a/xmlsecurity/source/gpg/CertificateImpl.cxx
+++ b/xmlsecurity/source/gpg/CertificateImpl.cxx
@@ -193,19 +193,6 @@ sal_Int32 SAL_CALL CertificateImpl::getCertificateUsage()
 return KeyUsage::DIGITAL_SIGNATURE | KeyUsage::NON_REPUDIATION  | 
KeyUsage::KEY_ENCIPHERMENT | KeyUsage::DATA_ENCIPHERMENT;
 }
 
-/* XUnoTunnel */
-sal_Int64 SAL_CALL CertificateImpl::getSomething(const Sequence< sal_Int8 >& 
aIdentifier)
-{
-return comphelper::getSomethingImpl(aIdentifier, this);
-}
-
-/* XUnoTunnel extension */
-
-const Sequence< sal_Int8>& CertificateImpl::getUnoTunnelId() {
-static const comphelper::UnoIdInit theCertificateImplUnoTunnelId;
-return theCertificateImplUnoTunnelId.getSeq();
-}
-
 void CertificateImpl::setCertificate(GpgME::Context* ctx, const GpgME::Key& 
key)
 {
 m_pKey = key;
diff --git a/xmlsecurity/source/gpg/CertificateImpl.hxx 
b/xmlsecurity/source/gpg/CertificateImpl.hxx
index b6c50cb2ed5c..b0856ca0109f 100644
--- a/xmlsecurity/source/gpg/CertificateImpl.hxx
+++ b/xmlsecurity/source/gpg/CertificateImpl.hxx
@@ -18,7 +18,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -32,7 +31,6 @@
 #endif
 
 class CertificateImpl : public cppu::WeakImplHelper< 
css::security::XCertificate,
- css::lang::XUnoTunnel,
  css::lang::XServiceInfo >,
 public xmlsecurity::Certificate
 {
@@ -76,11 +74,6 @@ public:
 
 virtual sal_Int32 SAL_CALL getCertificateUsage() override;
 
-//Methods from XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 
>& aIdentifier) override;
-
-static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
-
 /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
 virtual css::uno::Sequence getSHA256Thumbprint() override;
 /// @see xmlsecurity::Certificate::getSignatureMethodAlgorithm().
diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx 
b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
index aff3b68c5ed8..38d0563b161e 100644
--- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx
+++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
@@ -203,7 +203,7 @@ Reference< XCertificate > 
SecurityEnvironmentGpg::createCertificateFromAscii( co
 sal_Int32 SecurityEnvironmentGpg::verifyCertificate( const Reference< 
XCertificate >& aCert,
   const Sequence< Reference< 
XCertificate > >&  /*intermediateCerts*/ )
 {
-const CertificateImpl* xCert = 
comphelper::getFromUnoTunnel(aCert);
+const CertificateImpl* xCert = dynamic_cast(aCert.get());
 if (xCert == nullptr) {
  // Can't find the key locally -> unknown owner
 return security::CertificateValidity::ISSUER_UNKNOWN;
@@ -223,7 +223,7 @@ sal_Int32 SecurityEnvironmentGpg::verifyCertificate( const 
Reference< XCertifica
 sal_Int32 SecurityEnvironmentGpg::getCertificateCharacters(
 const Reference< XCertificate >& aCert)
 {
-if (comphelper::getFromUnoTunnel(aCert) == nullptr)
+if (dynamic_cast(aCert.get()) == nullptr)
 throw RuntimeException();
 
 // we only listed private keys anyway, up in


[Libreoffice-commits] core.git: xmlsecurity/source

2023-01-14 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx|4 +--
 xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx |6 +
 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx |6 +
 xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx|3 --
 xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx |   12 
--
 xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.hxx |7 -
 6 files changed, 7 insertions(+), 31 deletions(-)

New commits:
commit 6f812b7ac60c1c4fbc8ccba234c19ccf3871dee4
Author: Noel Grandin 
AuthorDate: Fri Jan 13 08:27:41 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 14 09:31:29 2023 +

XUnoTunnel->dynamic_cast in XMLElementWrapper_XmlSecImpl

Change-Id: Ie0654c8ba6367b575c289b63ac02668ae38066c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145495
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx 
b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
index 1afcd3c88a57..ee28084b1bcb 100644
--- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
+++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
@@ -78,7 +78,7 @@ SAL_CALL XMLSignature_GpgImpl::generate(
 }
 
 XMLElementWrapper_XmlSecImpl* pElement =
-comphelper::getFromUnoTunnel(xElement);
+dynamic_cast(xElement.get());
 if( pElement == nullptr ) {
 throw RuntimeException() ;
 }
@@ -282,7 +282,7 @@ SAL_CALL XMLSignature_GpgImpl::validate(
 throw RuntimeException() ;
 
 XMLElementWrapper_XmlSecImpl* pElement =
-comphelper::getFromUnoTunnel(xElement);
+dynamic_cast(xElement.get());
 if( pElement == nullptr )
 throw RuntimeException() ;
 
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
index 23833e71106b..d20aa649efdb 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
@@ -112,8 +112,7 @@ SAL_CALL XMLSignature_MSCryptImpl::generate(
 throw RuntimeException() ;
 }
 
-Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY_THROW ) ;
-XMLElementWrapper_XmlSecImpl* pElement = 
comphelper::getFromUnoTunnel(xNodTunnel);
+XMLElementWrapper_XmlSecImpl* pElement = 
dynamic_cast(xElement.get());
 if( pElement == nullptr ) {
 throw RuntimeException() ;
 }
@@ -199,8 +198,7 @@ SAL_CALL XMLSignature_MSCryptImpl::validate(
 if( !xElement.is() )
 throw RuntimeException() ;
 
-Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY_THROW ) ;
-XMLElementWrapper_XmlSecImpl* pElement = 
comphelper::getFromUnoTunnel(xNodTunnel);
+XMLElementWrapper_XmlSecImpl* pElement = 
dynamic_cast(xElement.get());
 if( pElement == nullptr )
 throw RuntimeException() ;
 
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
index 9b79b79b245b..4c5cc4b418d8 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
@@ -110,9 +110,8 @@ SAL_CALL XMLSignature_NssImpl::generate(
 throw RuntimeException() ;
 }
 
-Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY_THROW ) ;
 XMLElementWrapper_XmlSecImpl* pElement
-= 
comphelper::getFromUnoTunnel(xNodTunnel);
+= dynamic_cast(xElement.get());
 if( pElement == nullptr ) {
 throw RuntimeException() ;
 }
@@ -192,9 +191,8 @@ SAL_CALL XMLSignature_NssImpl::validate(
 if( !xElement.is() )
 throw RuntimeException() ;
 
-Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY_THROW ) ;
 XMLElementWrapper_XmlSecImpl* pElement
-= 
comphelper::getFromUnoTunnel(xNodTunnel);
+= dynamic_cast(xElement.get());
 if( pElement == nullptr )
 throw RuntimeException() ;
 
diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx 
b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
index 1694e30c86a2..ccc3eb98f4e9 100644
--- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
+++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
@@ -370,9 +370,8 @@ xmlNodePtr XMLDocumentWrapper_XmlSecImpl::checkElement( 
const uno::Reference< cs
 
 if (xXMLElement.is())
 {
-uno::Reference< css::lang::XUnoTunnel > xNodTunnel( xXMLElement, 
uno::UNO_QUERY_THROW ) ;
 XMLElementWrapper_XmlSecImpl* pElement
-= 
comphelper::getFromUnoTunnel(xNodTunnel);
+= dynamic_cast(xXMLElement.get());
 
 if( pElement == nullptr ) {
 throw uno::RuntimeException() ;
diff --git a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx 
b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx
index 

[Libreoffice-commits] core.git: xmlsecurity/source

2023-01-14 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   13 --
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx |9 --
 xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx   |3 --
 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx|6 +---
 4 files changed, 4 insertions(+), 27 deletions(-)

New commits:
commit 97db783599148e7829a898f7e46764e777500ecc
Author: Noel Grandin 
AuthorDate: Fri Jan 13 09:16:52 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 14 09:30:58 2023 +

XUnoTunnel->dynamic_cast in SecurityEnvironment_NssImpl

Change-Id: I65b109f8f45c57633ca3983bacf496a65ea02ea2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145497
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 2add74631001..b12a3356d18c 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -151,19 +151,6 @@ Sequence< OUString > SAL_CALL 
SecurityEnvironment_NssImpl::getSupportedServiceNa
 return seqServiceNames;
 }
 
-/* XUnoTunnel */
-sal_Int64 SAL_CALL SecurityEnvironment_NssImpl::getSomething( const Sequence< 
sal_Int8 >& aIdentifier )
-{
-return comphelper::getSomethingImpl(aIdentifier, this);
-}
-
-/* XUnoTunnel extension */
-
-const Sequence< sal_Int8>& SecurityEnvironment_NssImpl::getUnoTunnelId() {
-static const comphelper::UnoIdInit 
theSecurityEnvironment_NssImplUnoTunnelId;
-return theSecurityEnvironment_NssImplUnoTunnelId.getSeq();
-}
-
 OUString SecurityEnvironment_NssImpl::getSecurityEnvironmentInformation()
 {
 OUStringBuffer buff;
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
index 12310372096d..253d3ea1f4e3 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
@@ -29,7 +29,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -47,8 +46,7 @@ class X509Certificate_NssImpl;
 class SecurityEnvironment_NssImpl : public ::cppu::WeakImplHelper<
 css::xml::crypto::XSecurityEnvironment,
 css::xml::crypto::XCertificateCreator,
-css::lang::XServiceInfo,
-css::lang::XUnoTunnel >
+css::lang::XServiceInfo >
 {
 private:
 
@@ -87,11 +85,6 @@ private:
 
 virtual OUString SAL_CALL getSecurityEnvironmentInformation(  ) 
override;
 
-//Methods from XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
-static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
-
 /// @throws css::uno::Exception
 /// @throws css::uno::RuntimeException
 void setCertDb( CERTCertDBHandle* aCertDb ) ;
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
index 6ada0522bcd9..74c80afe1a82 100644
--- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
@@ -58,8 +58,7 @@ uno::Reference< css::xml::crypto::XXMLSecurityContext > 
SAL_CALL
 uno::Reference< css::xml::crypto::XXMLSecurityContext > xSecCtx = 
css::xml::crypto::XMLSecurityContext::create( m_xContext );
 
 uno::Reference< css::xml::crypto::XSecurityEnvironment > xSecEnv = 
css::xml::crypto::SecurityEnvironment::create( m_xContext );
-uno::Reference< lang::XUnoTunnel > xSecEnvTunnel(xSecEnv, 
uno::UNO_QUERY_THROW);
-SecurityEnvironment_NssImpl* pSecEnv = 
comphelper::getFromUnoTunnel(xSecEnvTunnel);
+SecurityEnvironment_NssImpl* pSecEnv = 
dynamic_cast(xSecEnv.get());
 pSecEnv->setCertDb(pCertHandle);
 
 sal_Int32 n = xSecCtx->addSecurityEnvironment(xSecEnv);
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
index 94e84a71b5d8..9b79b79b245b 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
@@ -128,11 +128,10 @@ SAL_CALL XMLSignature_NssImpl::generate(
 }
 
 //Get Keys Manager
-Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ;
 
 // the key manager should be retrieved from SecurityEnvironment, instead 
of SecurityContext
 SecurityEnvironment_NssImpl* pSecEnv
-= 
comphelper::getFromUnoTunnel(xSecTunnel);
+= dynamic_cast(aEnvironment.get());
 if( pSecEnv == nullptr )
 throw RuntimeException() ;
 
@@ -219,9 +218,8 @@ SAL_CALL XMLSignature_NssImpl::validate(
 Reference< XSecurityEnvironment > aEnvironment = 
aSecurityCtx->getSecurityEnvironmentByIndex(i);
 
 //Get Keys Manager
-

[Libreoffice-commits] core.git: xmlsecurity/source

2023-01-13 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   11 +++--
 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx |   12 --
 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx |7 -
 3 files changed, 4 insertions(+), 26 deletions(-)

New commits:
commit 08cae41f6f8cb8f9f592c0735d1285c0575d6e49
Author: Noel Grandin 
AuthorDate: Fri Jan 13 08:30:28 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Jan 14 07:29:12 2023 +

XUnoTunnel->dynamic_cast in X509Certificate_NssImpl

Change-Id: I027e8bcee4f9e2b7bafd2ddf9070b6a28bcded37
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145496
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index d130c03723e9..2add74631001 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -361,8 +361,7 @@ Sequence< Reference < XCertificate > > 
SecurityEnvironment_NssImpl::buildCertifi
 // Remember the signing certificate.
 m_xSigningCertificate = begin;
 
-Reference< XUnoTunnel > xCertTunnel( begin, UNO_QUERY_THROW ) ;
-const X509Certificate_NssImpl* xcert = 
comphelper::getFromUnoTunnel(xCertTunnel);
+const X509Certificate_NssImpl* xcert = 
dynamic_cast(begin.get());
 if( xcert == nullptr ) {
 throw RuntimeException() ;
 }
@@ -495,11 +494,10 @@ verifyCertificate( const Reference< csss::XCertificate >& 
aCert,
 {
 sal_Int32 validity = csss::CertificateValidity::INVALID;
 const CERTCertificate* cert ;
-Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY_THROW ) ;
 
 SAL_INFO("xmlsecurity.xmlsec", "Start verification of certificate: " << 
aCert->getSubjectName());
 
-const X509Certificate_NssImpl* xcert = 
comphelper::getFromUnoTunnel(xCertTunnel);
+const X509Certificate_NssImpl* xcert = 
dynamic_cast(aCert.get());
 if( xcert == nullptr ) {
 throw RuntimeException() ;
 }
@@ -711,8 +709,7 @@ sal_Int32 
SecurityEnvironment_NssImpl::getCertificateCharacters(
 sal_Int32 characters ;
 const CERTCertificate* cert ;
 
-Reference< XUnoTunnel > xCertTunnel( aCert, UNO_QUERY_THROW ) ;
-const X509Certificate_NssImpl* xcert = 
comphelper::getFromUnoTunnel(xCertTunnel);
+const X509Certificate_NssImpl* xcert = 
dynamic_cast(aCert.get());
 if( xcert == nullptr ) {
 throw RuntimeException() ;
 }
@@ -814,7 +811,7 @@ xmlSecKeysMngrPtr 
SecurityEnvironment_NssImpl::createKeysManager() {
 
 // Adopt the private key of the signing certificate, if it has any.
 if (auto pCertificate
-= 
comphelper::getFromUnoTunnel(m_xSigningCertificate))
+= 
dynamic_cast(m_xSigningCertificate.get()))
 {
 SECKEYPrivateKey* pPrivateKey = 
SECKEY_CopyPrivateKey(pCertificate->getPrivateKey());
 if (pPrivateKey)
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index 79441da1edf5..4997a482728e 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -332,18 +332,6 @@ SECKEYPrivateKey* X509Certificate_NssImpl::getPrivateKey()
 return nullptr;
 }
 
-/* XUnoTunnel */
-sal_Int64 SAL_CALL X509Certificate_NssImpl::getSomething( const 
css::uno::Sequence< sal_Int8 >& aIdentifier ) {
-return comphelper::getSomethingImpl(aIdentifier, this);
-}
-
-/* XUnoTunnel extension */
-
-const css::uno::Sequence< sal_Int8>& X509Certificate_NssImpl::getUnoTunnelId() 
{
-static const comphelper::UnoIdInit theX509Certificate_NssImplUnoTunnelId;
-return theX509Certificate_NssImplUnoTunnelId.getSeq();
-}
-
 static OUString getAlgorithmDescription(SECAlgorithmID const *aid)
 {
 SECOidTag tag;
diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx 
b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx
index dbfb6c6b07ed..9ad50f12ba0f 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx
@@ -22,7 +22,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -33,7 +32,6 @@
 
 class X509Certificate_NssImpl : public ::cppu::WeakImplHelper<
 css::security::XCertificate ,
-css::lang::XUnoTunnel,
 css::lang::XServiceInfo > , public xmlsecurity::Certificate
 {
 private:
@@ -76,17 +74,12 @@ class X509Certificate_NssImpl : public 
::cppu::WeakImplHelper<
 
 virtual sal_Int32 SAL_CALL getCertificateUsage( ) override ;
 
-//Methods from XUnoTunnel
-virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< 
sal_Int8 >& aIdentifier ) override;
-
 /// @see xmlsecurity::Certificate::getSHA256Thumbprint().
 virtual 

[Libreoffice-commits] core.git: xmlsecurity/source

2022-12-20 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit bb692dd15d3c32e85f193c3f60c7917f2b1e13d2
Author: Stephan Bergmann 
AuthorDate: Tue Dec 13 08:51:59 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Dec 20 08:16:37 2022 +

Use SecurityEnvironmentGpg's XUnoTunnel instead of dynamic_cast

...where 88ac77c0bc21accfd6f5c404217c3c2aaef2d674 "gpg4libre: List and view 
GPG
keys" had introduced SecurityEnvironmentGpg complete with (apparently 
unused)
XUnoTunnel, but then cae5f2a543b31552ccd9765aca5eb514fa694e07 "gpg4libre:
initial GPG signature generation" and 
0e226d4c193824d79f71d6918038de48afffaf26
"gpg4libre: initial GPG signature validation" had failed to make use of it.
(See the upcoming commit introducing loplugin:unocast on why such 
dynamic_casts
from UNO types are dangerous.)

Change-Id: I29cc5c1cec9c2e98528c7257993f300d131bf41c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144509
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx 
b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
index ebe113c73175..1afcd3c88a57 100644
--- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
+++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
@@ -95,7 +95,7 @@ SAL_CALL XMLSignature_GpgImpl::generate(
 
 //Get Keys Manager
 SecurityEnvironmentGpg* pSecEnv =
-dynamic_cast(aEnvironment.get());
+comphelper::getFromUnoTunnel(aEnvironment);
 if( pSecEnv == nullptr )
 throw RuntimeException() ;
 
@@ -306,7 +306,7 @@ SAL_CALL XMLSignature_GpgImpl::validate(
 Reference< XSecurityEnvironment > aEnvironment = 
aSecurityCtx->getSecurityEnvironmentByIndex(i);
 
 SecurityEnvironmentGpg* pSecEnv =
-dynamic_cast(aEnvironment.get());
+comphelper::getFromUnoTunnel(aEnvironment);
 if( pSecEnv == nullptr )
 throw RuntimeException() ;
 


[Libreoffice-commits] core.git: xmlsecurity/source

2022-12-19 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 5c7accf3e1d7bd550611af42d2eea07e590fde2f
Author: Stephan Bergmann 
AuthorDate: Tue Dec 13 09:15:33 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Dec 20 06:49:46 2022 +

Use XUnoTunnel instead of dynamic_cast here too

...like in other code accessing X509Certificate_NssImpl. (See the upcoming
commit introducing loplugin:unocast on why such dynamic_casts from UNO 
types are
dangerous.

Change-Id: I65c8380ef0c3ab34a41142639e0e6fbfb4154b27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144510
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 8872dd96b05a..d130c03723e9 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -813,7 +813,8 @@ xmlSecKeysMngrPtr 
SecurityEnvironment_NssImpl::createKeysManager() {
 throw RuntimeException();
 
 // Adopt the private key of the signing certificate, if it has any.
-if (auto pCertificate = 
dynamic_cast(m_xSigningCertificate.get()))
+if (auto pCertificate
+= 
comphelper::getFromUnoTunnel(m_xSigningCertificate))
 {
 SECKEYPrivateKey* pPrivateKey = 
SECKEY_CopyPrivateKey(pCertificate->getPrivateKey());
 if (pPrivateKey)


[Libreoffice-commits] core.git: xmlsecurity/source

2022-12-19 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 652202f0ee2fe2891f09ac9a1c6a87e944e7bb22
Author: Stephan Bergmann 
AuthorDate: Tue Dec 13 08:35:54 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 19 19:52:48 2022 +

Use XUnoTunnel instead of dynamic_cast here too

...like in other code accessing XMLElementWrapper_XmlSecImpl. (See the 
upcoming
commit introducing loplugin:unocast on why such dynamic_casts from UNO 
types are
dangerous.)

Change-Id: Ib67332dd2d6a1aa31f5515940fdd6f4a9f638bbb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144508
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx 
b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
index dd7a4a14873f..ebe113c73175 100644
--- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
+++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -77,7 +78,7 @@ SAL_CALL XMLSignature_GpgImpl::generate(
 }
 
 XMLElementWrapper_XmlSecImpl* pElement =
-dynamic_cast(xElement.get());
+comphelper::getFromUnoTunnel(xElement);
 if( pElement == nullptr ) {
 throw RuntimeException() ;
 }
@@ -281,7 +282,7 @@ SAL_CALL XMLSignature_GpgImpl::validate(
 throw RuntimeException() ;
 
 XMLElementWrapper_XmlSecImpl* pElement =
-dynamic_cast(xElement.get());
+comphelper::getFromUnoTunnel(xElement);
 if( pElement == nullptr )
 throw RuntimeException() ;
 


[Libreoffice-commits] core.git: xmlsecurity/source

2022-12-19 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/gpg/SecurityEnvironment.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7dd0b4c06d380637570e1edbefab5d40a246edf1
Author: Stephan Bergmann 
AuthorDate: Tue Dec 13 08:23:33 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Dec 19 19:28:12 2022 +

Use XUnoTunnel instead of dynamic_cast here too

...like in similar code introduced in the initial
88ac77c0bc21accfd6f5c404217c3c2aaef2d674 "gpg4libre: List and view GPG 
keys",
but which was then apparently forgotten in this code later introduced in
06929219aeb0cb3550bf0cf8b5de7f1164c00a8d "gpg4libre: Show whether pgp keys 
are
trusted or not".  (See the upcoming commit introducing loplugin:unocast on 
why
such dynamic_casts from UNO types are dangerous.)

Change-Id: I6606d0fa0be515a45a190d2da7e16d5b712bfc4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144507
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx 
b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
index dcddca194762..aff3b68c5ed8 100644
--- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx
+++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
@@ -203,7 +203,7 @@ Reference< XCertificate > 
SecurityEnvironmentGpg::createCertificateFromAscii( co
 sal_Int32 SecurityEnvironmentGpg::verifyCertificate( const Reference< 
XCertificate >& aCert,
   const Sequence< Reference< 
XCertificate > >&  /*intermediateCerts*/ )
 {
-const CertificateImpl* xCert = dynamic_cast(aCert.get());
+const CertificateImpl* xCert = 
comphelper::getFromUnoTunnel(aCert);
 if (xCert == nullptr) {
  // Can't find the key locally -> unknown owner
 return security::CertificateValidity::ISSUER_UNKNOWN;


[Libreoffice-commits] core.git: xmlsecurity/source

2022-11-09 Thread insanetree (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |6 
++---
 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx  |   12 
+-
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |2 -
 3 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 0cf5141b2233611286a27930d8030c562eb0d84b
Author: insanetree 
AuthorDate: Mon Oct 17 23:55:33 2022 +0200
Commit: Hossein 
CommitDate: Thu Nov 10 02:27:45 2022 +0100

tdf#147201 Use std::size() instead of SAL_N_ELEMENTS() macro

Change-Id: I38fa927d9964b7212b84d42d5b1bc5f60386139c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141484
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index e51b84c40d73..a9e58a33c746 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -104,10 +104,10 @@ static void traceTrustStatus(DWORD err)
 {
 if (err == 0)
 SAL_INFO("xmlsecurity.xmlsec", "  " << arErrStrings[0].name);
-for (std::size_t i = 1; i < SAL_N_ELEMENTS(arErrStrings); i++)
+for (auto const & arErrStringIter : arErrStrings)
 {
-if (arErrStrings[i].error & err)
-SAL_INFO("xmlsecurity.xmlsec", "  " << arErrStrings[i].name);
+if (arErrStringIter.error & err)
+SAL_INFO("xmlsecurity.xmlsec", "  " << arErrStringIter.name);
 }
 }
 
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx 
b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index e26f72cd0e6a..71bff4dc5c0d 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -224,13 +224,13 @@ const OUString & 
ONSSInitializer::getMozillaCurrentProfile(const css::uno::Refer
 
 if (xMozillaBootstrap.is())
 {
-for (std::size_t i=0; igetDefaultProfile(productTypes[i]);
+OUString profile = 
xMozillaBootstrap->getDefaultProfile(productTypeIter);
 
 if (!profile.isEmpty())
 {
-OUString sProfilePath = 
xMozillaBootstrap->getProfilePath(productTypes[i], profile);
+OUString sProfilePath = 
xMozillaBootstrap->getProfilePath(productTypeIter, profile);
 if (m_sNSSPath.isEmpty())
 {
 SAL_INFO("xmlsecurity.xmlsec", "Using Mozilla profile " << 
sProfilePath);
@@ -264,12 +264,12 @@ css::uno::Sequence SAL_CALL 
ONSSInitializer::getNS
 
 if (xMozillaBootstrap.is())
 {
-for (std::size_t i=0; i aProductProfileList;
-xMozillaBootstrap->getProfileList(productTypes[i], 
aProductProfileList);
+xMozillaBootstrap->getProfileList(productTypeIter, 
aProductProfileList);
 for (const auto& sProfile : std::as_const(aProductProfileList))
-aProfileList.push_back({sProfile, 
xMozillaBootstrap->getProfilePath(productTypes[i], sProfile), productTypes[i]});
+aProfileList.push_back({sProfile, 
xMozillaBootstrap->getProfilePath(productTypeIter, sProfile), productTypeIter});
 }
 }
 
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 990ea86a9bbb..8872dd96b05a 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -641,7 +641,7 @@ verifyCertificate( const Reference< csss::XCertificate >& 
aCert,
 arUsages[3] = UsageDescription( certificateUsageEmailSigner, 
"certificateUsageEmailSigner" );
 arUsages[4] = UsageDescription( certificateUsageEmailRecipient, 
"certificateUsageEmailRecipient" );
 
-int numUsages = SAL_N_ELEMENTS(arUsages);
+int numUsages = std::size(arUsages);
 for (int i = 0; i < numUsages; i++)
 {
 SAL_INFO("xmlsecurity.xmlsec", "Testing usage " << i+1 <<


[Libreoffice-commits] core.git: xmlsecurity/source

2022-11-06 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |   20 
+-
 1 file changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 9d42a2c29d195cdd4cb48acc8a65f5ca7df896c1
Author: Caolán McNamara 
AuthorDate: Sat Nov 5 15:03:49 2022 +
Commit: Caolán McNamara 
CommitDate: Sun Nov 6 17:36:47 2022 +0100

sync mscrypt impl with nss impl

Change-Id: I4960f4b8fa1124f98ee2004ffcfc0994916c297e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142335
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index 80ddff58c624..e51b84c40d73 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -41,6 +41,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -700,26 +701,25 @@ uno::Reference< XCertificate > 
SecurityEnvironment_MSCryptImpl::createCertificat
 return xcert ;
 }
 
-uno::Reference< XCertificate > 
SecurityEnvironment_MSCryptImpl::createCertificateFromAscii( const OUString& 
asciiCertificate ) {
-
+uno::Reference< XCertificate > 
SecurityEnvironment_MSCryptImpl::createCertificateFromAscii( const OUString& 
asciiCertificate )
+{
 OString oscert = OUStringToOString( asciiCertificate , 
RTL_TEXTENCODING_ASCII_US ) ;
-
 xmlChar* chCert = xmlStrndup( reinterpret_cast(oscert.getStr()), static_cast(oscert.getLength()) ) ;
-
 xmlSecSize certSize;
-xmlSecBase64Decode_ex( chCert, chCert, xmlStrlen( chCert ),  ) ;
+int nRet = xmlSecBase64Decode_ex( chCert, 
reinterpret_cast(chCert), xmlStrlen( chCert ),  ) ;
+if (nRet < 0 || certSize == 0)
+{
+xmlFree(chCert);
+return nullptr;
+}
 
-uno::Sequence< sal_Int8 > rawCert( certSize ) ;
-auto rawCertRange = asNonConstRange(rawCert);
-for( xmlSecSize i = 0 ; i < certSize ; i ++ )
-rawCertRange[i] = *( chCert + i ) ;
+uno::Sequence 
rawCert(comphelper::arrayToSequence(chCert, certSize));
 
 xmlFree( chCert ) ;
 
 return createCertificateFromRaw( rawCert ) ;
 }
 
-
 static HCERTSTORE getCertStoreForIntermediatCerts(
 const uno::Sequence< uno::Reference< css::security::XCertificate > >& 
seqCerts)
 {


[Libreoffice-commits] core.git: xmlsecurity/source

2022-11-06 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/helper/xsecsign.cxx |2 ++
 1 file changed, 2 insertions(+)

New commits:
commit 1b2fa783af31cf3ae030dd9dc55cbcb7dd4c7220
Author: Stephan Bergmann 
AuthorDate: Sat Nov 5 16:04:41 2022 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Nov 6 11:57:25 2022 +0100

-Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): xmlsecurity

Change-Id: I58b01510fd41256660f703a3b62901fe286ffb93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142337
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/helper/xsecsign.cxx 
b/xmlsecurity/source/helper/xsecsign.cxx
index 5634ed502e8b..6788f694ec2d 100644
--- a/xmlsecurity/source/helper/xsecsign.cxx
+++ b/xmlsecurity/source/helper/xsecsign.cxx
@@ -44,7 +44,9 @@ OUString XSecController::createId()
 int length = 3;
 for (sal_uInt8 i : aSeq)
 {
+SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK)
 length += sprintf(str+length, "%04x", i);
+SAL_WNODEPRECATED_DECLARATIONS_POP
 }
 
 return OUString::createFromAscii(str);


[Libreoffice-commits] core.git: xmlsecurity/source

2022-06-02 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit f6f19c7ac5a324aa66055cf0ced18152ae21891b
Author: Stephan Bergmann 
AuthorDate: Thu Jun 2 18:47:23 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Jun 2 20:32:00 2022 +0200

Use more appropriate index variable types

Change-Id: I8d82591c12642d66344f70997c5cf40e937569b4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135322
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx 
b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index 80d4e108ac3e..29b26734e04a 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -41,6 +41,7 @@
 #include "digestcontext.hxx"
 #include "ciphercontext.hxx"
 
+#include 
 #include 
 #include 
 
@@ -222,7 +223,7 @@ const OUString & 
ONSSInitializer::getMozillaCurrentProfile(const css::uno::Refer
 
 if (xMozillaBootstrap.is())
 {
-for (int i=0; igetDefaultProfile(productTypes[i]);
 
@@ -262,7 +263,7 @@ css::uno::Sequence SAL_CALL 
ONSSInitializer::getNS
 
 if (xMozillaBootstrap.is())
 {
-for (int i=0; i aProductProfileList;
 xMozillaBootstrap->getProfileList(productTypes[i], 
aProductProfileList);


[Libreoffice-commits] core.git: xmlsecurity/source

2022-04-29 Thread Michael Stahl (via logerrit)
 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit c9e758e3961b71c83a781da4cb12e454f09b094e
Author: Michael Stahl 
AuthorDate: Thu Apr 28 12:39:23 2022 +0200
Commit: Michael Stahl 
CommitDate: Fri Apr 29 13:06:11 2022 +0200

xmlsecurity: fix testInsertCertificate_PEM_ODT with "dbm:" NSS DB

CentOS 7 system NSS defaults to legacy "dbm:" DB.

  test_desktop_lib.cxx:2830:Assertion
  Test name: DesktopLOKTest::testInsertCertificate_PEM_ODT
  equality assertion failed
  - Expected: 1
  - Actual  : 2

The problem is that getPrivateKey() doesn't work:


warn:xmlsecurity.xmlsec:624712:624712:xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx:824:
 Can't get the private key from the certificate.

In this function, there is a check for trust flags, and the CERTDB_USER
flag is not set, which causes the failure.

The certificate was inserted here and the trust flags were set; this
does write something to cert8.db and it's not clear why it doesn't work
(if this call is omitted with the "sql:" backend, the test fails with
NOTVALIDATED = 4 - as expected).

Oddly enough, while PK11_FindPrivateKeyFromCert() fails, there's another
function PK11_FindKeyByDERCert() that does appear to work, so call it as
a fallback.

Change-Id: I9821966a086574374f4f6df0ac5db2f7376fe742
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133576
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index b75d73bb0a89..7e28cbc615bd 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -320,6 +320,13 @@ SECKEYPrivateKey* X509Certificate_NssImpl::getPrivateKey()
 SECKEYPrivateKey* pPrivateKey = 
PK11_FindPrivateKeyFromCert(m_pCert->slot, m_pCert, nullptr);
 if (pPrivateKey)
 return pPrivateKey;
+pPrivateKey = PK11_FindKeyByDERCert(m_pCert->slot, m_pCert, nullptr);
+if (pPrivateKey)
+{
+SAL_INFO("xmlsecurity.xmlsec", "fallback from 
PK11_FindPrivateKeyFromCert to PK11_FindKeyByDERCert needed");
+return pPrivateKey;
+}
+SAL_WARN("xmlsecurity.xmlsec", 
"X509Certificate_NssImpl::getPrivateKey() cannot find private key");
 }
 return nullptr;
 }


[Libreoffice-commits] core.git: xmlsecurity/source

2022-04-28 Thread Thorsten Behrens (via logerrit)
 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit b7a37d6fb9fc21afc77964de725d5143f5aad435
Author: Thorsten Behrens 
AuthorDate: Thu Apr 28 16:19:36 2022 +
Commit: Thorsten Behrens 
CommitDate: Thu Apr 28 23:23:08 2022 +0200

Fix system-nss: add hasht.h header back

Revert part of 02e1be8883a08ab17f3e890a834ab88f13c5867d which broke
with-system-nss builds - the hasht.h header was actually needed.

Change-Id: Ida36bc6cd91f0a9b26a2029f1cab835f90f40dde
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133571
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index bf1da39b3fec..b75d73bb0a89 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -22,6 +22,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 


[Libreoffice-commits] core.git: xmlsecurity/source

2022-03-04 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/component/documentdigitalsignatures.cxx |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit f30bc3ccdfb48356910d64ee4a3dda685b11de93
Author: Caolán McNamara 
AuthorDate: Fri Mar 4 10:31:46 2022 +
Commit: Miklos Vajna 
CommitDate: Fri Mar 4 14:26:04 2022 +0100

use internal SHA256Thumbprint api

Change-Id: I6a51359af58dbb79b6a0399944030dbcbe97152b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130963
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx 
b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 0dbf0877ad1e..990fa5dea739 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -19,9 +19,10 @@
 
 #include 
 
-#include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -683,6 +684,12 @@ sal_Bool DocumentDigitalSignatures::isAuthorTrusted(
 if (!aSignatureManager.init())
 return false;
 uno::Reference xCert = 
aSignatureManager.getSecurityEnvironment()->createCertificateFromAscii(rAuthor.RawData);
+
+auto pAuthor = 
dynamic_cast(xAuthor.get());
+auto pCert = dynamic_cast(xCert.get());
+if (pAuthor && pCert)
+return pCert->getSHA256Thumbprint() == 
pAuthor->getSHA256Thumbprint();
+
 return xCert->getSHA1Thumbprint() == xAuthor->getSHA1Thumbprint();
 });
 }


[Libreoffice-commits] core.git: xmlsecurity/source

2022-03-03 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/component/documentdigitalsignatures.cxx |   14 ++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 65442205b5b274ad309308162f150f8d41648f72
Author: Caolán McNamara 
AuthorDate: Thu Mar 3 14:22:37 2022 +
Commit: Miklos Vajna 
CommitDate: Fri Mar 4 08:31:12 2022 +0100

compare authors using Thumbprint

Change-Id: I338f58eb07cbf0a3d13a7dafdaddac09252a8546
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130929
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx 
b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 9f20a58fd23f..0dbf0877ad1e 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -673,9 +673,17 @@ sal_Bool DocumentDigitalSignatures::isAuthorTrusted(
 std::vector< SvtSecurityOptions::Certificate > aTrustedAuthors = 
SvtSecurityOptions::GetTrustedAuthors();
 
 return std::any_of(aTrustedAuthors.begin(), aTrustedAuthors.end(),
-[, ](const SvtSecurityOptions::Certificate& 
rAuthor) {
-return xmlsecurity::EqualDistinguishedNames(rAuthor.SubjectName, 
xAuthor->getIssuerName(), xmlsecurity::NOCOMPAT)
-&& ( rAuthor.SerialNumber == sSerialNum );
+[this, , ](const SvtSecurityOptions::Certificate& 
rAuthor) {
+if (!xmlsecurity::EqualDistinguishedNames(rAuthor.SubjectName, 
xAuthor->getIssuerName(), xmlsecurity::NOCOMPAT))
+return false;
+if (rAuthor.SerialNumber != sSerialNum)
+return false;
+
+DocumentSignatureManager aSignatureManager(mxCtx, {});
+if (!aSignatureManager.init())
+return false;
+uno::Reference xCert = 
aSignatureManager.getSecurityEnvironment()->createCertificateFromAscii(rAuthor.RawData);
+return xCert->getSHA1Thumbprint() == xAuthor->getSHA1Thumbprint();
 });
 }
 


[Libreoffice-commits] core.git: xmlsecurity/source

2022-02-21 Thread Hossein (via logerrit)
 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx |   36 +-
 1 file changed, 14 insertions(+), 22 deletions(-)

New commits:
commit 02e1be8883a08ab17f3e890a834ab88f13c5867d
Author: Hossein 
AuthorDate: Sun Feb 20 18:15:55 2022 +0100
Commit: Mike Kaganski 
CommitDate: Mon Feb 21 20:55:45 2022 +0100

Cleanup x509certificate_nssimpl.cxx

* Remove unused headers
* Remove 'using namespace'
* Use enum values in the condition

Change-Id: I45c20412db48ed1a3a4471db20193c2d9cde2f94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130214
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
index 2d52134344fb..bf1da39b3fec 100644
--- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx
@@ -21,11 +21,8 @@
 #include 
 
 #include 
-#include 
-#include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
@@ -41,12 +38,7 @@
 #include 
 #include 
 
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno ;
-using namespace ::com::sun::star::security ;
-
-using ::com::sun::star::security::XCertificate ;
-using ::com::sun::star::util::DateTime ;
+using ::css::util::DateTime;
 
 X509Certificate_NssImpl::X509Certificate_NssImpl() :
 m_pCert(nullptr)
@@ -104,7 +96,7 @@ css::util::DateTime SAL_CALL 
X509Certificate_NssImpl::getNotValidBefore() {
 DateTime dateTime ;
 
 rv = DER_DecodeTimeChoice( , _pCert->validity.notBefore ) ;
-if( rv ) {
+if( rv != SECStatus::SECSuccess ) {
 return DateTime() ;
 }
 
@@ -133,7 +125,7 @@ css::util::DateTime SAL_CALL 
X509Certificate_NssImpl::getNotValidAfter() {
 DateTime dateTime ;
 
 rv = DER_DecodeTimeChoice( , _pCert->validity.notAfter ) ;
-if( rv ) {
+if( rv != SECStatus::SECSuccess ) {
 return DateTime() ;
 }
 
@@ -177,7 +169,7 @@ css::uno::Sequence< css::uno::Reference< 
css::security::XCertificateExtension >
 int len ;
 
 for( len = 0, extns = m_pCert->extensions; *extns != nullptr; len ++, 
extns ++ ) ;
-Sequence< Reference< XCertificateExtension > > xExtns( len ) ;
+css::uno::Sequence< css::uno::Reference< 
css::security::XCertificateExtension > > xExtns( len ) ;
 auto xExtnsRange = asNonConstRange(xExtns);
 
 for( extns = m_pCert->extensions, len = 0; *extns != nullptr; extns 
++, len ++ ) {
@@ -301,7 +293,7 @@ const CERTCertificate* 
X509Certificate_NssImpl::getNssCert() const {
 }
 }
 
-void X509Certificate_NssImpl::setRawCert( const Sequence< sal_Int8 >& rawCert 
) {
+void X509Certificate_NssImpl::setRawCert( const css::uno::Sequence< sal_Int8 
>& rawCert ) {
 CERTCertificate* cert ;
 SECItem certItem ;
 
@@ -310,7 +302,7 @@ void X509Certificate_NssImpl::setRawCert( const Sequence< 
sal_Int8 >& rawCert )
 
 cert = CERT_DecodeDERCertificate( , PR_TRUE, nullptr ) ;
 if( cert == nullptr )
-throw RuntimeException() ;
+throw css::uno::RuntimeException() ;
 
 if( m_pCert != nullptr ) {
 CERT_DestroyCertificate( m_pCert ) ;
@@ -332,13 +324,13 @@ SECKEYPrivateKey* X509Certificate_NssImpl::getPrivateKey()
 }
 
 /* XUnoTunnel */
-sal_Int64 SAL_CALL X509Certificate_NssImpl::getSomething( const Sequence< 
sal_Int8 >& aIdentifier ) {
+sal_Int64 SAL_CALL X509Certificate_NssImpl::getSomething( const 
css::uno::Sequence< sal_Int8 >& aIdentifier ) {
 return comphelper::getSomethingImpl(aIdentifier, this);
 }
 
 /* XUnoTunnel extension */
 
-const Sequence< sal_Int8>& X509Certificate_NssImpl::getUnoTunnelId() {
+const css::uno::Sequence< sal_Int8>& X509Certificate_NssImpl::getUnoTunnelId() 
{
 static const comphelper::UnoIdInit theX509Certificate_NssImplUnoTunnelId;
 return theX509Certificate_NssImplUnoTunnelId.getSeq();
 }
@@ -377,7 +369,7 @@ static css::uno::Sequence< sal_Int8 > 
getThumbprint(CERTCertificate const *pCert
 
 memset(fingerprint, 0, sizeof fingerprint);
 rv = PK11_HashBuf(id, fingerprint, pCert->derCert.data, 
pCert->derCert.len);
-if(rv == SECSuccess)
+if(rv == SECStatus::SECSuccess)
 {
 return comphelper::arrayToSequence(fingerprint, length);
 }
@@ -444,7 +436,7 @@ css::uno::Sequence< sal_Int8 > SAL_CALL 
X509Certificate_NssImpl::getSHA1Thumbpri
 return getThumbprint(m_pCert, SEC_OID_SHA1);
 }
 
-uno::Sequence X509Certificate_NssImpl::getSHA256Thumbprint()
+css::uno::Sequence X509Certificate_NssImpl::getSHA256Thumbprint()
 {
 return getThumbprint(m_pCert, SEC_OID_SHA256);
 }
@@ -454,9 +446,9 @@ css::uno::Sequence< sal_Int8 > SAL_CALL 
X509Certificate_NssImpl::getMD5Thumbprin
 return getThumbprint(m_pCert, SEC_OID_MD5);
 }
 
-CertificateKind SAL_CALL X509Certificate_NssImpl::getCertificateKind()

[Libreoffice-commits] core.git: xmlsecurity/source

2022-01-05 Thread Miklos Vajna (via logerrit)
 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx |7 +++
 1 file changed, 7 insertions(+)

New commits:
commit 9fb45044d93ffcaa63cfe3275c8fb5feb8c00504
Author: Miklos Vajna 
AuthorDate: Tue Dec 21 14:47:53 2021 +0100
Commit: Miklos Vajna 
CommitDate: Wed Jan 5 12:24:03 2022 +0100

xmlsecurity nss: log what XML DOM node is given to libxmlsec

We have two environments where the signature and the stream bytes are
the same, still in one case the signature verification succeeds and in
the other case the hash doesn't match.

Log the signature as parsed into a DOM node (recursively), just case
something goes wrong during extracting a single signature from the
signatures list XML.

Change-Id: I54af71fdeb63d8ef44342f106746f938fa51f29a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127991
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
index e637785fe613..9257771f2767 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
@@ -243,6 +243,13 @@ SAL_CALL XMLSignature_NssImpl::validate(
 if (xmlSecPtrListAdd(&(pDsigCtx->keyInfoReadCtx.enabledKeyData), 
BAD_CAST xmlSecNssKeyDataX509GetKlass()) < 0)
 throw RuntimeException("failed to limit allowed key data");
 
+xmlBufferPtr pBuf = xmlBufferCreate();
+xmlNodeDump(pBuf, nullptr, pNode, 0, 0);
+SAL_INFO("xmlsecurity.xmlsec", "xmlSecDSigCtxVerify input XML node is 
'"
+   << reinterpret_cast(xmlBufferContent(pBuf))
+   << "'");
+xmlBufferFree(pBuf);
+
 //Verify signature
 int rs = xmlSecDSigCtxVerify( pDsigCtx.get() , pNode );
 


[Libreoffice-commits] core.git: xmlsecurity/source

2022-01-04 Thread Miklos Vajna (via logerrit)
 xmlsecurity/source/helper/documentsignaturehelper.cxx |   28 ++
 1 file changed, 28 insertions(+)

New commits:
commit b737cf89a3e555ea81ff86fc0dd96d2a76a4dc4f
Author: Miklos Vajna 
AuthorDate: Tue Dec 21 14:06:56 2021 +0100
Commit: Miklos Vajna 
CommitDate: Tue Jan 4 12:22:12 2022 +0100

xmlsecurity: log the signature we read from the ZIP package

We can already see if a signature verification fails and what is the
content of the ZIP streams we hash.

Show what is the expected hash as well.

Change-Id: Ibc67b7de0e8d03e06da1b86b6e8a7b2b2e613882
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127934
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx 
b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index 77288e299cff..5c264f7885e6 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -362,6 +363,33 @@ SignatureStreamHelper 
DocumentSignatureHelper::OpenSignatureStream(
 else
 aSIGStreamName = 
DocumentSignatureHelper::GetPackageSignatureDefaultStreamName();
 
+#ifdef SAL_LOG_INFO
+aHelper.xSignatureStream
+= 
aHelper.xSignatureStorage->openStreamElement(aSIGStreamName, nOpenMode);
+SAL_INFO("xmlsecurity.helper",
+ "DocumentSignatureHelper::OpenSignatureStream: stream 
name is '"
+ << aSIGStreamName << "'");
+if (aHelper.xSignatureStream.is())
+{
+uno::Reference 
xInputStream(aHelper.xSignatureStream,
+  
uno::UNO_QUERY);
+sal_Int64 nSize = 0;
+uno::Reference 
xPropertySet(xInputStream, uno::UNO_QUERY);
+xPropertySet->getPropertyValue("Size") >>= nSize;
+if (nSize >= 0 || nSize < SAL_MAX_INT32)
+{
+uno::Sequence aData;
+xInputStream->readBytes(aData, nSize);
+SAL_INFO("xmlsecurity.helper",
+ 
"DocumentSignatureHelper::OpenSignatureStream: stream content is '"
+ << OString(reinterpret_cast(aData.getArray()),
+aData.getLength())
+ << "'");
+}
+}
+aHelper.xSignatureStream.clear();
+#endif
+
 aHelper.xSignatureStream = 
aHelper.xSignatureStorage->openStreamElement( aSIGStreamName, nOpenMode );
 }
 }


[Libreoffice-commits] core.git: xmlsecurity/source

2022-01-03 Thread Miklos Vajna (via logerrit)
 xmlsecurity/source/xmlsec/xmlstreamio.cxx |8 
 1 file changed, 8 insertions(+)

New commits:
commit 7d90a00a49435ddf9545a62dfea93b34ad9fb4ee
Author: Miklos Vajna 
AuthorDate: Tue Dec 21 11:31:30 2021 +0100
Commit: Miklos Vajna 
CommitDate: Mon Jan 3 14:42:24 2022 +0100

xmlsecurity: add some more logging

We only get:


warn:xmlsecurity.xmlsec:32272:32272:xmlsecurity/source/xmlsec/errorcallback.cxx:53:
 digests.c:226: xmlSecNssDigestVerify() 'sha1' '' 12 'data and digest do not 
match'

when one of the XML streams have a bad hash. Add some logging to help
figuring out (without a debugger) which stream is at fault.

Change-Id: Ib5f39df87bcdaaac1a21eb560c8f775c42a4079f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127885
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/xmlsecurity/source/xmlsec/xmlstreamio.cxx 
b/xmlsecurity/source/xmlsec/xmlstreamio.cxx
index 1000252b15d2..b3ee76712042 100644
--- a/xmlsecurity/source/xmlsec/xmlstreamio.cxx
+++ b/xmlsecurity/source/xmlsec/xmlstreamio.cxx
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -63,6 +64,8 @@ static int xmlStreamMatch( const char* uri )
 OUString::createFromAscii(uri));
 }
 }
+SAL_INFO("xmlsecurity.xmlsec",
+ "xmlStreamMath: uri is '" << uri << "', returning " << 
xInputStream.is());
 if (xInputStream.is())
 return 1;
 else
@@ -95,6 +98,8 @@ static void* xmlStreamOpen( const char* uri )
 css::io::XInputStream* pInputStream ;
 pInputStream = xInputStream.get() ;
 pInputStream->acquire() ;
+SAL_INFO("xmlsecurity.xmlsec",
+ "xmlStreamOpen: uri is '" << uri << "', returning context 
" << pInputStream);
 return static_cast(pInputStream) ;
 }
 }
@@ -123,6 +128,8 @@ static int xmlStreamRead( void* context, char* buffer, int 
len )
 }
 }
 
+SAL_INFO("xmlsecurity.xmlsec", "xmlStreamRead: context is " << context << 
", buffer is now '"
+ << OString(buffer, 
numbers) << "'");
 return numbers ;
 }
 
@@ -134,6 +141,7 @@ static int xmlStreamClose( void * context )
 css::io::XInputStream* pInputStream ;
 pInputStream = static_cast(context);
 pInputStream->release() ;
+SAL_INFO("xmlsecurity.xmlsec", "xmlStreamRead: closed context " << 
context);
 }
 }
 


[Libreoffice-commits] core.git: xmlsecurity/source

2021-12-24 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/xmlsec/nss/ciphercontext.cxx |6 ++
 xmlsecurity/source/xmlsec/nss/ciphercontext.hxx |4 ++--
 2 files changed, 4 insertions(+), 6 deletions(-)

New commits:
commit b0163975efc6924c154793590a759784ffa77d08
Author: Noel Grandin 
AuthorDate: Thu Dec 23 22:24:27 2021 +0200
Commit: Noel Grandin 
CommitDate: Fri Dec 24 14:45:11 2021 +0100

osl::Mutex->std::mutex in OCipherContext

Change-Id: I0a457dc8ddccc0fce42032956aff6d661d1ae80a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127403
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx 
b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx
index c4d1c6113bf6..ff3441249435 100644
--- a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx
+++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx
@@ -63,8 +63,6 @@ uno::Reference< xml::crypto::XCipherContext > 
OCipherContext::Create( CK_MECHANI
 
 void OCipherContext::Dispose()
 {
-::osl::MutexGuard aGuard( m_aMutex );
-
 if ( m_pContext )
 {
 PK11_DestroyContext( m_pContext, PR_TRUE );
@@ -94,7 +92,7 @@ void OCipherContext::Dispose()
 
 uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( 
const uno::Sequence< ::sal_Int8 >& aData )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bBroken )
 throw uno::RuntimeException();
@@ -174,7 +172,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL 
OCipherContext::convertWithCipherContext( c
 
 uno::Sequence< ::sal_Int8 > SAL_CALL 
OCipherContext::finalizeCipherContextAndDispose()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::unique_lock aGuard( m_aMutex );
 
 if ( m_bBroken )
 throw uno::RuntimeException();
diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx 
b/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx
index 3ac5df6c7fd0..40b610ef512e 100644
--- a/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx
+++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.hxx
@@ -22,14 +22,14 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 #include 
 
 class OCipherContext : public cppu::WeakImplHelper< 
css::xml::crypto::XCipherContext >
 {
 private:
-::osl::Mutex m_aMutex;
+std::mutex m_aMutex;
 
 PK11SlotInfo* m_pSlot;
 PK11SymKey* m_pSymKey;


[Libreoffice-commits] core.git: xmlsecurity/source

2021-11-01 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |   20 
+-
 xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx   |2 -
 2 files changed, 11 insertions(+), 11 deletions(-)

New commits:
commit 7d936a98cd8f44e3a99f121b610b9040ae2e8381
Author: Stephan Bergmann 
AuthorDate: Fri Oct 29 14:09:46 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Nov 1 09:57:13 2021 +0100

Fix more misuses of NULL across Windows-only code

...that had inadvertently been missing from
a5cea74034a8e029bfdf0f2b82ea8800bf5bd206 °Fix misuses of NULL across
Windows-only code"

Change-Id: I8f60cd6114ceb7c6413fb099778bfb06407bbb24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124431
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index bd1de6cbf85d..f198f839f76b 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -110,16 +110,16 @@ static void traceTrustStatus(DWORD err)
 }
 }
 
-SecurityEnvironment_MSCryptImpl::SecurityEnvironment_MSCryptImpl( const 
uno::Reference< uno::XComponentContext >& xContext ) : m_hProv( NULL ) , 
m_pszContainer( nullptr ) , m_hKeyStore( nullptr ), m_hCertStore( nullptr ), 
m_hMySystemStore(nullptr), m_hRootSystemStore(nullptr), 
m_hTrustSystemStore(nullptr), m_hCaSystemStore(nullptr), m_bEnableDefault( 
false ){
+SecurityEnvironment_MSCryptImpl::SecurityEnvironment_MSCryptImpl( const 
uno::Reference< uno::XComponentContext >& xContext ) : m_hProv( 0 ) , 
m_pszContainer( nullptr ) , m_hKeyStore( nullptr ), m_hCertStore( nullptr ), 
m_hMySystemStore(nullptr), m_hRootSystemStore(nullptr), 
m_hTrustSystemStore(nullptr), m_hCaSystemStore(nullptr), m_bEnableDefault( 
false ){
 
 m_xServiceManager.set(xContext, uno::UNO_QUERY);
 }
 
 SecurityEnvironment_MSCryptImpl::~SecurityEnvironment_MSCryptImpl() {
 
-if( m_hProv != NULL ) {
+if( m_hProv != 0 ) {
 CryptReleaseContext( m_hProv, 0 ) ;
-m_hProv = NULL ;
+m_hProv = 0 ;
 }
 
 if( m_pszContainer != nullptr ) {
@@ -181,12 +181,12 @@ HCRYPTPROV 
SecurityEnvironment_MSCryptImpl::getCryptoProvider() {
 }
 
 void SecurityEnvironment_MSCryptImpl::setCryptoProvider( HCRYPTPROV aProv ) {
-if( m_hProv != NULL ) {
+if( m_hProv != 0 ) {
 CryptReleaseContext( m_hProv, 0 ) ;
-m_hProv = NULL ;
+m_hProv = 0 ;
 }
 
-if( aProv != NULL ) {
+if( aProv != 0 ) {
 m_hProv = aProv ;
 }
 }
@@ -607,7 +607,7 @@ uno::Sequence< uno::Reference < XCertificate > > 
SecurityEnvironment_MSCryptImpl
 hCollectionStore = CertOpenStore(
 CERT_STORE_PROV_COLLECTION ,
 0 ,
-NULL ,
+0 ,
 0 ,
 nullptr
 ) ;
@@ -722,7 +722,7 @@ uno::Reference< XCertificate > 
SecurityEnvironment_MSCryptImpl::createCertificat
 static HCERTSTORE getCertStoreForIntermediatCerts(
 const uno::Sequence< uno::Reference< css::security::XCertificate > >& 
seqCerts)
 {
-HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, 0, 
nullptr);
+HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, 0, nullptr);
 if (store == nullptr)
 return nullptr;
 
@@ -764,7 +764,7 @@ static bool CheckUnitTestStore(PCCERT_CHAIN_CONTEXT const 
pChainContext, DWORD i
 static HCERTSTORE const hExtra = CertOpenStore(
 CERT_STORE_PROV_FILENAME_A,
 PKCS_7_ASN_ENCODING | X509_ASN_ENCODING,
-NULL,
+0,
 CERT_STORE_OPEN_EXISTING_FLAG | CERT_STORE_READONLY_FLAG,
 OString(OString::Concat(pVar) + "/test.p7b").getStr());
 assert(hExtra != nullptr);
@@ -844,7 +844,7 @@ sal_Int32 
SecurityEnvironment_MSCryptImpl::verifyCertificate(
 hCollectionStore = CertOpenStore(
 CERT_STORE_PROV_COLLECTION ,
 0 ,
-NULL ,
+0 ,
 0 ,
 nullptr
 ) ;
diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
index e626beeffaaa..08143f992379 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
@@ -59,7 +59,7 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL
 {
 sCertDir = OString(sCertDB.getStr(), sCertDB.getLength(), 
RTL_TEXTENCODING_ASCII_US);
 n_pCertStore = sCertDir.getStr();
-n_hStoreHandle = CertOpenSystemStoreW( NULL, 
o3tl::toW(sCertDB.getStr())) ;
+n_hStoreHandle = CertOpenSystemStoreW( 0, o3tl::toW(sCertDB.getStr())) 
;
 if( n_hStoreHandle == nullptr 

[Libreoffice-commits] core.git: xmlsecurity/source

2021-11-01 Thread Mike Kaganski (via logerrit)
 xmlsecurity/source/framework/saxeventkeeperimpl.cxx   |   15 
+--
 xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx |   12 --
 xmlsecurity/source/gpg/SecurityEnvironment.cxx|3 
 xmlsecurity/source/helper/pdfsignaturehelper.cxx  |3 
 xmlsecurity/source/helper/xmlsignaturehelper.cxx  |5 -
 xmlsecurity/source/helper/xsecctl.cxx |   12 +-
 xmlsecurity/source/helper/xsecverify.cxx  |5 -
 xmlsecurity/source/xmlsec/biginteger.cxx  |8 -
 xmlsecurity/source/xmlsec/certificateextension_certextn.cxx   |   15 
---
 xmlsecurity/source/xmlsec/mscrypt/sanextension_mscryptimpl.cxx|   12 --
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |9 +
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx |   21 
++--
 xmlsecurity/source/xmlsec/nss/ciphercontext.cxx   |5 -
 xmlsecurity/source/xmlsec/nss/sanextension_nssimpl.cxx|6 -
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   18 
---
 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx |   47 
++
 xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx   |5 -
 17 files changed, 78 insertions(+), 123 deletions(-)

New commits:
commit d12f25905c3d7e474b603a716669b12143b6c34a
Author: Mike Kaganski 
AuthorDate: Fri Oct 29 10:29:41 2021 +0300
Commit: Mike Kaganski 
CommitDate: Mon Nov 1 09:55:03 2021 +0100

Prepare for removal of non-const operator[] from Sequence in xmlsecurity

Change-Id: I7cfcf9f9ea307bd737292e6f4f37a29f453167c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124418
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx 
b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
index b1d960241702..b5a7f027287f 100644
--- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
+++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
@@ -30,6 +30,8 @@
 #include 
 #include 
 
+#include 
+
 SAXEventKeeperImpl::SAXEventKeeperImpl( )
 :m_pCurrentBufferNode(nullptr),
  m_nNextElementMarkId(1),
@@ -345,12 +347,8 @@ css::uno::Sequence< css::uno::Reference< 
css::xml::wrapper::XXMLElementWrapper >
 css::uno::Sequence < css::uno::Reference<
 css::xml::wrapper::XXMLElementWrapper > > aChildrenCollection ( 
vChildren.size());
 
-sal_Int32 nIndex = 0;
-for( const auto& i : vChildren )
-{
-aChildrenCollection[nIndex] = i->getXMLElement();
-nIndex++;
-}
+std::transform(vChildren.begin(), vChildren.end(), 
aChildrenCollection.getArray(),
+   [](const auto& i) { return i->getXMLElement(); });
 
 return aChildrenCollection;
 }
@@ -998,11 +996,12 @@ void SAL_CALL SAXEventKeeperImpl::startElement(
 {
 sal_Int32 nLength = xAttribs->getLength();
 css::uno::Sequence< css::xml::csax::XMLAttribute > aAttributes 
(nLength);
+auto aAttributesRange = asNonConstRange(aAttributes);
 
 for ( int i = 0; igetNameByIndex(static_cast(i));
-aAttributes[i].sValue 
=xAttribs->getValueByIndex(static_cast(i));
+aAttributesRange[i].sName = 
xAttribs->getNameByIndex(static_cast(i));
+aAttributesRange[i].sValue 
=xAttribs->getValueByIndex(static_cast(i));
 }
 
 m_xCompressedDocumentHandler->compressedStartElement(aName, 
aAttributes);
diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx 
b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
index de6cf54cd206..203f0fea2072 100644
--- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
+++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
@@ -56,17 +56,7 @@ void SAL_CALL XMLSignatureTemplateImpl::setTarget( const 
css::uno::Reference< cs
 
 css::uno::Sequence< css::uno::Reference< css::xml::wrapper::XXMLElementWrapper 
> > SAL_CALL XMLSignatureTemplateImpl::getTargets()
 {
-sal_Int32 length = targets.size();
-css::uno::Sequence< css::uno::Reference< 
css::xml::wrapper::XXMLElementWrapper > > aTargets (length);
-
-sal_Int32 i;
-
-for (i=0; i > 
SecurityEnvironmentGpg::getCertificatesIm
 }
 
 Sequence< Reference< XCertificate > > 
xCertificateSequence(certsList.size());
+auto xCertificateSequenceRange = asNonConstRange(xCertificateSequence);
 int i = 0;
 for (const auto& cert : certsList) {
-xCertificateSequence[i++] = cert;
+xCertificateSequenceRange[i++] = cert;
 }
 
 return xCertificateSequence;
diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx 
b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index 95fca26f5945..5aa2088ea7fd 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ 

[Libreoffice-commits] core.git: xmlsecurity/source

2021-10-28 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit dfdb04938fbaa756b236f1008a7cef576225404d
Author: Stephan Bergmann 
AuthorDate: Thu Oct 28 11:55:00 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Thu Oct 28 14:34:54 2021 +0200

loplugin:simplifybool (clang-cl)

(not a typo according to the comment at


"xmlsecurity: some Distinguished Names are less equal than others":  "i was 
too
lazy to look up which integer would be returned by the function and hoped 
this
would convert it to bool anyway"

Change-Id: I0f4f4d19e8d382f4430023aa6f9459c66a605b04
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124321
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index 97648f3b85cd..e8b86858d337 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -752,7 +752,7 @@ bool EqualDistinguishedNames(
 }
 CERT_NAME_BLOB blob2;
 bool ret(false);
-if (!!EncodeDistinguishedName(rName2, blob2))
+if (EncodeDistinguishedName(rName2, blob2))
 {
 ret = CertCompareCertificateName(X509_ASN_ENCODING,
 , ) == TRUE;


[Libreoffice-commits] core.git: xmlsecurity/source

2021-10-25 Thread Szymon Kłos (via logerrit)
 xmlsecurity/source/helper/pdfsignaturehelper.cxx |5 +
 1 file changed, 5 insertions(+)

New commits:
commit 97b15bcc2d15dd754afbfbf8709fa62a9866160e
Author: Szymon Kłos 
AuthorDate: Mon Oct 25 12:04:30 2021 +0200
Commit: Szymon Kłos 
CommitDate: Mon Oct 25 14:04:56 2021 +0200

tdf#145312 xmlsecurity: prevent from crash when cannot receive pdfium 
annotation

Change-Id: I6adc2cb0a07eb08a50c610958983493f4f8031ee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124021
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 

diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx 
b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index 31740779de1c..95fca26f5945 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
@@ -275,6 +275,11 @@ void AnalyizeSignatureStream(SvMemoryStream& rStream, 
std::vector&
 for (int i = 0; i < pPdfPage->getAnnotationCount(); ++i)
 {
 std::unique_ptr pPdfAnnotation = 
pPdfPage->getAnnotation(i);
+if (!pPdfAnnotation)
+{
+SAL_WARN("xmlsecurity.helper", "Cannot get PDFiumAnnotation");
+continue;
+}
 vcl::pdf::PDFAnnotationSubType eType = 
pPdfAnnotation->getSubType();
 switch (eType)
 {


[Libreoffice-commits] core.git: xmlsecurity/source

2021-10-19 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |8 

 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 4fcb64b79f89c7589c7ca2748945603877bf1770
Author: Stephan Bergmann 
AuthorDate: Tue Oct 19 16:30:12 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Oct 19 19:57:34 2021 +0200

loplugin various (clang-cl)

Change-Id: Ib9bd9b96d28c9c4dd0fa36a82a177e119aa04e6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123820
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index 70617264e8fd..f33306f7cac8 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -764,7 +764,7 @@ static bool CheckUnitTestStore(PCCERT_CHAIN_CONTEXT const 
pChainContext, DWORD i
 NULL,
 CERT_STORE_OPEN_EXISTING_FLAG | CERT_STORE_READONLY_FLAG,
 OString(OString::Concat(pVar) + "/test.p7b").getStr());
-assert(hExtra != NULL);
+assert(hExtra != nullptr);
 if (pSimpleChain->cElement < 1)
 {
 SAL_WARN("xmlsecurity.xmlsec", "unexpected empty chain");
@@ -777,13 +777,13 @@ static bool CheckUnitTestStore(PCCERT_CHAIN_CONTEXT const 
pChainContext, DWORD i
 0,
 CERT_FIND_SUBJECT_NAME,
 >pCertInfo->Subject,
-NULL);
+nullptr);
 if (pIssuerCert)
 {
 // check that it signed itself
 DWORD flags = CERT_STORE_SIGNATURE_FLAG;
-BOOL result = CertVerifySubjectCertificateContext(pRoot, pIssuerCert, 
);
-if (result == TRUE && flags == 0)
+bool result = CertVerifySubjectCertificateContext(pRoot, pIssuerCert, 
);
+if (result && flags == 0)
 {
 ret = true;
 }


[Libreoffice-commits] core.git: xmlsecurity/source

2021-10-18 Thread Michael Stahl (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |4 
++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit d06f8ba07a86f95de3446c66521960d27134afdc
Author: Michael Stahl 
AuthorDate: Fri Oct 15 16:50:51 2021 +0200
Commit: Miklos Vajna 
CommitDate: Mon Oct 18 08:23:45 2021 +0200

xmlsecurity: fix some obvious copypasta

These 2 calls to CertAddStoreToCollection follow calls where
m_hCertStore was already added and according to the comments they
should add the other store instead.

(regression from commit 813e1f5a8ae4800e8a11c612de4e3b0a97f1368d)

Change-Id: If375f603647a702feb0ca8f272126a15d5d0e906
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123666
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index dfb81ab177ee..3d298384549d 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -619,7 +619,7 @@ uno::Sequence< uno::Reference < XCertificate > > 
SecurityEnvironment_MSCryptImpl
  0) ;
 CertAddStoreToCollection (
  hCollectionStore ,
- m_hCertStore ,
+ m_hKeyStore,
  CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG ,
  0) ;
 hAdditionalStore = hCollectionStore;
@@ -800,7 +800,7 @@ sal_Int32 
SecurityEnvironment_MSCryptImpl::verifyCertificate(
 0) ;
 CertAddStoreToCollection (
 hCollectionStore ,
-m_hCertStore ,
+m_hKeyStore,
 CERT_PHYSICAL_STORE_ADD_ENABLE_FLAG ,
 0) ;
 CertAddStoreToCollection (


[Libreoffice-commits] core.git: xmlsecurity/source

2021-09-22 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/helper/ooxmlsecexporter.cxx |   12 +++-
 1 file changed, 7 insertions(+), 5 deletions(-)

New commits:
commit 924e0774a8201651a762394d51a964a4f8a0c566
Author: Stephan Bergmann 
AuthorDate: Wed Sep 22 17:13:59 2021 +0200
Commit: Stephan Bergmann 
CommitDate: Wed Sep 22 19:58:55 2021 +0200

Extend loplugin:stringviewparam to starts/endsWith: xmlsecurity

Change-Id: I8a08b0382121355c70284c2e85375ba6c3671553
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122468
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx 
b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index 324657a96ee0..a202cda19cef 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -20,6 +20,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -55,7 +56,7 @@ public:
 }
 
 /// Should we intentionally not sign this stream?
-static bool isOOXMLDenylist(const OUString& rStreamName);
+static bool isOOXMLDenylist(std::u16string_view rStreamName);
 /// Should we intentionally not sign this relation type?
 static bool isOOXMLRelationDenylist(const OUString& rRelationName);
 
@@ -85,16 +86,17 @@ public:
 void writeSignatureLineImages();
 };
 
-bool OOXMLSecExporter::Impl::isOOXMLDenylist(const OUString& rStreamName)
+bool OOXMLSecExporter::Impl::isOOXMLDenylist(std::u16string_view rStreamName)
 {
 static const std::initializer_list vDenylist
 = { u"/%5BContent_Types%5D.xml", u"/docProps/app.xml", 
u"/docProps/core.xml",
 // Don't attempt to sign other signatures for now.
 u"/_xmlsignatures" };
 // Just check the prefix, as we don't care about the content type part of 
the stream name.
-return std::any_of(
-vDenylist.begin(), vDenylist.end(),
-[&](const std::u16string_view& rLiteral) { return 
rStreamName.startsWith(rLiteral); });
+return std::any_of(vDenylist.begin(), vDenylist.end(),
+   [&](const std::u16string_view& rLiteral) {
+   return o3tl::starts_with(rStreamName, rLiteral);
+   });
 }
 
 bool OOXMLSecExporter::Impl::isOOXMLRelationDenylist(const OUString& 
rRelationName)


[Libreoffice-commits] core.git: xmlsecurity/source

2021-08-01 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/xmlsec/nss/digestcontext.cxx |4 ++--
 xmlsecurity/source/xmlsec/nss/digestcontext.hxx |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit e5982d9148d84874237470102e804c52432aa502
Author: Noel Grandin 
AuthorDate: Sat Jul 31 18:53:58 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 13:57:55 2021 +0200

osl::Mutex->std::mutex in ODigestContext

Change-Id: I168750490f2c60f8c93aef630949acb4e29734b5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119750
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/xmlsec/nss/digestcontext.cxx 
b/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
index d8c46543c0ae..4f05dd4b0da9 100644
--- a/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
+++ b/xmlsecurity/source/xmlsec/nss/digestcontext.cxx
@@ -37,7 +37,7 @@ ODigestContext::~ODigestContext()
 
 void SAL_CALL ODigestContext::updateDigest( const uno::Sequence< ::sal_Int8 >& 
aData )
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::lock_guard aGuard( m_aMutex );
 
 if ( m_bBroken )
 throw uno::RuntimeException();
@@ -65,7 +65,7 @@ void SAL_CALL ODigestContext::updateDigest( const 
uno::Sequence< ::sal_Int8 >& a
 
 uno::Sequence< ::sal_Int8 > SAL_CALL ODigestContext::finalizeDigestAndDispose()
 {
-::osl::MutexGuard aGuard( m_aMutex );
+std::lock_guard aGuard( m_aMutex );
 
 if ( m_bBroken )
 throw uno::RuntimeException();
diff --git a/xmlsecurity/source/xmlsec/nss/digestcontext.hxx 
b/xmlsecurity/source/xmlsec/nss/digestcontext.hxx
index 91326daca395..72e1864851fc 100644
--- a/xmlsecurity/source/xmlsec/nss/digestcontext.hxx
+++ b/xmlsecurity/source/xmlsec/nss/digestcontext.hxx
@@ -22,13 +22,13 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 class ODigestContext : public cppu::WeakImplHelper< 
css::xml::crypto::XDigestContext >
 {
 private:
-::osl::Mutex m_aMutex;
+std::mutex m_aMutex;
 
 PK11Context* m_pContext;
 sal_Int32 const m_nDigestLength;


[Libreoffice-commits] core.git: xmlsecurity/source

2021-08-01 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |2 +-
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 5b5d3d90f3d91f94b50a9c6a98bece0fd7e6593c
Author: Noel Grandin 
AuthorDate: Sat Jul 31 18:52:52 2021 +0200
Commit: Noel Grandin 
CommitDate: Sun Aug 1 12:41:02 2021 +0200

osl::Mutex->std::mutex in SecurityEnvironment_NssImpl

Change-Id: I4b00afbe71b5459a9b1b8e612e44af71616a9b8c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119749
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 081d37e0a01d..2f0d878d11db 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -211,7 +211,7 @@ void SecurityEnvironment_NssImpl::adoptSymKey( PK11SymKey* 
aSymKey ) {
 void SecurityEnvironment_NssImpl::updateSlots()
 {
 //In case new tokens are present then we can obtain the corresponding slot
-osl::MutexGuard guard(m_mutex);
+std::lock_guard guard(m_mutex);
 
 m_Slots.clear();
 m_tSymKeyList.clear();
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
index f2f04d1bef07..12310372096d 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
@@ -31,7 +31,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 #include 
@@ -56,7 +56,7 @@ private:
 /// The last used certificate which has the private key for signing.
 css::uno::Reference m_xSigningCertificate;
 
-osl::Mutex m_mutex;
+std::mutex m_mutex;
 
 CERTCertDBHandle*   m_pHandler ;
 std::vector< PK11SymKey* >  m_tSymKeyList ;


[Libreoffice-commits] core.git: xmlsecurity/source

2021-07-27 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/helper/ooxmlsecparser.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 9a9f8f8f85cd079911f39cde6dcae6d73a609cdc
Author: Caolán McNamara 
AuthorDate: Tue Jul 27 13:53:44 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 27 17:46:45 2021 +0200

cid#1489430 Big parameter passed by value

Change-Id: Ib40bda812872c9421948bc9a1e131ab3f95a0ff0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119557
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/xmlsecurity/source/helper/ooxmlsecparser.cxx 
b/xmlsecurity/source/helper/ooxmlsecparser.cxx
index f2dab05b9627..a4e46951bf51 100644
--- a/xmlsecurity/source/helper/ooxmlsecparser.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecparser.cxx
@@ -332,8 +332,8 @@ class OOXMLSecParser::DsDigestValueContext
 OUString & m_rValue;
 
 public:
-DsDigestValueContext(OOXMLSecParser & rParser,
-std::optional pOldNamespaceMap,
+DsDigestValueContext(OOXMLSecParser& rParser,
+std::optional&& pOldNamespaceMap,
 OUString & rValue)
 : OOXMLSecParser::Context(rParser, std::move(pOldNamespaceMap))
 , m_rValue(rValue)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-07-27 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/helper/ooxmlsecparser.cxx |   42 +--
 1 file changed, 21 insertions(+), 21 deletions(-)

New commits:
commit da10cc990980f2f54b40f3165a6df3d0701cc958
Author: Caolán McNamara 
AuthorDate: Mon Jul 26 20:13:50 2021 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 27 14:52:21 2021 +0200

cid#1489502 Big parameter passed by value

etc

Change-Id: I1242b26fa7e08c1818a0d5d5519e1220fbfb07bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119533
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/xmlsecurity/source/helper/ooxmlsecparser.cxx 
b/xmlsecurity/source/helper/ooxmlsecparser.cxx
index 690ce594ff22..f2dab05b9627 100644
--- a/xmlsecurity/source/helper/ooxmlsecparser.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecparser.cxx
@@ -50,7 +50,7 @@ class OOXMLSecParser::Context
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const /*nNamespace*/, OUString const& /*rName*/);
 
 virtual void Characters(OUString const& /*rChars*/)
@@ -80,7 +80,7 @@ class OOXMLSecParser::UnknownContext
 };
 
 auto OOXMLSecParser::Context::CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const /*nNamespace*/, OUString const& /*rName*/)
 -> std::unique_ptr
 {
@@ -205,7 +205,7 @@ class OOXMLSecParser::DsX509IssuerSerialContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "X509IssuerName")
@@ -244,7 +244,7 @@ class OOXMLSecParser::DsX509DataContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "X509IssuerSerial")
@@ -279,7 +279,7 @@ class OOXMLSecParser::DsKeyInfoContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "X509Data")
@@ -434,7 +434,7 @@ class OOXMLSecParser::DsTransformsContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "Transform")
@@ -503,7 +503,7 @@ class OOXMLSecParser::DsReferenceContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "Transforms")
@@ -566,7 +566,7 @@ class OOXMLSecParser::DsSignedInfoContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "SignatureMethod")
@@ -600,7 +600,7 @@ class OOXMLSecParser::XadesCertDigestContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "DigestMethod")
@@ -645,7 +645,7 @@ class OOXMLSecParser::XadesCertContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_XADES132 && rName == "CertDigest")
@@ -672,7 +672,7 @@ class OOXMLSecParser::XadesSigningCertificateContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_XADES132 && rName == "Cert")
@@ -733,7 +733,7 @@ class OOXMLSecParser::XadesSignedSignaturePropertiesContext
 }
 
 

[Libreoffice-commits] core.git: xmlsecurity/source

2021-07-26 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/helper/xsecparser.cxx |   48 +++
 1 file changed, 24 insertions(+), 24 deletions(-)

New commits:
commit 1dd4a80fa076bedb3a82821517036bad8dd79857
Author: Caolán McNamara 
AuthorDate: Mon Jul 26 20:09:46 2021 +0100
Commit: Caolán McNamara 
CommitDate: Mon Jul 26 22:44:51 2021 +0200

cid#1489541 Big parameter passed by value

etc

Change-Id: Id7efff454fc73ead0d404495846f7df6e7a16a41
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119532
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/xmlsecurity/source/helper/xsecparser.cxx 
b/xmlsecurity/source/helper/xsecparser.cxx
index 2e07a1d14f8c..b31f961e3548 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -58,7 +58,7 @@ class XSecParser::Context
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const /*nNamespace*/, OUString const& /*rName*/);
 
 virtual void Characters(OUString const& /*rChars*/)
@@ -88,7 +88,7 @@ class XSecParser::UnknownContext
 };
 
 auto XSecParser::Context::CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const /*nNamespace*/, OUString const& /*rName*/)
 -> std::unique_ptr
 {
@@ -221,7 +221,7 @@ class XSecParser::DsPGPDataContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "PGPKeyID")
@@ -321,7 +321,7 @@ class XSecParser::DsX509IssuerSerialContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "X509IssuerName")
@@ -360,7 +360,7 @@ class XSecParser::DsX509DataContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "X509IssuerSerial")
@@ -395,7 +395,7 @@ class XSecParser::DsKeyInfoContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "X509Data")
@@ -556,7 +556,7 @@ class XSecParser::DsTransformsContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "Transform")
@@ -625,7 +625,7 @@ class XSecParser::DsReferenceContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "Transforms")
@@ -688,7 +688,7 @@ class XSecParser::DsSignedInfoContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "SignatureMethod")
@@ -751,7 +751,7 @@ class XSecParser::XadesCertificateValuesContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_XADES132 && rName == 
"EncapsulatedX509Certificate")
@@ -780,7 +780,7 @@ class XSecParser::XadesUnsignedSignaturePropertiesContext
 }
 
 virtual std::unique_ptr CreateChildContext(
-std::optional pOldNamespaceMap,
+std::optional&& pOldNamespaceMap,
 sal_uInt16 const nNamespace, OUString const& rName) override
 {
 if (nNamespace == XML_NAMESPACE_XADES132 && rName == 
"CertificateValues")
@@ -823,7 +823,7 @@ class XSecParser::XadesUnsignedPropertiesContext
 }
 
 virtual std::unique_ptr 

[Libreoffice-commits] core.git: xmlsecurity/source

2021-05-19 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |  473 --
 1 file changed, 228 insertions(+), 245 deletions(-)

New commits:
commit 585948aadf10f6eab7d716857fc671da2d421318
Author: Noel Grandin 
AuthorDate: Wed May 19 15:52:52 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed May 19 18:16:50 2021 +0200

flatten SecurityEnvironment_NssImpl

Change-Id: I89e098c7ff913dfbc2cafbf0cdbabfbbca69110a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115813
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 21524c37163b..d7e85f577cbf 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -320,53 +320,53 @@ SecurityEnvironment_NssImpl::getPersonalCertificates()
 
 Reference< XCertificate > SecurityEnvironment_NssImpl::getCertificate( const 
OUString& issuerName, const Sequence< sal_Int8 >& serialNumber )
 {
-rtl::Reference xcert;
-
-if( m_pHandler != nullptr ) {
-CERTIssuerAndSN issuerAndSN ;
-CERTCertificate* cert ;
-CERTName* nmIssuer ;
-char* chIssuer ;
-SECItem* derIssuer ;
-std::unique_ptr 
arena(PORT_NewArena(DER_DEFAULT_CHUNKSIZE));
-if( arena == nullptr )
-throw RuntimeException() ;
+if( !m_pHandler )
+return nullptr;
 
-// Create cert info from issue and serial
-OString ostr = OUStringToOString( issuerName , RTL_TEXTENCODING_UTF8 ) 
;
-chIssuer = PL_strndup( ostr.getStr(), 
static_cast(ostr.getLength()) ) ;
-nmIssuer = CERT_AsciiToName( chIssuer ) ;
-if( nmIssuer == nullptr ) {
-PL_strfree( chIssuer ) ;
-return nullptr; // no need for exception cf. i40394
-}
+rtl::Reference xcert;
+CERTIssuerAndSN issuerAndSN ;
+CERTCertificate* cert ;
+CERTName* nmIssuer ;
+char* chIssuer ;
+SECItem* derIssuer ;
+std::unique_ptr arena(PORT_NewArena(DER_DEFAULT_CHUNKSIZE));
+if( arena == nullptr )
+throw RuntimeException() ;
 
-derIssuer = SEC_ASN1EncodeItem( arena.get(), nullptr, 
static_cast(nmIssuer), SEC_ASN1_GET( CERT_NameTemplate ) ) ;
-if( derIssuer == nullptr ) {
-PL_strfree( chIssuer ) ;
-CERT_DestroyName( nmIssuer ) ;
-throw RuntimeException() ;
-}
+// Create cert info from issue and serial
+OString ostr = OUStringToOString( issuerName , RTL_TEXTENCODING_UTF8 ) ;
+chIssuer = PL_strndup( ostr.getStr(), static_cast(ostr.getLength()) ) 
;
+nmIssuer = CERT_AsciiToName( chIssuer ) ;
+if( nmIssuer == nullptr ) {
+PL_strfree( chIssuer ) ;
+return nullptr; // no need for exception cf. i40394
+}
 
-memset( , 0, sizeof( issuerAndSN ) ) ;
+derIssuer = SEC_ASN1EncodeItem( arena.get(), nullptr, 
static_cast(nmIssuer), SEC_ASN1_GET( CERT_NameTemplate ) ) ;
+if( derIssuer == nullptr ) {
+PL_strfree( chIssuer ) ;
+CERT_DestroyName( nmIssuer ) ;
+throw RuntimeException() ;
+}
 
-issuerAndSN.derIssuer.data = derIssuer->data ;
-issuerAndSN.derIssuer.len = derIssuer->len ;
+memset( , 0, sizeof( issuerAndSN ) ) ;
 
-issuerAndSN.serialNumber.data = reinterpret_cast(const_cast(serialNumber.getConstArray()));
-issuerAndSN.serialNumber.len = serialNumber.getLength() ;
+issuerAndSN.derIssuer.data = derIssuer->data ;
+issuerAndSN.derIssuer.len = derIssuer->len ;
 
-cert = CERT_FindCertByIssuerAndSN( m_pHandler,  ) ;
-if( cert != nullptr ) {
-xcert = NssCertToXCert( cert ) ;
-}
+issuerAndSN.serialNumber.data = reinterpret_cast(const_cast(serialNumber.getConstArray()));
+issuerAndSN.serialNumber.len = serialNumber.getLength() ;
 
-PL_strfree( chIssuer ) ;
-CERT_DestroyName( nmIssuer ) ;
-//SECITEM_FreeItem( derIssuer, PR_FALSE ) ;
-CERT_DestroyCertificate( cert ) ;
+cert = CERT_FindCertByIssuerAndSN( m_pHandler,  ) ;
+if( cert != nullptr ) {
+xcert = NssCertToXCert( cert ) ;
 }
 
+PL_strfree( chIssuer ) ;
+CERT_DestroyName( nmIssuer ) ;
+//SECITEM_FreeItem( derIssuer, PR_FALSE ) ;
+CERT_DestroyCertificate( cert ) ;
+
 return xcert ;
 }
 
@@ -374,50 +374,41 @@ Sequence< Reference < XCertificate > > 
SecurityEnvironment_NssImpl::buildCertifi
 // Remember the signing certificate.
 m_xSigningCertificate = begin;
 
-const X509Certificate_NssImpl* xcert ;
-const CERTCertificate* cert ;
-CERTCertList* certChain ;
-
 Reference< XUnoTunnel > xCertTunnel( begin, UNO_QUERY_THROW ) ;
-xcert = reinterpret_cast(
+const X509Certificate_NssImpl* xcert = 
reinterpret_cast(
 sal::static_int_cast(xCertTunnel->getSomething( 

[Libreoffice-commits] core.git: xmlsecurity/source

2021-05-19 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 928ce6043523a70d056d15210296d627d6223c2f
Author: Noel Grandin 
AuthorDate: Wed May 19 15:55:48 2021 +0200
Commit: Noel Grandin 
CommitDate: Wed May 19 18:17:11 2021 +0200

fix leak in verifyCertificate

Change-Id: I49dd9e0de9b3e44186ed90f00aeb88dad4736374
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115814
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index d7e85f577cbf..081d37e0a01d 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -716,6 +716,7 @@ verifyCertificate( const Reference< csss::XCertificate >& 
aCert,
 SAL_INFO("xmlsecurity.xmlsec", "Destroying temporary certificate");
 CERT_DestroyCertificate(tmpCert);
 }
+PORT_FreeArena(log.arena, true);
 return validity ;
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-05-18 Thread Julien Nabet (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 816c2bb27bde42700fd0154cc250e9dcfd5d744e
Author: Julien Nabet 
AuthorDate: Mon May 17 21:02:47 2021 +0200
Commit: Julien Nabet 
CommitDate: Tue May 18 09:41:52 2021 +0200

Typo: solt=>slot

Change-Id: I742060932f3408bd40921d91e062a7acee0832e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115719
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index dd57a28be6da..21524c37163b 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -216,13 +216,13 @@ void SecurityEnvironment_NssImpl::updateSlots()
 m_Slots.clear();
 m_tSymKeyList.clear();
 
-PK11SlotList * soltList = PK11_GetAllTokens( CKM_INVALID_MECHANISM, 
PR_FALSE, PR_FALSE, nullptr ) ;
-if( soltList == nullptr )
+PK11SlotList * slotList = PK11_GetAllTokens( CKM_INVALID_MECHANISM, 
PR_FALSE, PR_FALSE, nullptr ) ;
+if( slotList == nullptr )
 return;
 
-for (PK11SlotListElement* soltEle = soltList->head ; soltEle != nullptr; 
soltEle = soltEle->next)
+for (PK11SlotListElement* slotEle = slotList->head ; slotEle != nullptr; 
slotEle = slotEle->next)
 {
-PK11SlotInfo * pSlot = soltEle->slot ;
+PK11SlotInfo * pSlot = slotEle->slot ;
 
 if(pSlot != nullptr)
 {
@@ -260,7 +260,7 @@ void SecurityEnvironment_NssImpl::updateSlots()
 }// end of if(pSlot != NULL)
 }// end of for
 
-PK11_FreeSlotList(soltList);
+PK11_FreeSlotList(slotList);
 }
 
 Sequence< Reference < XCertificate > >
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-05-17 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 870f8bef3c52cca36afe4fcd48c1beec104082cb
Author: Noel Grandin 
AuthorDate: Mon May 17 12:55:27 2021 +0200
Commit: Noel Grandin 
CommitDate: Mon May 17 20:52:11 2021 +0200

dont leak slot-list in updateSlots

Change-Id: I8882dbd2b5ad7656ec5ff7d47fb2e3dcbcceb5e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115700
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index cf084c7137ad..dd57a28be6da 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -249,8 +249,6 @@ void SecurityEnvironment_NssImpl::updateSlots()
 //  continue;
 //  }
 addCryptoSlot(pSlot);
-PK11_FreeSlot( pSlot ) ;
-pSlot = nullptr;
 
 if (pSymKey != nullptr)
 {
@@ -261,6 +259,8 @@ void SecurityEnvironment_NssImpl::updateSlots()
 
 }// end of if(pSlot != NULL)
 }// end of for
+
+PK11_FreeSlotList(soltList);
 }
 
 Sequence< Reference < XCertificate > >
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-05-12 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 512649f2fbaaa72d42d9a94ac5c414d2c37b36ec
Author: Caolán McNamara 
AuthorDate: Wed May 12 16:47:47 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed May 12 20:46:31 2021 +0200

unused include line

Change-Id: I6a41cfa184a653f1b84cf6f33c391ccd531ffc2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115494
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index e6ca398e3c80..265db493f882 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-04-14 Thread Ahmet Hakan Çelik (via logerrit)
 xmlsecurity/source/framework/saxeventkeeperimpl.cxx|3 +--
 xmlsecurity/source/framework/signaturecreatorimpl.cxx  |3 +--
 xmlsecurity/source/framework/signatureverifierimpl.cxx |3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

New commits:
commit 348595440143b210f55bfa541ab3f853d468f19f
Author: Ahmet Hakan Çelik 
AuthorDate: Sun Mar 7 19:06:33 2021 +0300
Commit: Michael Stahl 
CommitDate: Wed Apr 14 11:07:06 2021 +0200

tdf#88205: Adapt uses of css::uno::Sequence to use initializer_list ctor

Change-Id: Ie7507e6beb470708bb4e52a7b926433043b80d85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112133
Tested-by: Jenkins
Reviewed-by: John Turpish 
Reviewed-by: Michael Stahl 

diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx 
b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
index b0c03880348f..5e2f697d64ac 100644
--- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
+++ b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
@@ -1131,8 +1131,7 @@ OUString SAXEventKeeperImpl_getImplementationName ()
 
 css::uno::Sequence< OUString > SAXEventKeeperImpl_getSupportedServiceNames(  )
 {
-css::uno::Sequence aRet { 
"com.sun.star.xml.crypto.sax.SAXEventKeeper" };
-return aRet;
+return { "com.sun.star.xml.crypto.sax.SAXEventKeeper" };
 }
 
 /* XServiceInfo */
diff --git a/xmlsecurity/source/framework/signaturecreatorimpl.cxx 
b/xmlsecurity/source/framework/signaturecreatorimpl.cxx
index 826f800409f6..ca90abe9a004 100644
--- a/xmlsecurity/source/framework/signaturecreatorimpl.cxx
+++ b/xmlsecurity/source/framework/signaturecreatorimpl.cxx
@@ -153,8 +153,7 @@ OUString SignatureCreatorImpl_getImplementationName ()
 
 css::uno::Sequence< OUString > SignatureCreatorImpl_getSupportedServiceNames(  
)
 {
-css::uno::Sequence aRet { 
"com.sun.star.xml.crypto.sax.SignatureCreator" };
-return aRet;
+return { "com.sun.star.xml.crypto.sax.SignatureCreator" };
 }
 
 /* XServiceInfo */
diff --git a/xmlsecurity/source/framework/signatureverifierimpl.cxx 
b/xmlsecurity/source/framework/signatureverifierimpl.cxx
index 4e9dc08af972..489e8348604c 100644
--- a/xmlsecurity/source/framework/signatureverifierimpl.cxx
+++ b/xmlsecurity/source/framework/signatureverifierimpl.cxx
@@ -109,8 +109,7 @@ OUString SignatureVerifierImpl_getImplementationName ()
 
 css::uno::Sequence< OUString > SignatureVerifierImpl_getSupportedServiceNames( 
 )
 {
-css::uno::Sequence aRet { 
"com.sun.star.xml.crypto.sax.SignatureVerifier" };
-return aRet;
+return { "com.sun.star.xml.crypto.sax.SignatureVerifier" };
 }
 
 /* XServiceInfo */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-04-01 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/helper/ooxmlsecparser.hxx |4 
 1 file changed, 4 deletions(-)

New commits:
commit 36e8a0348f7d1ea9f718c3d71514a72990f77a34
Author: Caolán McNamara 
AuthorDate: Thu Apr 1 09:16:12 2021 +0100
Commit: Caolán McNamara 
CommitDate: Thu Apr 1 12:34:14 2021 +0200

cid#1475790 Uninitialized scalar field

this appeared in:

commit 0dac6d1f179c286dd7aea2d9ef7c37db8323fa37
Author: Miklos Vajna 
Date:   Mon Jan 25 15:34:38 2016 +0100

xmlsecurity: implement OOXML stream references

and disappeared in:

commit cc1d19f7bbaefa5fb22ebd1344112755068b93c9
Author: Michael Stahl 
Date:   Tue Mar 30 17:37:31 2021 +0200

xmlsecurity: replace OOXMLSecParser implementation

Change-Id: Ibaff786612d0f58639471d409dc49d813fb1cb6e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113442
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/xmlsecurity/source/helper/ooxmlsecparser.hxx 
b/xmlsecurity/source/helper/ooxmlsecparser.hxx
index 0daf5530938b..4f11302ff765 100644
--- a/xmlsecurity/source/helper/ooxmlsecparser.hxx
+++ b/xmlsecurity/source/helper/ooxmlsecparser.hxx
@@ -76,10 +76,6 @@ private:
 XSecController* m_pXSecController;
 css::uno::Reference m_xNextHandler;
 
-/// Last seen .
-OUString m_aReferenceURI;
-/// Already called addStreamReference() for this reference.
-bool m_bReferenceUnresolved;
 XMLSignatureHelper& m_rXMLSignatureHelper;
 
 OUString HandleIdAttr(css::uno::Reference 
const& xAttrs);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-03-12 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/helper/xmlsignaturehelper.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit c0ec7d342bd715d9910cf28afe10a6bfa3ba28cb
Author: Caolán McNamara 
AuthorDate: Thu Mar 11 20:23:31 2021 +
Commit: Miklos Vajna 
CommitDate: Fri Mar 12 15:29:47 2021 +0100

do same set error state as ReadAndVerifySignature does

this function is nearly exactly the same as ReadAndVerifySignature
except it doesn't set error-state on exception during parse

Change-Id: Ife881f639a11d3185920ca62cc2cd22812fae36d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112366
Tested-by: Jenkins
Reviewed-by: Michael Stahl 
Reviewed-by: Miklos Vajna 

diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx 
b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index d91a02ad8124..18ed40ce6ac5 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -406,6 +406,7 @@ bool 
XMLSignatureHelper::ReadAndVerifySignatureStorageStream(const css::uno::Ref
 catch(const uno::Exception&)
 {
 DBG_UNHANDLED_EXCEPTION("xmlsecurity.helper");
+mbError = true;
 }
 
 // release the signature reader
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-03-12 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/helper/xmlsignaturehelper.cxx |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit b344ecfa6d9b9296b1f765490d4ad3e487c33cd4
Author: Caolán McNamara 
AuthorDate: Thu Mar 11 20:22:25 2021 +
Commit: Caolán McNamara 
CommitDate: Fri Mar 12 10:09:21 2021 +0100

do same logging as ReadAndVerifySignature does

Change-Id: I89c0e29f595049096afa73ff86badc06c0b40d7f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112365
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx 
b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index 94a128b05d75..d91a02ad8124 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -270,13 +270,14 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const 
css::uno::Reference< css:
 // Parser -> SignatureReader
 xParser->setDocumentHandler( xHandler );
 
-// parser the stream
+// Parse the stream.
 try
 {
 xParser->parseStream( aParserInput );
 }
 catch( uno::Exception& )
 {
+DBG_UNHANDLED_EXCEPTION("xmlsecurity.helper");
 mbError = true;
 }
 
@@ -407,6 +408,7 @@ bool 
XMLSignatureHelper::ReadAndVerifySignatureStorageStream(const css::uno::Ref
 DBG_UNHANDLED_EXCEPTION("xmlsecurity.helper");
 }
 
+// release the signature reader
 mpXSecController->releaseSignatureReader();
 
 return !mbError;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-03-11 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 4af56d8189012f96d0471d7f50a3e4463516
Author: Stephan Bergmann 
AuthorDate: Thu Mar 11 09:13:51 2021 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Mar 11 21:33:25 2021 +0100

Don't use std::ostream operator <<(char16_t const *) deleted in C++20

Building with --with-latest-c++:

> 
C:/lo/core/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx(664):
 error C2280: 'std::basic_ostream> ::operator 
<<>(std::basic_ostream> 
&,const char16_t *)': attempting to reference a deleted function
> 
C:\PROGRA~2\MIB055~1\2019\COMMUN~1\VC\Tools\MSVC\1428~1.299\Include\ostream(951):
 note: see declaration of 'std::operator <<'

etc.

Change-Id: I70ae201c761fae907e602b6a929e23e3c8e7f692
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112318
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index ce65672987c5..b40639f586d8 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -661,7 +661,7 @@ static bool EncodeDistinguishedName(std::u16string_view 
const rName, CERT_NAME_B
 reinterpret_cast(rName.data()), CERT_X500_NAME_STR,
 nullptr, nullptr, , ))
 {
-SAL_INFO("xmlsecurity.xmlsec", "CertStrToNameW failed: " << 
WindowsErrorString(GetLastError()) << "; " << reinterpret_cast(pszError));
+SAL_INFO("xmlsecurity.xmlsec", "CertStrToNameW failed: " << 
WindowsErrorString(GetLastError()) << "; " << OUString(o3tl::toU(pszError)));
 return false;
 }
 rBlob.pbData = new BYTE[rBlob.cbData];
@@ -669,7 +669,7 @@ static bool EncodeDistinguishedName(std::u16string_view 
const rName, CERT_NAME_B
 reinterpret_cast(rName.data()), CERT_X500_NAME_STR,
 nullptr, rBlob.pbData, , ))
 {
-SAL_INFO("xmlsecurity.xmlsec", "CertStrToNameW failed: " << 
WindowsErrorString(GetLastError()) << "; " << reinterpret_cast(pszError));
+SAL_INFO("xmlsecurity.xmlsec", "CertStrToNameW failed: " << 
WindowsErrorString(GetLastError()) << "; " << OUString(o3tl::toU(pszError)));
 return false;
 }
 return true;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-03-10 Thread Miklos Vajna (via logerrit)
 xmlsecurity/source/helper/pdfsignaturehelper.cxx |   15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

New commits:
commit 2d30c903afddbb416c50587dec1c787c1edfa39f
Author: Miklos Vajna 
AuthorDate: Tue Mar 9 21:12:10 2021 +0100
Commit: Miklos Vajna 
CommitDate: Wed Mar 10 09:05:19 2021 +0100

xmlsecurity: rework to avoid pdfium ifdefs in pdfsignaturehelper

Return early in case pdfium is not available, to avoid the ifdef forest.

Change-Id: I1fd1b22015e10527a989c8a1c4f4073fef29553e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112238
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx 
b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index d336b696cb18..1ce8bf08cf41 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
@@ -33,11 +33,7 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#if HAVE_FEATURE_PDFIUM
-#include 
-#endif
 
 using namespace ::com::sun::star;
 
@@ -119,7 +115,6 @@ void GetSignatureLineShape(const 
uno::Reference& xModel, sal_Int3
 aStream.ReadBytes(rSignatureLineShape.data(), rSignatureLineShape.size());
 }
 
-#if HAVE_FEATURE_PDFIUM
 /// Represents a parsed signature.
 struct Signature
 {
@@ -405,7 +400,6 @@ bool ValidateSignature(SvStream& rStream, const Signature& 
rSignature,
 return svl::crypto::Signing::Verify(rStream, rSignature.m_aByteRanges, 
bNonDetached, aContents,
 rInformation);
 }
-#endif
 }
 
 PDFSignatureHelper::PDFSignatureHelper() = default;
@@ -425,8 +419,12 @@ bool PDFSignatureHelper::ReadAndVerifySignature(
 
 bool PDFSignatureHelper::ReadAndVerifySignatureSvStream(SvStream& rStream)
 {
-#if HAVE_FEATURE_PDFIUM
 auto pPdfium = vcl::pdf::PDFiumLibrary::get();
+if (!pPdfium)
+{
+return true;
+}
+
 SvMemoryStream aStream;
 sal_uInt64 nPos = rStream.Tell();
 rStream.Seek(0);
@@ -482,9 +480,6 @@ bool 
PDFSignatureHelper::ReadAndVerifySignatureSvStream(SvStream& rStream)
 
 m_aSignatureInfos.push_back(aInfo);
 }
-#else
-(void)rStream;
-#endif
 
 return true;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-03-03 Thread Michael Stahl (via logerrit)
 xmlsecurity/source/component/documentdigitalsignatures.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit ca98e505cd69bf95d8ddb9387cf3f8e03ae4577d
Author: Michael Stahl 
AuthorDate: Fri Feb 26 19:51:39 2021 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 3 12:47:50 2021 +0100

xmlsecurity: fix crash in DocumentDigitalSignatures::isAuthorTrusted()

If the argument is null.

This function also should use EqualDistinguishedNames().

Change-Id: I4068aa94f9d9c422c96b394c82d3e28303774b0b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111667
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx 
b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index f3b74de8f752..6dfb9799190d 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -655,15 +655,19 @@ void DocumentDigitalSignatures::showCertificate(
 }
 
 sal_Bool DocumentDigitalSignatures::isAuthorTrusted(
-const Reference< css::security::XCertificate >& Author )
+const Reference& xAuthor)
 {
-OUString sSerialNum = xmlsecurity::bigIntegerToNumericString( 
Author->getSerialNumber() );
+if (!xAuthor.is())
+{
+return false;
+}
+OUString sSerialNum = 
xmlsecurity::bigIntegerToNumericString(xAuthor->getSerialNumber());
 
 std::vector< SvtSecurityOptions::Certificate > aTrustedAuthors = 
SvtSecurityOptions().GetTrustedAuthors();
 
 return std::any_of(aTrustedAuthors.begin(), aTrustedAuthors.end(),
-[, ](const SvtSecurityOptions::Certificate& rAuthor) 
{
-return ( rAuthor.SubjectName == Author->getIssuerName() )
+[, ](const SvtSecurityOptions::Certificate& 
rAuthor) {
+return xmlsecurity::EqualDistinguishedNames(rAuthor.SubjectName, 
xAuthor->getIssuerName())
 && ( rAuthor.SerialNumber == sSerialNum );
 });
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-03-03 Thread Michael Stahl (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 90b725675c2964f4a151d802d9afedd8bc2ae1a7
Author: Michael Stahl 
AuthorDate: Fri Feb 26 19:25:18 2021 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 3 12:47:30 2021 +0100

xmlsecurity: avoid exception in DigitalSignaturesDialog::getCertificate()

Fallback to PGP if there's no X509 signing certificate because
CheckX509Data() failed prevents the dialog from popping up.

To avoid confusing the user in this situation, the dialog should
show no certificate, which is already the case.

Change-Id: I7f382165657f50723ac65a60309567e5b6c5ae1b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111664
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 044676688389..e6ca398e3c80 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -723,7 +723,7 @@ uno::Reference 
DigitalSignaturesDialog::getCertificate(c
 xCert = 
xSecEnv->getCertificate(rInfo.GetSigningCertificate()->X509IssuerName,
 
xmlsecurity::numericStringToBigInteger(rInfo.GetSigningCertificate()->X509SerialNumber));
 }
-if (!xCert.is() && xGpgSecEnv.is())
+if (!xCert.is() && xGpgSecEnv.is() && !rInfo.ouGpgKeyID.isEmpty())
 xCert = xGpgSecEnv->getCertificate( rInfo.ouGpgKeyID, 
xmlsecurity::numericStringToBigInteger(u"") );
 
 SAL_WARN_IF( !xCert.is(), "xmlsecurity.dialogs", "Certificate not found 
and can't be created!" );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2021-03-03 Thread Michael Stahl (via logerrit)
 xmlsecurity/source/helper/xsecparser.cxx |  109 +--
 xmlsecurity/source/helper/xsecparser.hxx |   14 ---
 2 files changed, 63 insertions(+), 60 deletions(-)

New commits:
commit cfeb89a758b5f0ec406f0d72444e52ed2f47b85e
Author: Michael Stahl 
AuthorDate: Thu Feb 18 19:03:56 2021 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 3 12:44:42 2021 +0100

xmlsecurity: move XSecParser Reference state into contexts

Change-Id: Ia2da9bf1329a856629f60ab64b74d5ee79077076
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/59
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/xmlsecurity/source/helper/xsecparser.cxx 
b/xmlsecurity/source/helper/xsecparser.cxx
index b8c5581bad5c..5166464f6f1d 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -425,10 +425,15 @@ class XSecParser::DsDigestValueContext
 class XSecParser::DsDigestMethodContext
 : public XSecParser::Context
 {
+private:
+sal_Int32 & m_rReferenceDigestID;
+
 public:
 DsDigestMethodContext(XSecParser & rParser,
-std::unique_ptr pOldNamespaceMap)
+std::unique_ptr pOldNamespaceMap,
+sal_Int32 & rReferenceDigestID)
 : XSecParser::Context(rParser, std::move(pOldNamespaceMap))
+, m_rReferenceDigestID(rReferenceDigestID)
 {
 }
 
@@ -445,13 +450,13 @@ class XSecParser::DsDigestMethodContext
  && ouAlgorithm != ALGO_XMLDSIGSHA512,
  "xmlsecurity.helper", "Algorithm neither SHA1, 
SHA256 nor SHA512");
 if (ouAlgorithm == ALGO_XMLDSIGSHA1)
-m_rParser.m_nReferenceDigestID = 
css::xml::crypto::DigestID::SHA1;
+m_rReferenceDigestID = css::xml::crypto::DigestID::SHA1;
 else if (ouAlgorithm == ALGO_XMLDSIGSHA256)
-m_rParser.m_nReferenceDigestID = 
css::xml::crypto::DigestID::SHA256;
+m_rReferenceDigestID = css::xml::crypto::DigestID::SHA256;
 else if (ouAlgorithm == ALGO_XMLDSIGSHA512)
-m_rParser.m_nReferenceDigestID = 
css::xml::crypto::DigestID::SHA512;
+m_rReferenceDigestID = css::xml::crypto::DigestID::SHA512;
 else
-m_rParser.m_nReferenceDigestID = 0;
+m_rReferenceDigestID = 0;
 }
 }
 };
@@ -459,28 +464,29 @@ class XSecParser::DsDigestMethodContext
 class XSecParser::DsTransformContext
 : public XSecParser::Context
 {
+private:
+bool & m_rIsC14N;
+
 public:
 DsTransformContext(XSecParser & rParser,
-std::unique_ptr pOldNamespaceMap)
+std::unique_ptr pOldNamespaceMap,
+bool & rIsC14N)
 : XSecParser::Context(rParser, std::move(pOldNamespaceMap))
+, m_rIsC14N(rIsC14N)
 {
 }
 
 virtual void StartElement(
 css::uno::Reference const& xAttrs) 
override
 {
-if (m_rParser.m_bReferenceUnresolved)
-{
-OUString ouAlgorithm = xAttrs->getValueByName("Algorithm");
+OUString ouAlgorithm = xAttrs->getValueByName("Algorithm");
 
-if (ouAlgorithm == ALGO_C14N)
-/*
- * a xml stream
- */
-{
-m_rParser.m_pXSecController->addStreamReference( 
m_rParser.m_currentReferenceURI, false, m_rParser.m_nReferenceDigestID );
-m_rParser.m_bReferenceUnresolved = false;
-}
+if (ouAlgorithm == ALGO_C14N)
+/*
+ * a xml stream
+ */
+{
+m_rIsC14N = true;
 }
 }
 };
@@ -488,10 +494,15 @@ class XSecParser::DsTransformContext
 class XSecParser::DsTransformsContext
 : public XSecParser::Context
 {
+private:
+bool & m_rIsC14N;
+
 public:
 DsTransformsContext(XSecParser & rParser,
-std::unique_ptr pOldNamespaceMap)
+std::unique_ptr pOldNamespaceMap,
+bool & rIsC14N)
 : XSecParser::Context(rParser, std::move(pOldNamespaceMap))
+, m_rIsC14N(rIsC14N)
 {
 }
 
@@ -501,7 +512,7 @@ class XSecParser::DsTransformsContext
 {
 if (nNamespace == XML_NAMESPACE_DS && rName == "Transform")
 {
-return std::make_unique(m_rParser, 
std::move(pOldNamespaceMap));
+return std::make_unique(m_rParser, 
std::move(pOldNamespaceMap), m_rIsC14N);
 }
 return 
XSecParser::Context::CreateChildContext(std::move(pOldNamespaceMap), 
nNamespace, rName);
 }
@@ -510,6 +521,15 @@ class XSecParser::DsTransformsContext
 class XSecParser::DsReferenceContext
 : 

[Libreoffice-commits] core.git: xmlsecurity/source

2021-03-03 Thread Michael Stahl (via logerrit)
 xmlsecurity/source/helper/xsecparser.cxx |  153 +--
 xmlsecurity/source/helper/xsecparser.hxx |   14 --
 2 files changed, 65 insertions(+), 102 deletions(-)

New commits:
commit 59df9e70ce1a7ec797b836bda7f9642912febc53
Author: Michael Stahl 
AuthorDate: Thu Feb 18 18:23:42 2021 +0100
Commit: Michael Stahl 
CommitDate: Wed Mar 3 12:44:15 2021 +0100

xmlsecurity: move XSecParser state into contexts

Change-Id: Ic73b647798a91bd253d93970e2a9a3e11b208a1c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/58
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/xmlsecurity/source/helper/xsecparser.cxx 
b/xmlsecurity/source/helper/xsecparser.cxx
index 1f2045c5d0e3..b8c5581bad5c 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -98,6 +98,9 @@ auto XSecParser::Context::CreateChildContext(
 class XSecParser::LoPGPOwnerContext
 : public XSecParser::Context
 {
+private:
+OUString m_Value;
+
 public:
 LoPGPOwnerContext(XSecParser & rParser,
 std::unique_ptr pOldNamespaceMap)
@@ -105,26 +108,23 @@ class XSecParser::LoPGPOwnerContext
 {
 }
 
-virtual void StartElement(
-css::uno::Reference const& 
/*xAttrs*/) override
-{
-m_rParser.m_ouGpgOwner.clear();
-}
-
 virtual void EndElement() override
 {
-m_rParser.m_pXSecController->setGpgOwner( m_rParser.m_ouGpgOwner );
+m_rParser.m_pXSecController->setGpgOwner(m_Value);
 }
 
 virtual void Characters(OUString const& rChars) override
 {
-m_rParser.m_ouGpgOwner += rChars;
+m_Value += rChars;
 }
 };
 
 class XSecParser::DsPGPKeyPacketContext
 : public XSecParser::Context
 {
+private:
+OUString m_Value;
+
 public:
 DsPGPKeyPacketContext(XSecParser & rParser,
 std::unique_ptr pOldNamespaceMap)
@@ -132,26 +132,23 @@ class XSecParser::DsPGPKeyPacketContext
 {
 }
 
-virtual void StartElement(
-css::uno::Reference const& 
/*xAttrs*/) override
-{
-m_rParser.m_ouGpgCertificate.clear();
-}
-
 virtual void EndElement() override
 {
-m_rParser.m_pXSecController->setGpgCertificate( 
m_rParser.m_ouGpgCertificate );
+m_rParser.m_pXSecController->setGpgCertificate(m_Value);
 }
 
 virtual void Characters(OUString const& rChars) override
 {
-m_rParser.m_ouGpgCertificate += rChars;
+m_Value += rChars;
 }
 };
 
 class XSecParser::DsPGPKeyIDContext
 : public XSecParser::Context
 {
+private:
+OUString m_Value;
+
 public:
 DsPGPKeyIDContext(XSecParser & rParser,
 std::unique_ptr pOldNamespaceMap)
@@ -159,20 +156,14 @@ class XSecParser::DsPGPKeyIDContext
 {
 }
 
-virtual void StartElement(
-css::uno::Reference const& 
/*xAttrs*/) override
-{
-m_rParser.m_ouGpgKeyID.clear();
-}
-
 virtual void EndElement() override
 {
-m_rParser.m_pXSecController->setGpgKeyID( m_rParser.m_ouGpgKeyID );
+m_rParser.m_pXSecController->setGpgKeyID(m_Value);
 }
 
 virtual void Characters(OUString const& rChars) override
 {
-m_rParser.m_ouGpgKeyID += rChars;
+m_Value += rChars;
 }
 };
 
@@ -215,6 +206,9 @@ class XSecParser::DsPGPDataContext
 class XSecParser::DsX509CertificateContext
 : public XSecParser::Context
 {
+private:
+OUString m_Value;
+
 public:
 DsX509CertificateContext(XSecParser & rParser,
 std::unique_ptr pOldNamespaceMap)
@@ -222,26 +216,23 @@ class XSecParser::DsX509CertificateContext
 {
 }
 
-virtual void StartElement(
-css::uno::Reference const& 
/*xAttrs*/) override
-{
-m_rParser.m_ouX509Certificate.clear();
-}
-
 virtual void EndElement() override
 {
-m_rParser.m_pXSecController->setX509Certificate( 
m_rParser.m_ouX509Certificate );
+m_rParser.m_pXSecController->setX509Certificate(m_Value);
 }
 
 virtual void Characters(OUString const& rChars) override
 {
-m_rParser.m_ouX509Certificate += rChars;
+m_Value += rChars;
 }
 };
 
 class XSecParser::DsX509SerialNumberContext
 : public XSecParser::Context
 {
+private:
+OUString m_Value;
+
 public:
 DsX509SerialNumberContext(XSecParser & rParser,
 std::unique_ptr pOldNamespaceMap)
@@ -249,26 +240,23 @@ class XSecParser::DsX509SerialNumberContext
 {
 }
 
-virtual void StartElement(
-css::uno::Reference const& 
/*xAttrs*/) override
-{
-

[Libreoffice-commits] core.git: xmlsecurity/source

2021-02-17 Thread Noel (via logerrit)
 xmlsecurity/source/framework/signaturecreatorimpl.cxx  |2 
 xmlsecurity/source/framework/signatureverifierimpl.cxx |2 
 xmlsecurity/source/helper/documentsignaturehelper.cxx  |6 -
 xmlsecurity/source/helper/ooxmlsecexporter.cxx |   66 -
 xmlsecurity/source/helper/xsecctl.cxx  |4 -
 xmlsecurity/source/helper/xsecsign.cxx |6 -
 xmlsecurity/source/xmlsec/nss/ciphercontext.cxx|2 
 7 files changed, 43 insertions(+), 45 deletions(-)

New commits:
commit 9cc2b07ff5e610258aad2ec2b72e6b1ea15fd5e2
Author: Noel 
AuthorDate: Wed Feb 17 18:23:54 2021 +0200
Commit: Noel Grandin 
CommitDate: Thu Feb 18 08:17:13 2021 +0100

loplugin:referencecasting in xmlsecurity

Change-Id: I038c4f85250b4d8d8fef605fd90f6fa53bbffe9f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111079
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/framework/signaturecreatorimpl.cxx 
b/xmlsecurity/source/framework/signaturecreatorimpl.cxx
index a3d8cd45814e..bba7b9eb3933 100644
--- a/xmlsecurity/source/framework/signaturecreatorimpl.cxx
+++ b/xmlsecurity/source/framework/signaturecreatorimpl.cxx
@@ -73,7 +73,7 @@ void SignatureCreatorImpl::startEngine(const 
rtl::Reference 
xResultTemplate;
 try
 {
-xResultTemplate = 
m_xXMLSignature->generate(css::uno::Reference(xSignatureTemplate.get()),
 m_xSecurityEnvironment);
+xResultTemplate = 
m_xXMLSignature->generate(css::uno::Reference(xSignatureTemplate),
 m_xSecurityEnvironment);
 m_nStatus = xResultTemplate->getStatus();
 }
 catch( css::uno::Exception& )
diff --git a/xmlsecurity/source/framework/signatureverifierimpl.cxx 
b/xmlsecurity/source/framework/signatureverifierimpl.cxx
index 4daf8d203c6a..c00086adee9b 100644
--- a/xmlsecurity/source/framework/signatureverifierimpl.cxx
+++ b/xmlsecurity/source/framework/signatureverifierimpl.cxx
@@ -64,7 +64,7 @@ void SignatureVerifierImpl::startEngine( const 
rtl::Reference 
xResultTemplate;
 try
 {
-xResultTemplate = 
m_xXMLSignature->validate(css::uno::Reference(xSignatureTemplate.get()),
 m_xXMLSecurityContext);
+xResultTemplate = 
m_xXMLSignature->validate(css::uno::Reference(xSignatureTemplate),
 m_xXMLSecurityContext);
 m_nStatus = xResultTemplate->getStatus();
 }
 catch( css::uno::Exception& )
diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx 
b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index 5ff74dcd325c..2784298acf8c 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -494,7 +494,7 @@ void DocumentSignatureHelper::writeDigestMethod(
 {
 rtl::Reference pAttributeList(new 
SvXMLAttributeList());
 pAttributeList->AddAttribute("Algorithm", ALGO_XMLDSIGSHA256);
-xDocumentHandler->startElement("DigestMethod", 
uno::Reference(pAttributeList.get()));
+xDocumentHandler->startElement("DigestMethod", 
uno::Reference(pAttributeList));
 xDocumentHandler->endElement("DigestMethod");
 }
 
@@ -506,7 +506,7 @@ void DocumentSignatureHelper::writeSignedProperties(
 {
 rtl::Reference pAttributeList(new 
SvXMLAttributeList());
 pAttributeList->AddAttribute("Id", "idSignedProperties");
-xDocumentHandler->startElement("xd:SignedProperties", 
uno::Reference(pAttributeList.get()));
+xDocumentHandler->startElement("xd:SignedProperties", 
uno::Reference(pAttributeList));
 }
 
 xDocumentHandler->startElement("xd:SignedSignatureProperties", 
uno::Reference(new SvXMLAttributeList()));
@@ -548,7 +548,7 @@ void DocumentSignatureHelper::writeSignedProperties(
 "xmlns:loext", 
"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0");
 xDocumentHandler->startElement(
 "loext:SignatureLine",
-Reference(pAttributeList.get()));
+Reference(pAttributeList));
 
 {
 // Write SignatureLineId element
diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx 
b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index f09c388686aa..43a89811619b 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -123,8 +123,8 @@ void OOXMLSecExporter::Impl::writeCanonicalizationMethod()
 {
 rtl::Reference pAttributeList(new 
SvXMLAttributeList());
 pAttributeList->AddAttribute("Algorithm", ALGO_C14N);
-m_xDocumentHandler->startElement(
-"CanonicalizationMethod", 
uno::Reference(pAttributeList.get()));
+m_xDocumentHandler->startElement("CanonicalizationMethod",
+ 
uno::Reference(pAttributeList));
 m_xDocumentHandler->endElement("CanonicalizationMethod");
 }
 
@@ -132,8 +132,8 @@ void 
OOXMLSecExporter::Impl::writeCanonicalizationTransform()
 {
 rtl::Reference pAttributeList(new 

[Libreoffice-commits] core.git: xmlsecurity/source

2021-02-08 Thread Tarun Sharma (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |3 
+--
 xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx   |3 
+--
 xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx  |3 
+--
 xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx|3 
+--
 xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx  |3 
+--
 xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx   |3 
+--
 xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx|3 
+--
 7 files changed, 7 insertions(+), 14 deletions(-)

New commits:
commit 624ba772858d9bf56fd2ff2de555740bbef5593a
Author: Tarun Sharma 
AuthorDate: Sun Jan 24 23:03:13 2021 +0530
Commit: Stephan Bergmann 
CommitDate: Mon Feb 8 15:39:01 2021 +0100

tdf#88205: Adapt uses of css::uno::Sequence to use initializer_list ctor

Change-Id: Ib7f122b20734ad51c6326e369e5e7eee1bf08a21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109861
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index c62c96d77328..1540db695b54 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -169,8 +169,7 @@ sal_Bool SAL_CALL 
SecurityEnvironment_MSCryptImpl::supportsService( const OUStri
 }
 /* XServiceInfo */
 uno::Sequence< OUString > SAL_CALL 
SecurityEnvironment_MSCryptImpl::getSupportedServiceNames() {
-uno::Sequence seqServiceNames { 
"com.sun.star.xml.crypto.SecurityEnvironment" };
-return seqServiceNames ;
+return { "com.sun.star.xml.crypto.SecurityEnvironment" };
 }
 
 /* XUnoTunnel */
diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
index 00b6e12f7aac..f194106eea5f 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
@@ -161,8 +161,7 @@ sal_Bool SAL_CALL 
SEInitializer_MSCryptImpl::supportsService( const OUString& rS
 
 uno::Sequence< OUString > SAL_CALL 
SEInitializer_MSCryptImpl::getSupportedServiceNames()
 {
-uno::Sequence aRet { "com.sun.star.xml.crypto.SEInitializer" };
-return aRet;
+return { "com.sun.star.xml.crypto.SEInitializer" };
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
index 2f33df7c911c..7d71d4863894 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
@@ -142,8 +142,7 @@ sal_Bool SAL_CALL 
XMLSecurityContext_MSCryptImpl::supportsService( const OUStrin
 
 /* XServiceInfo */
 uno::Sequence< OUString > SAL_CALL 
XMLSecurityContext_MSCryptImpl::getSupportedServiceNames() {
-uno::Sequence seqServiceNames { 
"com.sun.star.xml.crypto.XMLSecurityContext" };
-return seqServiceNames ;
+return { "com.sun.star.xml.crypto.XMLSecurityContext" };
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
index dcbad0348091..3bc02d161722 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
@@ -291,8 +291,7 @@ return cppu::supportsService(this, serviceName);
 
 /* XServiceInfo */
 Sequence< OUString > SAL_CALL 
XMLSignature_MSCryptImpl::getSupportedServiceNames() {
-Sequence seqServiceNames { 
"com.sun.star.xml.crypto.XMLSignature" };
-return seqServiceNames ;
+return { "com.sun.star.xml.crypto.XMLSignature" };
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx
index 2566a40accfb..42d03f2dd81a 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx
@@ -136,8 +136,7 @@ sal_Bool SAL_CALL 
XMLSecurityContext_NssImpl::supportsService( const OUString& s
 
 /* XServiceInfo */
 uno::Sequence< OUString > SAL_CALL 
XMLSecurityContext_NssImpl::getSupportedServiceNames() {
-uno::Sequence seqServiceNames { 
"com.sun.star.xml.crypto.XMLSecurityContext" };
-return seqServiceNames ;
+return { "com.sun.star.xml.crypto.XMLSecurityContext" };
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx 

[Libreoffice-commits] core.git: xmlsecurity/source

2021-02-04 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   13 +-
 1 file changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 6f7f9e4d19b38d6f51f032ee3d7b99d5bbdb5b75
Author: Caolán McNamara 
AuthorDate: Thu Feb 4 11:44:50 2021 +
Commit: Caolán McNamara 
CommitDate: Thu Feb 4 16:14:59 2021 +0100

log why status wasn't SECSuccess

Change-Id: Ibdbfdb9c6fd25165d584d35475909f0085896898
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110410
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index ccf61e106e57..1d2a7c2ec08f 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -448,7 +448,11 @@ X509Certificate_NssImpl* 
SecurityEnvironment_NssImpl::createAndAddCertificateFro
 aStatus = CERT_DecodeTrustString(, aTrustString.getStr());
 
 if (aStatus != SECSuccess)
+{
+PRIntn err = PR_GetError();
+SAL_WARN("xmlsecurity.xmlsec", "Error: " <<  err << ": " << 
getCertError(err));
 return nullptr;
+}
 
 PK11SlotInfo* pSlot = PK11_GetInternalKeySlot();
 
@@ -458,13 +462,20 @@ X509Certificate_NssImpl* 
SecurityEnvironment_NssImpl::createAndAddCertificateFro
 aStatus = PK11_ImportCert(pSlot, pCERTCertificate, CK_INVALID_HANDLE, 
nullptr, PR_FALSE);
 
 if (aStatus != SECSuccess)
+{
+PRIntn err = PR_GetError();
+SAL_WARN("xmlsecurity.xmlsec", "Error: " <<  err << ": " << 
getCertError(err));
 return nullptr;
+}
 
 aStatus = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), pCERTCertificate, 
);
 
 if (aStatus != SECSuccess)
+{
+PRIntn err = PR_GetError();
+SAL_WARN("xmlsecurity.xmlsec", "Error: " <<  err << ": " << 
getCertError(err));
 return nullptr;
-
+}
 
 PK11_FreeSlot(pSlot);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-11-25 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 5e4c771c0b89452ab55d1ab30dbb1634f15d3775
Author: Stephan Bergmann 
AuthorDate: Wed Nov 25 09:45:24 2020 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 25 10:53:58 2020 +0100

loplugin:stringviewparam (clang-cl)

Change-Id: Id93a1c48cd0cc1aa8370498ce239035fc5c01730
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106570
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
index de00d18a1930..1672a21c7868 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/x509certificate_mscryptimpl.cxx
@@ -36,6 +36,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -56,7 +57,7 @@ using ::com::sun::star::util::DateTime ;
 If the type name is not found then pair.first and pair.second are -1.
 */
 static std::pair< sal_Int32, sal_Int32 >
-findTypeInDN(const OUString& rRawString, const OUString& sTypeName)
+findTypeInDN(const OUString& rRawString, std::u16string_view sTypeName)
 {
 std::pair< sal_Int32, sal_Int32 > retVal;
 bool bInEscape = false;
@@ -160,7 +161,7 @@ findTypeInDN(const OUString& rRawString, const OUString& 
sTypeName)
 
 static OUString replaceTagSWithTagST(OUString const & oldDN)
 {
-std::pair pairIndex = findTypeInDN(oldDN, "S");
+std::pair pairIndex = findTypeInDN(oldDN, u"S");
 
 if (pairIndex.first != -1)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-10-21 Thread Miklos Vajna (via logerrit)
 xmlsecurity/source/helper/pdfsignaturehelper.cxx |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

New commits:
commit b16d11c9d85f60867f634f5049e38c1f62d8d412
Author: Miklos Vajna 
AuthorDate: Tue Oct 20 21:07:23 2020 +0200
Commit: Miklos Vajna 
CommitDate: Wed Oct 21 14:44:31 2020 +0200

xmlsecurity: clean up last raw pdfium call

Change-Id: I4e6f28ef181fff5b7fc431aa01763370bb48476d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104577
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx 
b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index 6864c715cb86..f7427337fd1e 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
@@ -231,13 +231,17 @@ void AnalyizeSignatureStream(SvMemoryStream& rStream, 
std::vector pPdfDocument
+= pPdfium->openDocument(rStream.GetData(), rStream.GetSize());
+if (!pPdfDocument)
+{
+return;
+}
 
-int nPageCount = aPdfDocument.getPageCount();
+int nPageCount = pPdfDocument->getPageCount();
 for (int nPage = 0; nPage < nPageCount; ++nPage)
 {
-std::unique_ptr 
pPdfPage(aPdfDocument.openPage(nPage));
+std::unique_ptr pPdfPage = 
pPdfDocument->openPage(nPage);
 if (!pPdfPage)
 {
 return;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-10-21 Thread Tor Lillqvist (via logerrit)
 xmlsecurity/source/helper/pdfsignaturehelper.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5100a06c15ee8d66dc88f58523a35014988fd9fe
Author: Tor Lillqvist 
AuthorDate: Wed Oct 21 10:22:39 2020 +0300
Commit: Tor Lillqvist 
CommitDate: Wed Oct 21 13:24:00 2020 +0200

Avoid unused parameter 'nMDPPerm'

Change-Id: I3ae13c66d76a61e197f214b2ffa8299de89a7a53
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104612
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist 

diff --git a/xmlsecurity/source/helper/pdfsignaturehelper.cxx 
b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
index a1dde44aaeb7..6864c715cb86 100644
--- a/xmlsecurity/source/helper/pdfsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/pdfsignaturehelper.cxx
@@ -285,6 +285,7 @@ bool IsValidSignature(SvStream& rStream, 
vcl::filter::PDFObjectElement* pSignatu
 return aSignedPages == aAllPages;
 #else
 (void)rStream;
+(void)nMDPPerm;
 return true;
 #endif
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-10-02 Thread Mert Tumer (via logerrit)
 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 16a7f98f99d334ea865b800e0b32d6fed1483942
Author: Mert Tumer 
AuthorDate: Wed Sep 30 17:14:59 2020 +0300
Commit: Andras Timar 
CommitDate: Fri Oct 2 22:54:07 2020 +0200

Fix libnssckbi not found error on Android

This error causes Android App to be unable to
open Password-protected documents.

Change-Id: Iacbacb1c780025752e2447db325b075c58947818
Signed-off-by: Mert Tumer 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103658
Tested-by: Jenkins
Reviewed-by: Andras Timar 

diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx 
b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index 1d6dcda2f315..b8acdc059cf8 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -430,7 +430,7 @@ bool 
nsscrypto_initialize(css::uno::Reference const
 
 if (true)
 #else
-#if defined SYSTEM_NSS
+#if defined SYSTEM_NSS || defined ANDROID
 OUString rootModule("libnssckbi" SAL_DLLEXTENSION);
 #else
 OUString rootModule("${LO_LIB_DIR}/libnssckbi" SAL_DLLEXTENSION);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-09-06 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/pdfio/pdfdocument.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 01e0d6acc448506fc9c5d86680249892df3e5ed5
Author: Noel Grandin 
AuthorDate: Sat Sep 5 21:18:03 2020 +0200
Commit: Noel Grandin 
CommitDate: Sun Sep 6 08:46:36 2020 +0200

fix non-pdfium build

Change-Id: I996164480d75ca3739942f6a1c06bbb4a1c400d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102085
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/pdfio/pdfdocument.cxx 
b/xmlsecurity/source/pdfio/pdfdocument.cxx
index c132d02cc2b0..e7a25d821b9a 100644
--- a/xmlsecurity/source/pdfio/pdfdocument.cxx
+++ b/xmlsecurity/source/pdfio/pdfdocument.cxx
@@ -160,6 +160,7 @@ void AnalyizeSignatureStream(SvMemoryStream& rStream, 
std::vectorhttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-08-31 Thread Miklos Vajna (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 3ba1144cb96c710e665ffb3ada26fb6a48a03472
Author: Miklos Vajna 
AuthorDate: Mon Aug 31 13:34:17 2020 +0200
Commit: Miklos Vajna 
CommitDate: Mon Aug 31 21:28:14 2020 +0200

xmlsecurity: fix infobar vs signature dialog inconsistency

The infobar mentioned if a signature is partial, but the dialog just has
a bool UI for signatures. Then present "good, but partial" as "bad".

Change-Id: I698190aa77702000b11d635bd038d9c9a91614ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101712
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index ff0ce32ec7d7..512df9a17460 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -605,8 +605,17 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox()
 
 if ( bSigValid )
 {
-bSigValid = DocumentSignatureHelper::checkIfAllFilesAreSigned(
-  aElementsToBeVerified, rInfo, mode);
+if (maSignatureManager.getStore().is())
+{
+// XML based.
+bSigValid = 
DocumentSignatureHelper::checkIfAllFilesAreSigned(
+  aElementsToBeVerified, rInfo, mode);
+}
+else
+{
+// Assume PDF.
+bSigValid = !rInfo.bPartialDocumentSignature;
+}
 
 if( bSigValid )
 nValidSigs++;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-06-26 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/dialogs/certificateviewer.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 3fe185a4eae857e13cba878447614e455c601f6a
Author: Stephan Bergmann 
AuthorDate: Fri Jun 26 13:19:22 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Jun 26 14:37:13 2020 +0200

Upcoming improved loplugin:elidestringvar: xmlsecurity

Change-Id: I1490e79489a98dd97ec31d6b52b4f05a1411de79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97212
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx 
b/xmlsecurity/source/dialogs/certificateviewer.cxx
index ea87640472c4..0dc981b052db 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -356,7 +356,7 @@ void CertificateViewerCertPathTP::InsertCert(const 
weld::TreeIter* pParent, cons
  const css::uno::Reference< 
css::security::XCertificate >& rxCert,
  bool bValid)
 {
-OUString sImage = bValid ? OUStringLiteral(BMP_CERT_OK) : 
OUStringLiteral(BMP_CERT_NOT_OK);
+auto const sImage = bValid ? OUStringLiteral(BMP_CERT_OK) : 
OUStringLiteral(BMP_CERT_NOT_OK);
 maUserData.emplace_back(std::make_unique(rxCert, 
bValid));
 OUString 
sId(OUString::number(reinterpret_cast(maUserData.back().get(;
 mxCertPathLB->insert(pParent, -1, , , nullptr, nullptr, false, 
mxScratchIter.get());
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-04-29 Thread Samuel Mehrbrodt (via logerrit)
 xmlsecurity/source/component/documentdigitalsignatures.cxx |  130 ++---
 1 file changed, 66 insertions(+), 64 deletions(-)

New commits:
commit cf36fe5eb41910c26d58fb25e54ccf2e0ee01365
Author: Samuel Mehrbrodt 
AuthorDate: Wed Apr 29 07:42:24 2020 +0200
Commit: Samuel Mehrbrodt 
CommitDate: Wed Apr 29 09:23:49 2020 +0200

Remove unnecessary if block

And format code inside

Change-Id: Ied0d98935134bf6f7bc8c929645ad5faac9affa3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93116
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt 

diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx 
b/xmlsecurity/source/component/documentdigitalsignatures.cxx
index 777158a40157..9a697d1f15f0 100644
--- a/xmlsecurity/source/component/documentdigitalsignatures.cxx
+++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx
@@ -519,85 +519,87 @@ DocumentDigitalSignatures::ImplVerifySignatures(
 Sequence< css::security::DocumentSignatureInformation > aInfos(nInfos);
 css::security::DocumentSignatureInformation* arInfos = aInfos.getArray();
 
-if ( nInfos )
+for (int n = 0; n < nInfos; ++n)
 {
-for( int n = 0; n < nInfos; ++n )
-{
-DocumentSignatureAlgorithm mode = 
DocumentSignatureHelper::getDocumentAlgorithm(
-m_sODFVersion, aSignInfos[n]);
-const std::vector< OUString > aElementsToBeVerified =
-DocumentSignatureHelper::CreateElementList(
-rxStorage, eMode, mode);
+DocumentSignatureAlgorithm mode
+= DocumentSignatureHelper::getDocumentAlgorithm(m_sODFVersion, 
aSignInfos[n]);
+const std::vector aElementsToBeVerified
+= DocumentSignatureHelper::CreateElementList(rxStorage, eMode, 
mode);
 
-const SignatureInformation& rInfo = aSignInfos[n];
-css::security::DocumentSignatureInformation& rSigInfo = arInfos[n];
+const SignatureInformation& rInfo = aSignInfos[n];
+css::security::DocumentSignatureInformation& rSigInfo = arInfos[n];
 
-if (rInfo.ouGpgCertificate.isEmpty()) // X.509
+if (rInfo.ouGpgCertificate.isEmpty()) // X.509
+{
+if (!rInfo.ouX509Certificate.isEmpty())
+rSigInfo.Signer = 
xSecEnv->createCertificateFromAscii(rInfo.ouX509Certificate);
+if (!rSigInfo.Signer.is())
+rSigInfo.Signer = xSecEnv->getCertificate(
+rInfo.ouX509IssuerName,
+
xmlsecurity::numericStringToBigInteger(rInfo.ouX509SerialNumber));
+
+// On Windows checking the certificate path is buggy. It does name 
matching (issuer, subject name)
+// to find the parent certificate. It does not take into account 
that there can be several certificates
+// with the same subject name.
+try
 {
-if (!rInfo.ouX509Certificate.isEmpty())
-rSigInfo.Signer = xSecEnv->createCertificateFromAscii( 
rInfo.ouX509Certificate ) ;
-if (!rSigInfo.Signer.is())
-rSigInfo.Signer = xSecEnv->getCertificate( 
rInfo.ouX509IssuerName,
-   
xmlsecurity::numericStringToBigInteger( rInfo.ouX509SerialNumber ) );
-
-// On Windows checking the certificate path is buggy. It does 
name matching (issuer, subject name)
-// to find the parent certificate. It does not take into 
account that there can be several certificates
-// with the same subject name.
-
-try {
-rSigInfo.CertificateStatus = 
xSecEnv->verifyCertificate(rSigInfo.Signer,
-
Sequence >());
-} catch (SecurityException& ) {
-OSL_FAIL("Verification of certificate failed");
-rSigInfo.CertificateStatus = 
css::security::CertificateValidity::INVALID;
-}
+rSigInfo.CertificateStatus = xSecEnv->verifyCertificate(
+rSigInfo.Signer, 
Sequence>());
 }
-else if (xGpgSecEnv.is()) // GPG
+catch (SecurityException&)
 {
-// TODO not ideal to retrieve cert by keyID, might
-// collide, or PGPKeyID format might change - can't we
-// keep the xCert itself in rInfo?
-rSigInfo.Signer = xGpgSecEnv->getCertificate( 
rInfo.ouGpgKeyID, xmlsecurity::numericStringToBigInteger("") );
-rSigInfo.CertificateStatus = 
xGpgSecEnv->verifyCertificate(rSigInfo.Signer,
-   
Sequence >());
+OSL_FAIL("Verification of certificate failed");
+rSigInfo.CertificateStatus = 
css::security::CertificateValidity::INVALID;
 

[Libreoffice-commits] core.git: xmlsecurity/source

2020-04-02 Thread Mike Kaganski (via logerrit)
 xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx  |2 +-
 xmlsecurity/source/xmlsec/errorcallback.cxx  |5 
+++--
 xmlsecurity/source/xmlsec/mscrypt/akmngr.cxx |4 

 xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx  |3 ++-
 xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx |4 
++--
 xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx   |3 +--
 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx   |2 +-
 xmlsecurity/source/xmlsec/xmlsec_init.cxx|4 
+++-
 xmlsecurity/source/xmlsec/xmlstreamio.cxx|4 
++--
 9 files changed, 19 insertions(+), 12 deletions(-)

New commits:
commit e946e8f2280a5955a7fe6f8035d7ffad6862a6b3
Author: Mike Kaganski 
AuthorDate: Wed Apr 1 19:53:33 2020 +0300
Commit: Miklos Vajna 
CommitDate: Thu Apr 2 09:54:26 2020 +0200

xmlsec-wrapper.h must be included before any xmlsec header

This fixes structs size mismatch between xmlsec and its users because
of XMLSEC_NO_SIZE_T not yet defined at the time of their definition.

See 
https://lists.freedesktop.org/archives/libreoffice/2020-April/084800.html

Change-Id: I8de9a012f849d9a5a84f5ce580484b66192d1e06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91531
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx 
b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
index f11a3680f2ea..3b4e138aebee 100644
--- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
+++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -41,7 +42,6 @@
 #include 
 
 #include "SecurityEnvironment.hxx"
-#include 
 
 using namespace css::uno;
 using namespace css::lang;
diff --git a/xmlsecurity/source/xmlsec/errorcallback.cxx 
b/xmlsecurity/source/xmlsec/errorcallback.cxx
index 0749524056cb..a535ffa770d3 100644
--- a/xmlsecurity/source/xmlsec/errorcallback.cxx
+++ b/xmlsecurity/source/xmlsec/errorcallback.cxx
@@ -17,10 +17,11 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include 
-
+#include 
 #include 
 
+#include 
+
 #include 
 #include 
 
diff --git a/xmlsecurity/source/xmlsec/mscrypt/akmngr.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/akmngr.cxx
index 48598aed1417..ec3cecd4a751 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/akmngr.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/akmngr.cxx
@@ -16,6 +16,10 @@
  *   except in compliance with the License. You may obtain a copy of
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
+
+#include 
+#include 
+
 #include "akmngr.hxx"
 
 #include 
diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
index cceedb869ba2..00b6e12f7aac 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
@@ -17,12 +17,13 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include 
+#include 
 
 #include "seinitializer_mscryptimpl.hxx"
 
 #include "securityenvironment_mscryptimpl.hxx"
 
-#include 
 #include 
 #include 
 #include 
diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
index 9d5b4df3e845..2f33df7c911c 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
@@ -18,14 +18,14 @@
  */
 
 #include 
+#include 
+
 #include 
 #include "securityenvironment_mscryptimpl.hxx"
 
 #include 
 #include "akmngr.hxx"
 
-#include 
-
 #include 
 
 using namespace ::com::sun::star;
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
index bed9cbd07213..dcbad0348091 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -31,8 +32,6 @@
 #include 
 #include 
 
-#include 
-
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno ;
 using namespace ::com::sun::star::lang ;
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
index 834bf57694fa..32e4335a5207 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
@@ -18,6 +18,7 @@
  */
 
 #include 
+#include 
 
 #include 
 #include 
@@ -25,7 +26,6 @@
 
 #include "securityenvironment_nssimpl.hxx"
 
-#include 
 #include 
 #include 
 
diff 

[Libreoffice-commits] core.git: xmlsecurity/source

2020-04-01 Thread Mike Kaganski (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |4 
+---
 1 file changed, 1 insertion(+), 3 deletions(-)

New commits:
commit 923cc749536013f4a11d96ab085c4e730e160d6d
Author: Mike Kaganski 
AuthorDate: Wed Apr 1 15:04:31 2020 +0100
Commit: Mike Kaganski 
CommitDate: Wed Apr 1 16:56:15 2020 +0200

Drop useless initialization immediately before reassignment

Change-Id: Id3d05de26ac9078a316de49ea2a5f6af26876107
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91507
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index d296d885e0f3..0434d0b9d2d9 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -991,12 +991,10 @@ OUString 
SecurityEnvironment_MSCryptImpl::getSecurityEnvironmentInformation()
 
 xmlSecKeysMngrPtr SecurityEnvironment_MSCryptImpl::createKeysManager() {
 
-xmlSecKeysMngrPtr pKeysMngr = nullptr ;
-
 /*-
  * The following lines is based on the of xmlsec-mscrypto crypto engine
  */
-pKeysMngr = xmlsecurity::MSCryptoAppliedKeysMngrCreate() ;
+xmlSecKeysMngrPtr pKeysMngr = xmlsecurity::MSCryptoAppliedKeysMngrCreate() 
;
 if( pKeysMngr == nullptr )
 throw uno::RuntimeException() ;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-02-03 Thread iakarsu (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx |   10 
+++---
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit fbebfdaa83efa94cbb0b39d6c2e2dc62488ae1ac
Author: iakarsu 
AuthorDate: Mon Jan 27 11:50:19 2020 +0300
Commit: Stephan Bergmann 
CommitDate: Mon Feb 3 15:40:05 2020 +0100

tdf:#54938Adapt supportsService implementations to cppu::supportsService

Change-Id: I9e2dbdfb8bbf5be4a74b1b581e742b3193b3756b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87496
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
index 4aefafa30a32..9d5b4df3e845 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
@@ -26,6 +26,8 @@
 
 #include 
 
+#include 
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::lang ;
 using ::com::sun::star::lang::XMultiServiceFactory ;
@@ -135,13 +137,7 @@ OUString SAL_CALL 
XMLSecurityContext_MSCryptImpl::getImplementationName() {
 
 /* XServiceInfo */
 sal_Bool SAL_CALL XMLSecurityContext_MSCryptImpl::supportsService( const 
OUString& serviceName) {
-uno::Sequence< OUString > seqServiceNames = getSupportedServiceNames() ;
-const OUString* pArray = seqServiceNames.getConstArray() ;
-for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) {
-if( *( pArray + i ) == serviceName )
-return true ;
-}
-return false ;
+return cppu::supportsService(this, serviceName);
 }
 
 /* XServiceInfo */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-02-03 Thread Hakan Bakacak (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx |9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

New commits:
commit 7edce6c3a5df7787a4bd25e55301d57f300834b8
Author: Hakan Bakacak 
AuthorDate: Mon Jan 27 12:17:24 2020 +0300
Commit: Stephan Bergmann 
CommitDate: Mon Feb 3 15:34:25 2020 +0100

tdf#54938: Adapt supportsService implementations to cppu::supportsService

Change-Id: I4f6defffc7489ae95af3e2758327a26374795969
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87501
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
index 43f294ba5a10..bed9cbd07213 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
@@ -29,6 +29,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -286,13 +287,7 @@ OUString SAL_CALL 
XMLSignature_MSCryptImpl::getImplementationName() {
 
 /* XServiceInfo */
 sal_Bool SAL_CALL XMLSignature_MSCryptImpl::supportsService( const OUString& 
serviceName) {
-Sequence< OUString > seqServiceNames = getSupportedServiceNames() ;
-const OUString* pArray = seqServiceNames.getConstArray() ;
-for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) {
-if( *( pArray + i ) == serviceName )
-return true ;
-}
-return false ;
+return cppu::supportsService(this, serviceName);
 }
 
 /* XServiceInfo */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-02-01 Thread Canberk TURAN (via logerrit)
 xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx |4 
+--
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |   11 
+-
 2 files changed, 4 insertions(+), 11 deletions(-)

New commits:
commit a2c9b446243c153653537227da4731ebc945fb73
Author: Canberk TURAN 
AuthorDate: Mon Jan 27 11:01:25 2020 +0300
Commit: Muhammet Kara 
CommitDate: Sat Feb 1 10:20:28 2020 +0100

tdf#54938: Adapt supportsService implementations to cppu::supportsService

Change-Id: I82fa5528c879f288822fe9795d7d7da19f0abbee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87485
Tested-by: Jenkins
Reviewed-by: Muhammet Kara 

diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx 
b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
index 586a8f70c7a1..de6cf54cd206 100644
--- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
+++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::com::sun::star::uno ;
 using ::com::sun::star::lang::XMultiServiceFactory ;
@@ -97,8 +98,7 @@ OUString SAL_CALL 
XMLSignatureTemplateImpl::getImplementationName() {
 
 /* XServiceInfo */
 sal_Bool SAL_CALL XMLSignatureTemplateImpl::supportsService( const OUString& 
serviceName) {
-Sequence< OUString > seqServiceNames = getSupportedServiceNames() ;
-return comphelper::findValue(seqServiceNames, serviceName) != -1;
+return cppu::supportsService(this, serviceName);
 }
 
 /* XServiceInfo */
diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index e1e7b8d12760..d296d885e0f3 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -34,7 +34,7 @@
 #include "x509certificate_mscryptimpl.hxx"
 #include 
 #include 
-
+#include 
 #include 
 #include "akmngr.hxx"
 
@@ -164,15 +164,8 @@ OUString SAL_CALL 
SecurityEnvironment_MSCryptImpl::getImplementationName() {
 
 /* XServiceInfo */
 sal_Bool SAL_CALL SecurityEnvironment_MSCryptImpl::supportsService( const 
OUString& serviceName) {
-uno::Sequence< OUString > seqServiceNames = getSupportedServiceNames() ;
-const OUString* pArray = seqServiceNames.getConstArray() ;
-for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) {
-if( *( pArray + i ) == serviceName )
-return true ;
-}
-return false ;
+return cppu::supportsService(this, serviceName);
 }
-
 /* XServiceInfo */
 uno::Sequence< OUString > SAL_CALL 
SecurityEnvironment_MSCryptImpl::getSupportedServiceNames() {
 uno::Sequence seqServiceNames { 
"com.sun.star.xml.crypto.SecurityEnvironment" };
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-01-28 Thread Faruk Demirbaş (via logerrit)
 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit 627e40b9ef7ba8e9b5b06adc4a553d95cd5e5560
Author: Faruk Demirbaş 
AuthorDate: Mon Jan 27 14:58:22 2020 +0300
Commit: Muhammet Kara 
CommitDate: Tue Jan 28 21:18:50 2020 +0100

tdf#88205: Adapt uses of css::uno::Sequence to use initializer_list ctor

Change-Id: I0e792603435b7a1d9fcacf67a694ee8c4cc24a7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87516
Tested-by: Jenkins
Reviewed-by: Muhammet Kara 

diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
index 9f2c8e43acdc..834bf57694fa 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
@@ -304,8 +304,7 @@ sal_Bool SAL_CALL 
XMLSignature_NssImpl::supportsService(const OUString& rService
 /* XServiceInfo */
 Sequence SAL_CALL XMLSignature_NssImpl::getSupportedServiceNames()
 {
-Sequence seqServiceNames { 
"com.sun.star.xml.crypto.XMLSignature" };
-return seqServiceNames;
+return { "com.sun.star.xml.crypto.XMLSignature" };
 }
 
 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2020-01-06 Thread Yusuf Keten (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit c9253b9007059496521f24ef8348e80bb120e1e6
Author: Yusuf Keten 
AuthorDate: Wed Jan 1 00:27:27 2020 +0300
Commit: Stephan Bergmann 
CommitDate: Mon Jan 6 11:08:03 2020 +0100

tdf#54938 Adapt supportsService implementations to cppu::supportsService

Change-Id: I061db162c44a7196c58f4ae6dae2f37c7ac9213a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86057
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 1ac8d052b5c3..64caec48cce4 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include "securityenvironment_nssimpl.hxx"
+#include 
 #include 
 
 #include 
@@ -143,8 +144,7 @@ OUString SAL_CALL 
SecurityEnvironment_NssImpl::getImplementationName() {
 
 /* XServiceInfo */
 sal_Bool SAL_CALL SecurityEnvironment_NssImpl::supportsService( const 
OUString& serviceName) {
-Sequence< OUString > seqServiceNames = getSupportedServiceNames() ;
-return comphelper::findValue(seqServiceNames, serviceName) != -1;
+return cppu::supportsService(this, serviceName);
 }
 
 /* XServiceInfo */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2019-12-17 Thread Noel Grandin (via logerrit)
 xmlsecurity/source/xmlsec/nss/nssinitializer.cxx |   41 +--
 1 file changed, 9 insertions(+), 32 deletions(-)

New commits:
commit 998ad9b8b1d0eb08b2515ea2086b9f3de58492e7
Author: Noel Grandin 
AuthorDate: Tue Dec 17 13:40:44 2019 +0200
Commit: Noel Grandin 
CommitDate: Wed Dec 18 08:47:42 2019 +0100

Elide use of rtl_Instance (which is obsoleted by C++11 thread-safe statics)

Change-Id: I522c42d1fe97de2b1a8a629c97cf68e11006a328
Reviewed-on: https://gerrit.libreoffice.org/85327
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx 
b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index e268e6e25d63..421adfdf16e3 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -158,35 +157,6 @@ salhelper::SingletonRef* 
getInitNSSPrivate()
 
 bool nsscrypto_initialize( const css::uno::Reference< 
css::uno::XComponentContext > , bool & out_nss_init );
 
-struct InitNSSInitialize
-{
-css::uno::Reference< css::uno::XComponentContext > m_xContext;
-
-explicit InitNSSInitialize(const 
css::uno::Reference )
-: m_xContext(rxContext)
-{
-}
-
-bool * operator()()
-{
-static bool bInitialized = false;
-bool bNSSInit = false;
-bInitialized = nsscrypto_initialize( m_xContext, bNSSInit );
-if (bNSSInit)
-atexit(nsscrypto_finalize );
-return & bInitialized;
-}
-};
-
-struct GetNSSInitStaticMutex
-{
-::osl::Mutex* operator()()
-{
-static ::osl::Mutex aNSSInitMutex;
-return 
-}
-};
-
 #ifdef XMLSEC_CRYPTO_NSS
 
 void deleteRootsModule()
@@ -504,8 +474,15 @@ ONSSInitializer::~ONSSInitializer()
 
 bool ONSSInitializer::initNSS( const css::uno::Reference< 
css::uno::XComponentContext >  )
 {
-return *rtl_Instance< bool, InitNSSInitialize, ::osl::MutexGuard, 
GetNSSInitStaticMutex >
-::create( InitNSSInitialize( rxContext ), 
GetNSSInitStaticMutex() );
+static bool gbInitialized = []()
+{
+bool bNSSInit = false;
+bool bInitialized = nsscrypto_initialize( rxContext, bNSSInit );
+if (bNSSInit)
+atexit(nsscrypto_finalize);
+return bInitialized;
+}();
+return gbInitialized;
 }
 
 css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL 
ONSSInitializer::getDigestContext( ::sal_Int32 nDigestID, const 
css::uno::Sequence< css::beans::NamedValue >& aParams )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2019-08-20 Thread Franklin Weng (via logerrit)
 xmlsecurity/source/dialogs/certificatechooser.cxx |   16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 648990692c8253e3843c4c5954940e8b893d5f3e
Author: Franklin Weng 
AuthorDate: Sun Aug 18 21:30:05 2019 +0800
Commit: Katarina Behrens 
CommitDate: Tue Aug 20 15:14:48 2019 +0200

tdf#116862 do not encrypt to self when encryption key is not set

When "always encrypt to self" is checked but no encryption key is set,
encrypting a file with GPG key would cause error.  So check if
msPreferredKey is empty or not before comparing with sIssuer.

Change-Id: I4d95f0b436cb1fafad1d57d50330fd2080902b69
Reviewed-on: https://gerrit.libreoffice.org/77665
Tested-by: Jenkins
Reviewed-by: Katarina Behrens 

diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx 
b/xmlsecurity/source/dialogs/certificatechooser.cxx
index 32c688f2a257..795e9bf3ae07 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -220,13 +220,15 @@ void CertificateChooser::ImplInitialize()
 
 #if HAVE_FEATURE_GPGME
 // only GPG has preferred keys
-if ( sIssuer == msPreferredKey )
-{
-if ( meAction == UserAction::Sign || meAction == 
UserAction::SelectSign )
-m_xCertLB->select(nRow);
-else if ( meAction == UserAction::Encrypt &&
-  aUserOpts.GetEncryptToSelf() )
-mxEncryptToSelf = xCert;
+if ( !sIssuer.isEmpty() && !msPreferredKey.isEmpty() ) {
+if ( sIssuer == msPreferredKey )
+{
+if ( meAction == UserAction::Sign || meAction == 
UserAction::SelectSign )
+m_xCertLB->select(nRow);
+else if ( meAction == UserAction::Encrypt &&
+  aUserOpts.GetEncryptToSelf() )
+mxEncryptToSelf = xCert;
+}
 }
 #endif
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: xmlsecurity/source

2019-08-14 Thread Mike Kaganski (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   21 -
 1 file changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 7001ddff6303734f0276b863c9fd8908443f05da
Author: Mike Kaganski 
AuthorDate: Wed Aug 14 13:18:05 2019 +0200
Commit: Mike Kaganski 
CommitDate: Wed Aug 14 18:31:39 2019 +0200

Simplify OUString array initialization

Change-Id: I54945ed1ea2292ecc02ff988c4ecf310a9c4b87a
Reviewed-on: https://gerrit.libreoffice.org/77451
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 67545e3bb561..6f0407433f2f 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -454,15 +454,16 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, 
CertMgrButtonHdl, weld::Button&, void)
 // FIXME: call GpgME::dirInfo("bindir") somewhere in
 // SecurityEnvironmentGpg or whatnot
 // FIXME: perhaps poke GpgME for uiserver, and hope it returns something 
useful?
-const OUString aGUIServers[] = { OUString("Gpg4win\\kleopatra.exe"),
- OUString("Gpg4win\\bin\\kleopatra.exe"),
- OUString("GNU\\GnuPG\\kleopatra.exe"),
- OUString("GNU\\GnuPG\\launch-gpa.exe"),
- OUString("GNU\\GnuPG\\gpa.exe"),
- OUString("GnuPG\\bin\\gpa.exe"),
- 
OUString("GNU\\GnuPG\\bin\\kleopatra.exe"),
- 
OUString("GNU\\GnuPG\\bin\\launch-gpa.exe"),
- OUString("GNU\\GnuPG\\bin\\gpa.exe") };
+static const OUStringLiteral aGUIServers[] = { "Gpg4win\\kleopatra.exe",
+   
"Gpg4win\\bin\\kleopatra.exe",
+   "GNU\\GnuPG\\kleopatra.exe",
+   
"GNU\\GnuPG\\launch-gpa.exe",
+   "GNU\\GnuPG\\gpa.exe",
+   "GnuPG\\bin\\gpa.exe",
+   
"GNU\\GnuPG\\bin\\kleopatra.exe",
+   
"GNU\\GnuPG\\bin\\launch-gpa.exe",
+   "GNU\\GnuPG\\bin\\gpa.exe",
+ };
 static const OUString aPath = [] {
 OUString sRet;
 PWSTR sPath = nullptr;
@@ -478,7 +479,7 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, 
weld::Button&, void)
 if (aPath.isEmpty())
 return;
 #else
-const OUString aGUIServers[] = { OUString("kleopatra"), 
OUString("seahorse"),  OUString("gpa"), OUString("kgpg") };
+static const OUStringLiteral aGUIServers[] = { "kleopatra", "seahorse", 
"gpa", "kgpg" };
 const char* cPath = getenv("PATH");
 if (!cPath)
 return;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: xmlsecurity/source

2019-08-13 Thread Thorsten Behrens (via logerrit)
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit 536ab2f3ba1e71badaaf98db9419ca7c7ddd7ac4
Author: Thorsten Behrens 
AuthorDate: Mon Aug 12 11:26:04 2019 +0200
Commit: Xisco Faulí 
CommitDate: Tue Aug 13 16:35:01 2019 +0200

tdf#116085 add more Gpg4Win binary locations

Seems Gpg4Win recently grew a few more variants where to put stuff.
Look there, too.

Change-Id: Ifa09db11665671f518a6a66480c1a71fd619d8cd
Reviewed-on: https://gerrit.libreoffice.org/77341
Tested-by: Jenkins
Reviewed-by: Xisco Faulí 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 9ff40b864144..032171928c88 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -448,9 +448,14 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, CertMgrButtonHdl, 
weld::Button&, void)
 // FIXME: call GpgME::dirInfo("bindir") somewhere in
 // SecurityEnvironmentGpg or whatnot
 // FIXME: perhaps poke GpgME for uiserver, and hope it returns something 
useful?
-const OUString aGUIServers[] = { OUString("Gpg4win\\kleopatra.exe"), 
OUString("GNU\\GnuPG\\kleopatra.exe"),
- OUString("GNU\\GnuPG\\launch-gpa.exe"), 
OUString("GNU\\GnuPG\\gpa.exe"),
- 
OUString("GNU\\GnuPG\\bin\\kleopatra.exe"), 
OUString("GNU\\GnuPG\\bin\\launch-gpa.exe"),
+const OUString aGUIServers[] = { OUString("Gpg4win\\kleopatra.exe"),
+ OUString("Gpg4win\\bin\\kleopatra.exe"),
+ OUString("GNU\\GnuPG\\kleopatra.exe"),
+ OUString("GNU\\GnuPG\\launch-gpa.exe"),
+ OUString("GNU\\GnuPG\\gpa.exe"),
+ OUString("GnuPG\\bin\\gpa.exe"),
+ 
OUString("GNU\\GnuPG\\bin\\kleopatra.exe"),
+ 
OUString("GNU\\GnuPG\\bin\\launch-gpa.exe"),
  OUString("GNU\\GnuPG\\bin\\gpa.exe") };
 const char* const cPath = "C:\\Program Files (x86)";
 #else
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: xmlsecurity/source

2019-07-16 Thread Caolán McNamara (via logerrit)
 xmlsecurity/source/xmlsec/saxhelper.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 119619350237b83859295fd60980916ea32985d2
Author: Caolán McNamara 
AuthorDate: Mon Jul 15 20:22:30 2019 +0100
Commit: Caolán McNamara 
CommitDate: Tue Jul 16 10:57:02 2019 +0200

cid#1448421 unsafe_xml_parse_config

do we need this as 1 ?

Change-Id: I12cdec90f5ca989767a769dfc1dbebf73fae696c
Reviewed-on: https://gerrit.libreoffice.org/75658
Tested-by: Jenkins
Reviewed-by: Michael Stahl 

diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx 
b/xmlsecurity/source/xmlsec/saxhelper.cxx
index d9e71226a7b8..1410eb5b0874 100644
--- a/xmlsecurity/source/xmlsec/saxhelper.cxx
+++ b/xmlsecurity/source/xmlsec/saxhelper.cxx
@@ -118,7 +118,7 @@ SAXHelper::SAXHelper( )
  * compile error:
  * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS ;
  */
-xmlSubstituteEntitiesDefault( 1 ) ;
+xmlSubstituteEntitiesDefault(0) ;
 
 #ifndef XMLSEC_NO_XSLT
 xmlIndentTreeOutput = 1 ;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: xmlsecurity/source

2019-05-28 Thread Andrea Gelmini (via logerrit)
 xmlsecurity/source/helper/xsecctl.cxx |3 ---
 1 file changed, 3 deletions(-)

New commits:
commit 7ad929699d8dcdfbb0760fada6d4112ff525d9aa
Author: Andrea Gelmini 
AuthorDate: Tue May 28 10:34:26 2019 +
Commit: Julien Nabet 
CommitDate: Wed May 29 07:07:11 2019 +0200

Removed duplicated include

In any case is included a few lines after, so I guess it
can be removed the check (if it's not ready also for future
other includes).

Change-Id: Id603022092a60b71a5b35ec57930146d23c6544a
Reviewed-on: https://gerrit.libreoffice.org/73093
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/xmlsecurity/source/helper/xsecctl.cxx 
b/xmlsecurity/source/helper/xsecctl.cxx
index 7acb1b1974c1..d5f3da1c26f8 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -29,9 +29,6 @@
 
 #include 
 #include 
-#ifdef ANDROID
-#include 
-#endif
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: xmlsecurity/source

2019-05-27 Thread Miklos Vajna (via logerrit)
 xmlsecurity/source/helper/xsecctl.cxx |1 +
 1 file changed, 1 insertion(+)

New commits:
commit 5321d3228f61938584f659159c74d2e2f04abb78
Author: Miklos Vajna 
AuthorDate: Mon May 27 15:40:45 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon May 27 16:30:58 2019 +0200

xmlsecurity: add missing include

Broke the build on Ubuntu 18.04:

In file included from 
/home/tinderbox/core-master/workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/uno/XInterface.hpp:10:0,
 from 
/home/tinderbox/core-master/workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/uno/Exception.hpp:8,
 from 
/home/tinderbox/core-master/workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/uno/RuntimeException.hpp:8,
 from 
/home/tinderbox/core-master/include/com/sun/star/uno/Any.hxx:37,
 from 
/home/tinderbox/core-master/include/com/sun/star/uno/genfunc.hxx:27,
 from 
/home/tinderbox/core-master/include/com/sun/star/uno/Sequence.hxx:35,
 from 
/home/tinderbox/core-master/include/svl/sigstruct.hxx:27,
 from 
/home/tinderbox/core-master/xmlsecurity/inc/xsecctl.hxx:23,
 from 
/home/tinderbox/core-master/xmlsecurity/source/helper/xsecctl.cxx:22:
/home/tinderbox/core-master/include/com/sun/star/uno/Reference.hxx: In 
instantiation of ‘static com::sun::star::uno::XInterface* 
com::sun::star::uno::Reference<  
>::iquery(com::sun::star::uno::XInterface*) [with interface_type = 
com::sun::star::xml::crypto::XXMLSignature]’:
/home/tinderbox/core-master/include/com/sun/star/uno/Reference.hxx:279:42:  
 required from ‘bool com::sun::star::uno::Reference<  
>::set(const com::sun::star::uno::BaseReference&, 
com::sun::star::uno::UnoReference_Query) [with interface_type = 
com::sun::star::xml::crypto::XXMLSignature]’
/home/tinderbox/core-master/xmlsecurity/source/helper/xsecctl.cxx:190:124:  
 required from here
/home/tinderbox/core-master/include/com/sun/star/uno/Reference.hxx:70:73: 
error: incomplete type ‘com::sun::star::xml::crypto::XXMLSignature’ used in 
nested name specifier
 return BaseReference::iquery(pInterface, 
interface_type::static_type());
  ~~~^~
/home/tinderbox/core-master/solenv/gbuild/LinkTarget.mk:290: recipe for 
target 
'/home/tinderbox/core-master/workdir/CxxObject/xmlsecurity/source/helper/xsecctl.o'
 failed
make[1]: *** 
[/home/tinderbox/core-master/workdir/CxxObject/xmlsecurity/source/helper/xsecctl.o]
 Error 1

Change-Id: I864da5bd6d163a3de35280bff367e6b51aced23d
Reviewed-on: https://gerrit.libreoffice.org/73035
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/xmlsecurity/source/helper/xsecctl.cxx 
b/xmlsecurity/source/helper/xsecctl.cxx
index 6431d27e9c3c..7acb1b1974c1 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -34,6 +34,7 @@
 #endif
 #include 
 #include 
+#include 
 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: xmlsecurity/source

2019-05-27 Thread Stephan Bergmann (via logerrit)
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 256fccaf991cbc7d2f954c759e0ada6e2bd26c9e
Author: Stephan Bergmann 
AuthorDate: Mon May 27 09:43:24 2019 +0200
Commit: Stephan Bergmann 
CommitDate: Mon May 27 12:57:16 2019 +0200

operator new doesn't return null anyway

(and assigning nullptr to a null xcert was apparently redundant)

Change-Id: I8b6120248c042adcb2f787b8db0f28c14268212d
Reviewed-on: https://gerrit.libreoffice.org/73019
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index a5015bc87c55..7c0b4f2af489 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -797,11 +797,7 @@ X509Certificate_NssImpl* NssCertToXCert( CERTCertificate* 
cert )
 
 if( cert != nullptr ) {
 xcert = new X509Certificate_NssImpl() ;
-if( xcert == nullptr ) {
-xcert = nullptr ;
-} else {
-xcert->setCert( cert ) ;
-}
+xcert->setCert( cert ) ;
 } else {
 xcert = nullptr ;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: xmlsecurity/source

2019-05-08 Thread Julien Nabet (via logerrit)
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |2 +-
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx |2 +-
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |2 +-
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx |6 
+++---
 4 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 59278fa913116482c7d02e0729487ccd153545ae
Author: Julien Nabet 
AuthorDate: Wed May 8 11:15:50 2019 +0200
Commit: Noel Grandin 
CommitDate: Wed May 8 12:15:20 2019 +0200

Replace remaining lists by vectors in xmlsecurity

Change-Id: Ia7e47e8398a0022a281de2b8866e779d471909b0
Reviewed-on: https://gerrit.libreoffice.org/71951
Reviewed-by: Julien Nabet 
Tested-by: Noel Grandin 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index f1c830ad3172..96ad4ac3c8fe 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -330,7 +330,7 @@ uno::Sequence< uno::Reference < XCertificate > > 
SecurityEnvironment_MSCryptImpl
 {
 sal_Int32 length ;
 X509Certificate_MSCryptImpl* xcert ;
-std::list< X509Certificate_MSCryptImpl* > certsList ;
+std::vector< X509Certificate_MSCryptImpl* > certsList ;
 PCCERT_CONTEXT pCertContext = nullptr;
 
 //firstly, we try to find private keys in given key store.
diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
index 0c89f0abd696..2d7c1e49bc8e 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
@@ -41,7 +41,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include 
 
 #include 
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index c65d8012af2a..03ad4c11487e 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -278,7 +278,7 @@ SecurityEnvironment_NssImpl::getPersonalCertificates()
 {
 sal_Int32 length ;
 X509Certificate_NssImpl* xcert ;
-std::list< X509Certificate_NssImpl* > certsList ;
+std::vector< X509Certificate_NssImpl* > certsList ;
 
 updateSlots();
 //firstly, we try to find private keys in slot
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
index 058f990edb99..9bc2a4f0236b 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
@@ -35,7 +35,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 
@@ -50,14 +50,14 @@ class SecurityEnvironment_NssImpl : public 
::cppu::WeakImplHelper<
 {
 private:
 
-std::list< PK11SlotInfo* > m_Slots;
+std::vector< PK11SlotInfo* > m_Slots;
 /// The last used certificate which has the private key for signing.
 css::uno::Reference m_xSigningCertificate;
 
 osl::Mutex m_mutex;
 
 CERTCertDBHandle*   m_pHandler ;
-std::list< PK11SymKey* >m_tSymKeyList ;
+std::vector< PK11SymKey* >  m_tSymKeyList ;
 
 public:
 SecurityEnvironment_NssImpl();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: xmlsecurity/source

2019-05-07 Thread Julien Nabet (via logerrit)
 xmlsecurity/source/gpg/SecurityEnvironment.cxx |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit c6716196b53fa72d4c5f3984a214d4a8cc79d1b4
Author: Julien Nabet 
AuthorDate: Tue May 7 07:59:10 2019 +0200
Commit: Julien Nabet 
CommitDate: Tue May 7 10:17:18 2019 +0200

Replace list by vector in xmlsecurity/gpg

Change-Id: I746b4b2a83fcf41f38947dffc290574b18a3c691
Reviewed-on: https://gerrit.libreoffice.org/71889
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx 
b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
index 99dc064ca6d2..99d256ea4c99 100644
--- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx
+++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
@@ -17,7 +17,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 #ifdef _WIN32
 #include 
@@ -120,8 +120,8 @@ OUString 
SecurityEnvironmentGpg::getSecurityEnvironmentInformation()
 Sequence< Reference < XCertificate > > 
SecurityEnvironmentGpg::getCertificatesImpl( bool bPrivateOnly )
 {
 CertificateImpl* xCert;
-std::list< GpgME::Key > keyList;
-std::list< CertificateImpl* > certsList;
+std::vector< GpgME::Key > keyList;
+std::vector< CertificateImpl* > certsList;
 
 m_ctx->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL);
 GpgME::Error err = m_ctx->startKeyListing("", bPrivateOnly );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: xmlsecurity/source

2019-04-29 Thread Miklos Vajna (via logerrit)
 xmlsecurity/source/helper/xsecctl.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit f5f8891d823f01090853217479de584f940de459
Author: Miklos Vajna 
AuthorDate: Mon Apr 29 16:13:36 2019 +0200
Commit: Miklos Vajna 
CommitDate: Mon Apr 29 16:13:36 2019 +0200

xmlsecurity: fix the Android build

Change-Id: Ib04060ee4dc2a4ece2858548690e8ef182bf00b1

diff --git a/xmlsecurity/source/helper/xsecctl.cxx 
b/xmlsecurity/source/helper/xsecctl.cxx
index f4ff8a156f47..4a0778ca6329 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -33,6 +33,9 @@
 #include 
 #include 

 #include 
+#ifdef ANDROID
+#include 
+#endif
 #include 
 #include 
 #include 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: xmlsecurity/source

2019-01-13 Thread Libreoffice Gerrit user
 xmlsecurity/source/helper/documentsignaturehelper.cxx |   18 --
 1 file changed, 4 insertions(+), 14 deletions(-)

New commits:
commit c7e7146e2bb81e18753becaf6ca363d3d9dedeba
Author: Matteo Casalin 
AuthorDate: Sat Dec 29 23:32:51 2018 +0100
Commit: Matteo Casalin 
CommitDate: Sun Jan 13 11:00:40 2019 +0100

Avoid OUString temporaries, simplify

Change-Id: I85b3cc9684673a204c3bf7428940d8efb8082fb6
Reviewed-on: https://gerrit.libreoffice.org/66223
Tested-by: Jenkins
Reviewed-by: Matteo Casalin 

diff --git a/xmlsecurity/source/helper/documentsignaturehelper.cxx 
b/xmlsecurity/source/helper/documentsignaturehelper.cxx
index 1dda0be4d7f5..0b197abc8efe 100644
--- a/xmlsecurity/source/helper/documentsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/documentsignaturehelper.cxx
@@ -458,22 +458,12 @@ bool 
DocumentSignatureHelper::equalsReferenceUriManifestPath(
 {
 //split up the uri and path into segments. Both are separated by '/'
 std::vector vUriSegments;
-sal_Int32 nIndex = 0;
-do
-{
-OUString aToken = rUri.getToken( 0, '/', nIndex );
-vUriSegments.push_back(aToken);
-}
-while (nIndex >= 0);
+for (sal_Int32 nIndex = 0; nIndex >= 0; )
+vUriSegments.push_back(rUri.getToken( 0, '/', nIndex ));
 
 std::vector vPathSegments;
-nIndex = 0;
-do
-{
-OUString aToken = rPath.getToken( 0, '/', nIndex );
-vPathSegments.push_back(aToken);
-}
-while (nIndex >= 0);
+for (sal_Int32 nIndex = 0; nIndex >= 0; )
+vPathSegments.push_back(rPath.getToken( 0, '/', nIndex ));
 
 if (vUriSegments.size() != vPathSegments.size())
 return false;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2019-01-10 Thread Libreoffice Gerrit user
 xmlsecurity/source/helper/documentsignaturemanager.cxx |5 +++--
 xmlsecurity/source/helper/ooxmlsecexporter.cxx |4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 108d94db881626dd35fe0decb1de184f7d2fc2bd
Author: Gabor Kelemen 
AuthorDate: Thu Dec 27 21:53:42 2018 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Jan 11 08:08:59 2019 +0100

o3tl::make_unique -> std::make_unique in xmlsecurity/

Since it is now possible to use C++14, it's time to replace
the temporary solution with the standard one

Change-Id: Ie15220b53c6687e1d4891df668b2dedeae5e4750
Reviewed-on: https://gerrit.libreoffice.org/65795
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx 
b/xmlsecurity/source/helper/documentsignaturemanager.cxx
index 5da6459779f7..65d691052348 100644
--- a/xmlsecurity/source/helper/documentsignaturemanager.cxx
+++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx
@@ -37,7 +37,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -46,6 +45,8 @@
 
 #include 
 
+#include 
+
 using namespace css;
 using namespace css::graphic;
 using namespace css::uno;
@@ -99,7 +100,7 @@ PDFSignatureHelper& 
DocumentSignatureManager::getPDFSignatureHelper()
 SAL_WARN_IF(!bInit, "xmlsecurity.comp", "Error initializing security 
context!");
 
 if (!mpPDFSignatureHelper)
-mpPDFSignatureHelper = o3tl::make_unique();
+mpPDFSignatureHelper = std::make_unique();
 
 return *mpPDFSignatureHelper;
 }
diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx 
b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index 42a4df0a7792..1518b8b4e092 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -10,13 +10,13 @@
 #include "ooxmlsecexporter.hxx"
 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -463,7 +463,7 @@ OOXMLSecExporter::OOXMLSecExporter(const 
uno::Reference&
const uno::Reference& 
xRootStorage,
const 
uno::Reference& xDocumentHandler,
const SignatureInformation& rInformation)
-: m_pImpl(o3tl::make_unique(xComponentContext, xRootStorage, 
xDocumentHandler, rInformation))
+: m_pImpl(std::make_unique(xComponentContext, xRootStorage, 
xDocumentHandler, rInformation))
 {
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2019-01-07 Thread Libreoffice Gerrit user
 xmlsecurity/source/xmlsec/saxhelper.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit f21a3c35520842624f944e5809fc55fa7ba26119
Author: Andrea Gelmini 
AuthorDate: Mon Jan 7 10:36:43 2019 +
Commit: Julien Nabet 
CommitDate: Mon Jan 7 14:29:36 2019 +0100

Fix typo

Change-Id: If1559d3ea1205c314f25c6d346fe344adebe7f96
Reviewed-on: https://gerrit.libreoffice.org/65915
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/xmlsecurity/source/xmlsec/saxhelper.cxx 
b/xmlsecurity/source/xmlsec/saxhelper.cxx
index 7be5fbfce752..30811dbfac00 100644
--- a/xmlsecurity/source/xmlsec/saxhelper.cxx
+++ b/xmlsecurity/source/xmlsec/saxhelper.cxx
@@ -32,8 +32,8 @@ namespace cssxs = com::sun::star::xml::sax;
 namespace cssxcsax = com::sun::star::xml::csax;
 
 /**
- * The return value is NULL terminated. The application has the responsibilty 
to
- * deallocte the return value.
+ * The return value is NULL terminated. The application has the responsibility 
to
+ * deallocate the return value.
  */
 static xmlChar* ous_to_xmlstr( const OUString& oustr )
 {
@@ -42,8 +42,8 @@ static xmlChar* ous_to_xmlstr( const OUString& oustr )
 }
 
 /**
- * The return value is NULL terminated. The application has the responsibilty 
to
- * deallocte the return value.
+ * The return value is NULL terminated. The application has the responsibility 
to
+ * deallocate the return value.
  */
 static xmlChar* ous_to_nxmlstr( const OUString& oustr, int& length )
 {
@@ -55,7 +55,7 @@ static xmlChar* ous_to_nxmlstr( const OUString& oustr, int& 
length )
 
 /**
  * The return value and the referenced value must be NULL terminated.
- * The application has the responsibilty to deallocte the return value.
+ * The application has the responsibility to deallocate the return value.
  */
 static const xmlChar** attrlist_to_nxmlstr( const cssu::Sequence< 
cssxcsax::XMLAttribute >& aAttributes )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2018-12-30 Thread Libreoffice Gerrit user
 xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 8e5844ad2321ae58762e74681baf2895190fa3e3
Author: Andrea Gelmini 
AuthorDate: Wed Dec 26 13:56:05 2018 +0100
Commit: Julien Nabet 
CommitDate: Sun Dec 30 09:10:32 2018 +0100

Fix typo in code

Change-Id: I671749843ee14b18c4786a132ca9c6ad30efc625
Reviewed-on: https://gerrit.libreoffice.org/65732
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx 
b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
index b0d0835e8a81..de0cd43f3c8f 100644
--- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
+++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx
@@ -51,7 +51,7 @@ namespace cssxw = com::sun::star::xml::wrapper;
 /* used by the recursiveDelete method */
 #define NODE_REMOVED0
 #define NODE_NOTREMOVED 1
-#define NODE_STOPED 2
+#define NODE_STOPPED 2
 
 XMLDocumentWrapper_XmlSecImpl::XMLDocumentWrapper_XmlSecImpl()
 : m_nCurrentPosition(0)
@@ -421,7 +421,7 @@ sal_Int32 XMLDocumentWrapper_XmlSecImpl::recursiveDelete(
  *   RESULT
  *  result -the result of the deletion process, can be one of following
  *  values:
- *  NODE_STOPED - the process is interrupted by meeting the
+ *  NODE_STOPPED - the process is interrupted by meeting the
  *  m_pStopAtNode
  *  NODE_NOTREMOVED - the pNode is not completely removed
  *  because there is its descendant in the
@@ -436,7 +436,7 @@ sal_Int32 XMLDocumentWrapper_XmlSecImpl::recursiveDelete(
 {
 if (pNode == m_pStopAtNode)
 {
-return NODE_STOPED;
+return NODE_STOPPED;
 }
 
 if (pNode != m_pCurrentReservedNode)
@@ -454,8 +454,8 @@ sal_Int32 XMLDocumentWrapper_XmlSecImpl::recursiveDelete(
 
 switch (nResult)
 {
-case NODE_STOPED:
-return NODE_STOPED;
+case NODE_STOPPED:
+return NODE_STOPPED;
 case NODE_NOTREMOVED:
 bIsRemoved = false;
 break;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2018-12-04 Thread Libreoffice Gerrit user
 xmlsecurity/source/xmlsec/xmlstreamio.cxx |6 ++
 1 file changed, 6 insertions(+)

New commits:
commit 099ab643f60efc5be6f151bff89651efd2da1fc9
Author: Miklos Vajna 
AuthorDate: Tue Dec 4 17:48:47 2018 +0100
Commit: Miklos Vajna 
CommitDate: Tue Dec 4 21:35:54 2018 +0100

tdf#118373 xmlsecurity: avoid stderr output on libxmlsec version check

Make sure that our normal SAL_WARN() reporting is registered during the
xmlSecCheckVersionExt() invocation, just like it's registered during
other libxmlsec API calls.

Change-Id: Ia19368b55dbae47974f48954f86b50e36d1462ff
Reviewed-on: https://gerrit.libreoffice.org/64550
Reviewed-by: Miklos Vajna 
Tested-by: Jenkins

diff --git a/xmlsecurity/source/xmlsec/xmlstreamio.cxx 
b/xmlsecurity/source/xmlsec/xmlstreamio.cxx
index be48ae34b232..5b1b0212073c 100644
--- a/xmlsecurity/source/xmlsec/xmlstreamio.cxx
+++ b/xmlsecurity/source/xmlsec/xmlstreamio.cxx
@@ -22,8 +22,10 @@
  * Implementation of the I/O interfaces based on stream and URI binding
  */
 #include 
+#include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -151,6 +153,10 @@ XSECXMLSEC_DLLPUBLIC int xmlEnableStreamInputCallbacks()
 //Notes: all none default callbacks will lose.
 xmlSecIOCleanupCallbacks() ;
 
+// Make sure that errors are reported via SAL_WARN().
+setErrorRecorder();
+comphelper::ScopeGuard g([] { clearErrorRecorder(); });
+
 // Newer xmlsec wants the callback order in the opposite direction.
 if (xmlSecCheckVersionExt(1, 2, 26, xmlSecCheckVersionABICompatible))
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2018-11-28 Thread Libreoffice Gerrit user
 xmlsecurity/source/gpg/CertificateImpl.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 4e0b3012d48cb35dda1807ce1cf48b6c340069d0
Author: Andrea Gelmini 
AuthorDate: Mon Nov 19 00:20:03 2018 +0100
Commit: Olivier Hallot 
CommitDate: Wed Nov 28 15:36:43 2018 +0100

Fix typos

Change-Id: I66f31ff16a5cd5d8fca7e920fdd6b77bb124dfbb
Reviewed-on: https://gerrit.libreoffice.org/63321
Tested-by: Jenkins
Reviewed-by: Olivier Hallot 

diff --git a/xmlsecurity/source/gpg/CertificateImpl.cxx 
b/xmlsecurity/source/gpg/CertificateImpl.cxx
index 72fed74b949e..64c7b4886e50 100644
--- a/xmlsecurity/source/gpg/CertificateImpl.cxx
+++ b/xmlsecurity/source/gpg/CertificateImpl.cxx
@@ -61,7 +61,7 @@ OUString SAL_CALL CertificateImpl::getIssuerName()
 
 OUString SAL_CALL CertificateImpl::getSubjectName()
 {
-// Samue as issuer name (user ID)
+// Same as issuer name (user ID)
 return getIssuerName();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2018-11-14 Thread Libreoffice Gerrit user
 xmlsecurity/source/helper/ooxmlsecexporter.cxx |   11 +--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit dd6015c2df3716b3db2861c31f00f1cb43b4960d
Author: Miklos Vajna 
AuthorDate: Tue Nov 13 21:04:42 2018 +0100
Commit: Miklos Vajna 
CommitDate: Wed Nov 14 09:08:11 2018 +0100

xmlsecurity: make members of OOXMLSecExporter::Impl private

Change-Id: I456d9b53fd1168b382a2220716d010556eabbd22
Reviewed-on: https://gerrit.libreoffice.org/63344
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmlsecurity/source/helper/ooxmlsecexporter.cxx 
b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
index 8e0df5927a37..42a4df0a7792 100644
--- a/xmlsecurity/source/helper/ooxmlsecexporter.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecexporter.cxx
@@ -32,12 +32,14 @@ using namespace css::xml::sax;
 
 struct OOXMLSecExporter::Impl
 {
+private:
 const uno::Reference& m_xComponentContext;
 const uno::Reference& m_xRootStorage;
 const uno::Reference& m_xDocumentHandler;
 const SignatureInformation& m_rInformation;
 OUString m_aSignatureTimeValue;
 
+public:
 Impl(const uno::Reference& xComponentContext,
  const uno::Reference& xRootStorage,
  const uno::Reference& xDocumentHandler,
@@ -54,6 +56,11 @@ struct OOXMLSecExporter::Impl
 /// Should we intentionally not sign this relation type?
 static bool isOOXMLRelationBlacklist(const OUString& rRelationName);
 
+const uno::Reference& getDocumentHandler() 
const
+{
+return m_xDocumentHandler;
+}
+
 void writeSignedInfo();
 void writeCanonicalizationMethod();
 void writeCanonicalizationTransform();
@@ -467,7 +474,7 @@ void OOXMLSecExporter::writeSignature()
 rtl::Reference pAttributeList(new 
SvXMLAttributeList());
 pAttributeList->AddAttribute("xmlns", NS_XMLDSIG);
 pAttributeList->AddAttribute("Id", "idPackageSignature");
-m_pImpl->m_xDocumentHandler->startElement("Signature", 
uno::Reference(pAttributeList.get()));
+m_pImpl->getDocumentHandler()->startElement("Signature", 
uno::Reference(pAttributeList.get()));
 
 m_pImpl->writeSignedInfo();
 m_pImpl->writeSignatureValue();
@@ -477,7 +484,7 @@ void OOXMLSecExporter::writeSignature()
 m_pImpl->writePackageSignature();
 m_pImpl->writeSignatureLineImages();
 
-m_pImpl->m_xDocumentHandler->endElement("Signature");
+m_pImpl->getDocumentHandler()->endElement("Signature");
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2018-11-05 Thread Libreoffice Gerrit user
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 23874f86dd51386d98ef8e3d06a1ece05463ed3c
Author: Stephan Bergmann 
AuthorDate: Mon Nov 5 17:24:09 2018 +0100
Commit: Stephan Bergmann 
CommitDate: Mon Nov 5 21:44:48 2018 +0100

xmlSecNssPKIAdoptKey apparently takes over ownership of keys

(e.g., see xmlSecNssPKIKeyDataAdoptKey called from xmlSecNssPKIAdoptKey in
workdir/UnpackedTarball/xmlsec/src/nss/pkikeys.c, which has

if (ctx->privkey) {
SECKEY_DestroyPrivateKey(ctx->privkey);
}
ctx->privkey = privkey;

to install the passed in new privkey as ctx->privkey, which is apparently
considered owned by ctx)

Presumably since ab7fabd8b116d16def53772720f19fad4dbd6366 "lok: update the 
test
for singing the document from LOK" changed the relevant test code,
CppunitTest_desktop_lib fails in ASan builds with

> ==16681==ERROR: AddressSanitizer: heap-use-after-free on address 
0x61d001a914a8 at pc 0x7f2af9afdf33 bp 0x7ffd59d3ccb0 sp 0x7ffd59d3cca8
> READ of size 4 at 0x61d001a914a8 thread T0
>  #0 in SECKEY_GetPrivateKeyType at 
workdir/UnpackedTarball/nss/nss/lib/cryptohi/seckey.c:1716:21 
(instdir/program/libnss3.so +0x3c6f32)
>  #1 in xmlSecNssPKIAdoptKey at 
workdir/UnpackedTarball/xmlsec/src/nss/pkikeys.c:208:19 
(instdir/program/libxsec_xmlsec.so +0x4026bc)
>  #2 in SecurityEnvironment_NssImpl::createKeysManager() at 
xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx:846:41 
(instdir/program/libxsec_xmlsec.so +0x36a4ce)
>  #3 in 
XMLSignature_NssImpl::validate(com::sun::star::uno::Reference
 const&, 
com::sun::star::uno::Reference
 const&) at xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx:231:56 
(instdir/program/libxsec_xmlsec.so +0x3ca23e)
>  #4 in non-virtual thunk to 
XMLSignature_NssImpl::validate(com::sun::star::uno::Reference
 const&, 
com::sun::star::uno::Reference
 const&) at xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx 
(instdir/program/libxsec_xmlsec.so +0x3cb1ca)
>  #5 in 
SignatureVerifierImpl::startEngine(rtl::Reference 
const&) at xmlsecurity/source/framework/signatureverifierimpl.cxx:70:44 
(instdir/program/libxmlsecurity.so +0x6da8a9)
>  #6 in SignatureEngine::tryToPerform() at 
xmlsecurity/source/framework/signatureengine.cxx:112:9 
(instdir/program/libxmlsecurity.so +0x6c9a4e)
>  #7 in SecurityEngine::referenceResolved(int) at 
xmlsecurity/source/framework/securityengine.cxx:39:5 
(instdir/program/libxmlsecurity.so +0x6ba84a)
>  #8 in ElementCollector::doNotify() at 
xmlsecurity/source/framework/elementcollector.cxx:136:39 
(instdir/program/libxmlsecurity.so +0x660853)
>  #9 in ElementCollector::notifyListener() at 
xmlsecurity/source/framework/elementcollector.cxx:88:5 
(instdir/program/libxmlsecurity.so +0x660006)
>  #10 in BufferNode::elementCollectorNotify() at 
xmlsecurity/source/framework/buffernode.cxx:725:40 
(instdir/program/libxmlsecurity.so +0x5fe591)
>  #11 in BufferNode::setReceivedAll() at 
xmlsecurity/source/framework/buffernode.cxx:96:5 
(instdir/program/libxmlsecurity.so +0x5fd61a)
>  #12 in SAXEventKeeperImpl::endElement(rtl::OUString const&) at 
xmlsecurity/source/framework/saxeventkeeperimpl.cxx:1067:36 
(instdir/program/libxmlsecurity.so +0x67694c)
>  #13 in XSecParser::endElement(rtl::OUString const&) at 
xmlsecurity/source/helper/xsecparser.cxx:408:29 
(instdir/program/libxmlsecurity.so +0x885bd6)
>  #14 in (anonymous 
namespace)::SaxExpatParser_Impl::callbackEndElement(void*, char const*) at 
sax/source/expatwrap/sax_expat.cxx:731:9 (instdir/program/libexpwraplo.so 
+0x1a0817)
>  #15 in (anonymous namespace)::call_callbackEndElement(void*, char 
const*) at sax/source/expatwrap/sax_expat.cxx:242:9 
(instdir/program/libexpwraplo.so +0x199604)
>  #16 in doContent at workdir/UnpackedTarball/expat/lib/xmlparse.c:2954:11 
(instdir/program/libexpwraplo.so +0x32fdf9)
>  #17 in contentProcessor at 
workdir/UnpackedTarball/expat/lib/xmlparse.c:2531:27 
(instdir/program/libexpwraplo.so +0x319c93)
>  #18 in doProlog at workdir/UnpackedTarball/expat/lib/xmlparse.c:4556:14 
(instdir/program/libexpwraplo.so +0x313539)
>  #19 in prologProcessor at 
workdir/UnpackedTarball/expat/lib/xmlparse.c:4270:10 
(instdir/program/libexpwraplo.so +0x2ffcc8)
>  #20 in XML_ParseBuffer at 
workdir/UnpackedTarball/expat/lib/xmlparse.c:1983:25 
(instdir/program/libexpwraplo.so +0x2fafbf)
>  #21 in (anonymous namespace)::SaxExpatParser_Impl::parse() at 
sax/source/expatwrap/sax_expat.cxx:654:27 (instdir/program/libexpwraplo.so 
+0x19a27e)
>  #22 in (anonymous 
namespace)::SaxExpatParser::parseStream(com::sun::star::xml::sax::InputSource 
const&) at sax/source/expatwrap/sax_expat.cxx:484:14 
(instdir/program/libexpwraplo.so +0x192774)
>  #23 in 

[Libreoffice-commits] core.git: xmlsecurity/source

2018-10-29 Thread Libreoffice Gerrit user
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   83 ++
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx |8 
 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx |   26 +++
 xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.hxx |6 
 4 files changed, 92 insertions(+), 31 deletions(-)

New commits:
commit 2286137c40a2abb26d36beb906962baffd779312
Author: Tomaž Vajngerl 
AuthorDate: Wed Oct 24 10:27:26 2018 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 29 22:15:56 2018 +0100

fix importing the certificate and private key

If importing the certificate and private key is done separately,
they don't associate with each other, so with this you can add
the private key to the certificate that it belongs to. If the
private key is set in this way, then getPrivateKey() call doesn't
look into the database but just returns the private key stored
in the member variable.

Additionally use CERT_DecodeCertFromPackage to import the DER
certificate from the imput as CERT_DecodeDERCertificate doesn't
import a complete certificate and doesn't add it into the
certificate database.

Change-Id: I29876030f167cc5fa6b887f9bfeb0b84622c751e
Reviewed-on: https://gerrit.libreoffice.org/62271
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 4e31c40bf733..bdf8000d886b 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -432,6 +432,30 @@ Sequence< Reference < XCertificate > > 
SecurityEnvironment_NssImpl::buildCertifi
 return Sequence< Reference < XCertificate > >();
 }
 
+X509Certificate_NssImpl* 
SecurityEnvironment_NssImpl::createAndAddCertificateFromPackage(
+const 
css::uno::Sequence& raDERCertificate,
+OUString const & 
raString)
+{
+auto pCertificateBytes = reinterpret_cast(const_cast(raDERCertificate.getConstArray()));
+CERTCertificate* pCERTCertificate = 
CERT_DecodeCertFromPackage(pCertificateBytes, raDERCertificate.getLength());
+
+if (!pCERTCertificate)
+return nullptr;
+
+OString aTrustString = OUStringToOString(raString, 
RTL_TEXTENCODING_ASCII_US);
+
+CERTCertTrust aTrust;
+if (CERT_DecodeTrustString(, aTrustString.getStr()) != SECSuccess)
+return nullptr;
+
+if (CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), pCERTCertificate, 
) != SECSuccess)
+return nullptr;
+
+X509Certificate_NssImpl* pX509Certificate = new X509Certificate_NssImpl();
+pX509Certificate->setCert(pCERTCertificate);
+return pX509Certificate;
+}
+
 X509Certificate_NssImpl* 
SecurityEnvironment_NssImpl::createX509CertificateFromDER(const 
css::uno::Sequence& aDerCertificate)
 {
 X509Certificate_NssImpl* pX509Certificate = nullptr;
@@ -816,68 +840,71 @@ xmlSecKeysMngrPtr 
SecurityEnvironment_NssImpl::createKeysManager() {
 // Adopt the private key of the signing certificate, if it has any.
 if (auto pCertificate = 
dynamic_cast(m_xSigningCertificate.get()))
 {
-if (auto pCERTCertificate = 
const_cast(pCertificate->getNssCert()))
+SECKEYPrivateKey* pPrivateKey = pCertificate->getPrivateKey();
+if (pPrivateKey)
 {
-if (pCERTCertificate && pCERTCertificate->slot)
-{
-SECKEYPrivateKey* pPrivateKey = 
PK11_FindPrivateKeyFromCert(pCERTCertificate->slot, pCERTCertificate, nullptr);
-xmlSecKeyDataPtr pKeyData = xmlSecNssPKIAdoptKey(pPrivateKey, 
nullptr);
-xmlSecKeyPtr pKey = xmlSecKeyCreate();
-xmlSecKeySetValue(pKey, pKeyData);
-xmlSecNssAppDefaultKeysMngrAdoptKey(pKeysMngr, pKey);
-}
-else
-{
-SAL_WARN("xmlsecurity.xmlsec", "Can't get the private key from 
the certificate.");
-}
+xmlSecKeyDataPtr pKeyData = xmlSecNssPKIAdoptKey(pPrivateKey, 
nullptr);
+xmlSecKeyPtr pKey = xmlSecKeyCreate();
+xmlSecKeySetValue(pKey, pKeyData);
+xmlSecNssAppDefaultKeysMngrAdoptKey(pKeysMngr, pKey);
+}
+else
+{
+SAL_WARN("xmlsecurity.xmlsec", "Can't get the private key from the 
certificate.");
 }
 }
 
-return pKeysMngr ;
+return pKeysMngr;
 }
+
 void SecurityEnvironment_NssImpl::destroyKeysManager(xmlSecKeysMngrPtr 
pKeysMngr) {
 if( pKeysMngr != nullptr ) {
 xmlSecKeysMngrDestroy( pKeysMngr ) ;
 }
 }
 
-uno::Reference 
SecurityEnvironment_NssImpl::createDERCertificateWithPrivateKey(
-Sequence const & raDERCertificate, Sequence const 
& raPrivateKey)
+SECKEYPrivateKey* 

[Libreoffice-commits] core.git: xmlsecurity/source

2018-10-29 Thread Libreoffice Gerrit user
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   67 --
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx |   12 +
 2 files changed, 66 insertions(+), 13 deletions(-)

New commits:
commit ef2623b712d7417d8135279d654a16de2caf56fc
Author: Tomaž Vajngerl 
AuthorDate: Thu Oct 18 10:34:14 2018 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 29 15:27:10 2018 +0100

xmlsecurity: implement XCertificateCreator for NSS backend

Change-Id: I28aa17e6c97494769185ed289836524064030f39
Reviewed-on: https://gerrit.libreoffice.org/61914
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index cae2675db64a..4e31c40bf733 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -26,7 +26,6 @@
 #include 
 #include 
 #include "securityenvironment_nssimpl.hxx"
-#include "x509certificate_nssimpl.hxx"
 #include 
 
 #include 
@@ -433,20 +432,23 @@ Sequence< Reference < XCertificate > > 
SecurityEnvironment_NssImpl::buildCertifi
 return Sequence< Reference < XCertificate > >();
 }
 
-Reference< XCertificate > 
SecurityEnvironment_NssImpl::createCertificateFromRaw( const Sequence< sal_Int8 
>& rawCertificate ) {
-X509Certificate_NssImpl* xcert ;
-
-if( rawCertificate.getLength() > 0 ) {
-xcert = new X509Certificate_NssImpl() ;
-if( xcert == nullptr )
-throw RuntimeException() ;
+X509Certificate_NssImpl* 
SecurityEnvironment_NssImpl::createX509CertificateFromDER(const 
css::uno::Sequence& aDerCertificate)
+{
+X509Certificate_NssImpl* pX509Certificate = nullptr;
 
-xcert->setRawCert( rawCertificate ) ;
-} else {
-xcert = nullptr ;
+if (aDerCertificate.getLength() > 0)
+{
+pX509Certificate = new X509Certificate_NssImpl();
+if (pX509Certificate == nullptr)
+throw RuntimeException();
+pX509Certificate->setRawCert(aDerCertificate);
 }
+return pX509Certificate;
+}
 
-return xcert ;
+Reference 
SecurityEnvironment_NssImpl::createCertificateFromRaw(const Sequence< sal_Int8 
>& rawCertificate)
+{
+return createX509CertificateFromDER(rawCertificate);
 }
 
 Reference< XCertificate > 
SecurityEnvironment_NssImpl::createCertificateFromAscii( const OUString& 
asciiCertificate )
@@ -839,6 +841,47 @@ void 
SecurityEnvironment_NssImpl::destroyKeysManager(xmlSecKeysMngrPtr pKeysMngr
 }
 }
 
+uno::Reference 
SecurityEnvironment_NssImpl::createDERCertificateWithPrivateKey(
+Sequence const & raDERCertificate, Sequence const 
& raPrivateKey)
+{
+SECStatus nStatus = SECSuccess;
+
+PK11SlotInfo* pSlot = PK11_GetInternalKeySlot();
+if (!pSlot)
+return uno::Reference();
+
+SECItem pDerPrivateKeyInfo;
+pDerPrivateKeyInfo.data = reinterpret_cast(const_cast(raPrivateKey.getConstArray()));
+pDerPrivateKeyInfo.len = raPrivateKey.getLength();
+
+const unsigned int keyUsage = KU_KEY_ENCIPHERMENT | KU_DATA_ENCIPHERMENT | 
KU_DIGITAL_SIGNATURE;
+SECKEYPrivateKey* pPrivateKey = nullptr;
+
+bool bPermanent = false;
+bool bSensitive = false;
+
+nStatus = PK11_ImportDERPrivateKeyInfoAndReturnKey(
+  pSlot, , nullptr, nullptr, bPermanent, bSensitive,
+  keyUsage, , nullptr);
+
+if (nStatus != SECSuccess)
+return uno::Reference();
+
+if (!pPrivateKey)
+return uno::Reference();
+
+X509Certificate_NssImpl* pX509Certificate = 
createX509CertificateFromDER(raDERCertificate);
+if (!pX509Certificate)
+return uno::Reference();
+
+addCryptoSlot(pSlot);
+
+CERTCertificate* pCERTCertificate = 
const_cast(pX509Certificate->getNssCert());
+pCERTCertificate->slot = pSlot;
+
+return pX509Certificate;
+}
+
 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
 com_sun_star_xml_crypto_SecurityEnvironment_get_implementation(
 uno::XComponentContext* /*pCtx*/, uno::Sequence const& /*rSeq*/)
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
index aec7f5bbcead..6c6160fc2009 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
@@ -31,11 +31,14 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#include "x509certificate_nssimpl.hxx"
+
 #include 
 
 #include 
@@ -46,7 +49,8 @@
 #include 
 
 class SecurityEnvironment_NssImpl : public ::cppu::WeakImplHelper<
-css::xml::crypto::XSecurityEnvironment ,
+css::xml::crypto::XSecurityEnvironment,
+css::xml::crypto::XCertificateCreator,
 css::lang::XServiceInfo,
 css::lang::XUnoTunnel >
 {
@@ -111,6 +115,10 @@ private:
 virtual css::uno::Reference< 

[Libreoffice-commits] core.git: xmlsecurity/source

2018-10-29 Thread Libreoffice Gerrit user
 xmlsecurity/source/helper/xmlsignaturehelper.cxx |   26 ++-
 1 file changed, 7 insertions(+), 19 deletions(-)

New commits:
commit a113aff7add62da5f2f8ffe0be453af4b1b79866
Author: Tomaž Vajngerl 
AuthorDate: Thu Oct 18 10:29:45 2018 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Oct 29 08:58:54 2018 +0100

xmlsignaturehelper: fix comments, no change

Change-Id: Ibfdf92712264ad37aafed53db0fe8e8c4fea4699
Reviewed-on: https://gerrit.libreoffice.org/61913
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx 
b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index 0e7a77640a68..db80016f84e0 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -257,32 +257,22 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const 
css::uno::Reference< css:
 
 SAL_WARN_IF(!xInputStream.is(), "xmlsecurity.helper", "input stream 
missing");
 
-/*
- * prepare ParserInputSrouce
- */
+// prepare ParserInputSrouce
 xml::sax::InputSource aParserInput;
 aParserInput.aInputStream = xInputStream;
 
-/*
- * get SAX parser component
- */
+// get SAX parser component
 uno::Reference< xml::sax::XParser > xParser = 
xml::sax::Parser::create(mxCtx);
 
-/*
- * create a signature reader
- */
+// create a signature reader
 uno::Reference< xml::sax::XDocumentHandler > xHandler
 = mpXSecController->createSignatureReader(*this);
 
-/*
- * setup the connection:
- * Parser -> SignatureReader
- */
+// setup the connection:
+// Parser -> SignatureReader
 xParser->setDocumentHandler( xHandler );
 
-/*
- * parser the stream
- */
+// parser the stream
 try
 {
 xParser->parseStream( aParserInput );
@@ -292,9 +282,7 @@ bool XMLSignatureHelper::ReadAndVerifySignature( const 
css::uno::Reference< css:
 mbError = true;
 }
 
-/*
- * release the signature reader
- */
+// release the signature reader
 mpXSecController->releaseSignatureReader( );
 
 return !mbError;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2018-10-25 Thread Libreoffice Gerrit user
 xmlsecurity/source/helper/documentsignaturemanager.cxx |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit f9acea526b9aeb3cf450cd7ee43bd969385865db
Author: Tomaž Vajngerl 
AuthorDate: Mon Oct 15 10:07:32 2018 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Oct 25 23:34:23 2018 +0200

use "range for" to iterate through certificates

Change-Id: Ife206ab29f2f8eaa2358f45e6bae2290d95fd4d6
Reviewed-on: https://gerrit.libreoffice.org/61779
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/xmlsecurity/source/helper/documentsignaturemanager.cxx 
b/xmlsecurity/source/helper/documentsignaturemanager.cxx
index 095abb543cb6..c247a40db917 100644
--- a/xmlsecurity/source/helper/documentsignaturemanager.cxx
+++ b/xmlsecurity/source/helper/documentsignaturemanager.cxx
@@ -363,14 +363,13 @@ bool DocumentSignatureManager::add(
 
 uno::Sequence> aCertPath
 = 
xSecurityContext->getSecurityEnvironment()->buildCertificatePath(xCert);
-const uno::Reference* pCertPath = 
aCertPath.getConstArray();
-sal_Int32 nCnt = aCertPath.getLength();
 
 OUStringBuffer aStrBuffer;
-for (int i = 0; i < nCnt; i++)
+for (uno::Reference const& rxCertificate : 
aCertPath)
 {
-comphelper::Base64::encode(aStrBuffer, pCertPath[i]->getEncoded());
-
maSignatureHelper.AddEncapsulatedX509Certificate(aStrBuffer.makeStringAndClear());
+comphelper::Base64::encode(aStrBuffer, rxCertificate->getEncoded());
+OUString aString = aStrBuffer.makeStringAndClear();
+maSignatureHelper.AddEncapsulatedX509Certificate(aString);
 }
 
 std::vector aElements = 
DocumentSignatureHelper::CreateElementList(
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2018-10-20 Thread Libreoffice Gerrit user
 xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx |   10 
+++---
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit 71c804a05eb07fa21482ca298486ed70c63907ad
Author: Caolán McNamara 
AuthorDate: Fri Oct 19 16:10:45 2018 +0100
Commit: Caolán McNamara 
CommitDate: Sat Oct 20 19:51:53 2018 +0200

pvs-studio: The 'store' variable is assigned values twice successively.

Change-Id: I532bf99935c2f4d3b58f84013bc545791208
Reviewed-on: https://gerrit.libreoffice.org/62050
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 
Tested-by: Caolán McNamara 

diff --git 
a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx 
b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
index 5e6dfcb93a99..4ba5ad8a4417 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx
@@ -735,14 +735,12 @@ uno::Reference< XCertificate > 
SecurityEnvironment_MSCryptImpl::createCertificat
 }
 
 uno::Reference< XCertificate > 
SecurityEnvironment_MSCryptImpl::createCertificateFromAscii( const OUString& 
asciiCertificate ) {
-xmlChar* chCert ;
-xmlSecSize certSize ;
 
 OString oscert = OUStringToOString( asciiCertificate , 
RTL_TEXTENCODING_ASCII_US ) ;
 
-chCert = xmlStrndup( reinterpret_cast(oscert.getStr()), 
static_cast(oscert.getLength()) ) ;
+xmlChar* chCert = xmlStrndup( reinterpret_cast(oscert.getStr()), static_cast(oscert.getLength()) ) ;
 
-certSize = xmlSecBase64Decode( chCert, chCert, xmlStrlen( chCert ) ) ;
+xmlSecSize certSize = xmlSecBase64Decode( chCert, chCert, xmlStrlen( 
chCert ) ) ;
 
 uno::Sequence< sal_Int8 > rawCert( certSize ) ;
 for( xmlSecSize i = 0 ; i < certSize ; i ++ )
@@ -757,9 +755,7 @@ uno::Reference< XCertificate > 
SecurityEnvironment_MSCryptImpl::createCertificat
 static HCERTSTORE getCertStoreForIntermediatCerts(
 const uno::Sequence< uno::Reference< css::security::XCertificate > >& 
seqCerts)
 {
-HCERTSTORE store = nullptr;
-store = CertOpenStore(
-CERT_STORE_PROV_MEMORY, 0, NULL, 0, nullptr);
+HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, 0, 
nullptr);
 if (store == nullptr)
 return nullptr;
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2018-10-18 Thread Libreoffice Gerrit user
 xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx |   17 +-
 1 file changed, 10 insertions(+), 7 deletions(-)

New commits:
commit 181a1b36ac728e3a43e054496ceb53fd3315abdb
Author: Miklos Vajna 
AuthorDate: Wed Oct 17 21:47:36 2018 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 18 09:13:53 2018 +0200

xmlsecurity: avoid repeated manual calls to PORT_FreeArena()

Change-Id: Id62a894b08e6221c858304d7cb198a5a3f0cbd43
Reviewed-on: https://gerrit.libreoffice.org/61893
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index ef68129496d6..86d68c522ed7 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -57,6 +57,14 @@ using ::com::sun::star::lang::XSingleServiceFactory ;
 using ::com::sun::star::xml::crypto::XSecurityEnvironment ;
 using ::com::sun::star::security::XCertificate ;
 
+namespace std
+{
+template <> struct default_delete
+{
+void operator()(PRArenaPool* ptr) { PORT_FreeArena(ptr, PR_FALSE); }
+};
+}
+
 static X509Certificate_NssImpl* NssCertToXCert( CERTCertificate* cert ) ;
 static X509Certificate_NssImpl* NssPrivKeyToXCert( SECKEYPrivateKey* ) ;
 
@@ -329,9 +337,7 @@ Reference< XCertificate > 
SecurityEnvironment_NssImpl::getCertificate( const OUS
 CERTName* nmIssuer ;
 char* chIssuer ;
 SECItem* derIssuer ;
-PRArenaPool* arena ;
-
-arena = PORT_NewArena( DER_DEFAULT_CHUNKSIZE ) ;
+std::unique_ptr 
arena(PORT_NewArena(DER_DEFAULT_CHUNKSIZE));
 if( arena == nullptr )
 throw RuntimeException() ;
 
@@ -341,15 +347,13 @@ Reference< XCertificate > 
SecurityEnvironment_NssImpl::getCertificate( const OUS
 nmIssuer = CERT_AsciiToName( chIssuer ) ;
 if( nmIssuer == nullptr ) {
 PL_strfree( chIssuer ) ;
-PORT_FreeArena( arena, PR_FALSE ) ;
 return nullptr; // no need for exception cf. i40394
 }
 
-derIssuer = SEC_ASN1EncodeItem( arena, nullptr, 
static_cast(nmIssuer), SEC_ASN1_GET( CERT_NameTemplate ) ) ;
+derIssuer = SEC_ASN1EncodeItem( arena.get(), nullptr, 
static_cast(nmIssuer), SEC_ASN1_GET( CERT_NameTemplate ) ) ;
 if( derIssuer == nullptr ) {
 PL_strfree( chIssuer ) ;
 CERT_DestroyName( nmIssuer ) ;
-PORT_FreeArena( arena, PR_FALSE ) ;
 throw RuntimeException() ;
 }
 
@@ -372,7 +376,6 @@ Reference< XCertificate > 
SecurityEnvironment_NssImpl::getCertificate( const OUS
 CERT_DestroyName( nmIssuer ) ;
 //SECITEM_FreeItem( derIssuer, PR_FALSE ) ;
 CERT_DestroyCertificate( cert ) ;
-PORT_FreeArena( arena, PR_FALSE ) ;
 } else {
 xcert = nullptr ;
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2018-10-04 Thread Libreoffice Gerrit user
 xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx |   19 +++--
 1 file changed, 8 insertions(+), 11 deletions(-)

New commits:
commit 32dfaf1e23496599169b8eae163b733975cfed2e
Author: Miklos Vajna 
AuthorDate: Wed Oct 3 21:03:09 2018 +0200
Commit: Miklos Vajna 
CommitDate: Thu Oct 4 09:06:16 2018 +0200

xmlsecurity nss: avoid deleting the dsig context manually

Change-Id: I0198c1b0d6ba6c27072376943895718d536a284c
Reviewed-on: https://gerrit.libreoffice.org/61323
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx 
b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
index 5eaec91e6ecc..1dc7b735c94e 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx
@@ -51,6 +51,10 @@ template <> struct default_delete
 {
 void operator()(xmlSecKeysMngrPtr ptr) { 
SecurityEnvironment_NssImpl::destroyKeysManager(ptr); }
 };
+template <> struct default_delete
+{
+void operator()(xmlSecDSigCtxPtr ptr) { xmlSecDSigCtxDestroy(ptr); }
+};
 }
 
 class XMLSignature_NssImpl
@@ -86,7 +90,6 @@ SAL_CALL XMLSignature_NssImpl::generate(
 const Reference< XSecurityEnvironment >& aEnvironment
 )
 {
-xmlSecDSigCtxPtr pDsigCtx = nullptr ;
 xmlNodePtr pNode = nullptr ;
 
 if( !aTemplate.is() )
@@ -140,7 +143,7 @@ SAL_CALL XMLSignature_NssImpl::generate(
 }
 
 //Create Signature context
-pDsigCtx = xmlSecDSigCtxCreate(pMngr.get());
+std::unique_ptr pDsigCtx(xmlSecDSigCtxCreate(pMngr.get()));
 if( pDsigCtx == nullptr )
 {
 //throw XMLSignatureException() ;
@@ -149,7 +152,7 @@ SAL_CALL XMLSignature_NssImpl::generate(
 }
 
 //Sign the template
-if( xmlSecDSigCtxSign( pDsigCtx , pNode ) == 0 )
+if( xmlSecDSigCtxSign( pDsigCtx.get() , pNode ) == 0 )
 {
 if (pDsigCtx->status == xmlSecDSigStatusSucceeded)
 
aTemplate->setStatus(css::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED);
@@ -161,9 +164,6 @@ SAL_CALL XMLSignature_NssImpl::generate(
 
aTemplate->setStatus(css::xml::crypto::SecurityOperationStatus_UNKNOWN);
 }
 
-
-xmlSecDSigCtxDestroy( pDsigCtx ) ;
-
 //Unregistered the stream/URI binding
 if( xUriBinding.is() )
 xmlUnregisterStreamInputCallbacks() ;
@@ -178,7 +178,6 @@ SAL_CALL XMLSignature_NssImpl::validate(
 const Reference< XXMLSignatureTemplate >& aTemplate ,
 const Reference< XXMLSecurityContext >& aSecurityCtx
 ) {
-xmlSecDSigCtxPtr pDsigCtx = nullptr ;
 xmlNodePtr pNode = nullptr ;
 //sal_Bool valid ;
 
@@ -235,7 +234,7 @@ SAL_CALL XMLSignature_NssImpl::validate(
 }
 
 //Create Signature context
-pDsigCtx = xmlSecDSigCtxCreate(pMngr.get());
+std::unique_ptr 
pDsigCtx(xmlSecDSigCtxCreate(pMngr.get()));
 if( pDsigCtx == nullptr )
 {
 clearErrorRecorder();
@@ -246,7 +245,7 @@ SAL_CALL XMLSignature_NssImpl::validate(
 pDsigCtx->keyInfoReadCtx.flags |= 
XMLSEC_KEYINFO_FLAGS_X509DATA_DONT_VERIFY_CERTS;
 
 //Verify signature
-int rs = xmlSecDSigCtxVerify( pDsigCtx , pNode );
+int rs = xmlSecDSigCtxVerify( pDsigCtx.get() , pNode );
 
 // Also verify manifest: this is empty for ODF, but contains 
everything (except signature metadata) for OOXML.
 xmlSecSize nReferenceCount = 
xmlSecPtrListGetSize(>manifestReferences);
@@ -265,14 +264,12 @@ SAL_CALL XMLSignature_NssImpl::validate(
 if (rs == 0 && pDsigCtx->status == xmlSecDSigStatusSucceeded && 
nReferenceCount == nReferenceGood)
 {
 
aTemplate->setStatus(css::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED);
-xmlSecDSigCtxDestroy( pDsigCtx ) ;
 break;
 }
 else
 {
 
aTemplate->setStatus(css::xml::crypto::SecurityOperationStatus_UNKNOWN);
 }
-xmlSecDSigCtxDestroy( pDsigCtx ) ;
 }
 
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: xmlsecurity/source

2018-09-30 Thread Libreoffice Gerrit user
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 89a60912bba7ffd6f65ea99f4664f343c5025c95
Author: Cor Nouws 
AuthorDate: Thu Sep 27 21:53:12 2018 +0200
Commit: Thorsten Behrens 
CommitDate: Mon Oct 1 01:42:39 2018 +0200

tdf#116085 make sure Certificate Manager is found with GPG4win v3

Change-Id: I3a7ab7ec046a6bbff4b4a020e76356ffd454bab8
Reviewed-on: https://gerrit.libreoffice.org/61061
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens 

diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index fd4f42fcbba1..894fa542fd7a 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -493,9 +493,11 @@ IMPL_STATIC_LINK(DigitalSignaturesDialog, 
CertMgrButtonHdl, Button*, pButton, vo
 // FIXME: call GpgME::dirInfo("bindir") somewhere in
 // SecurityEnvironmentGpg or whatnot
 // FIXME: perhaps poke GpgME for uiserver, and hope it returns something 
useful?
-const OUString aGUIServers[] = { OUString("kleopatra.exe"), 
OUString("launch-gpa.exe"), OUString("gpa.exe"),
- OUString("bin\\kleopatra.exe"), 
OUString("bin\\launch-gpa.exe"), OUString("bin\\gpa.exe") };
-const char* const cPath = "C:\\Program Files (x86)\\GNU\\GnuPG";
+const OUString aGUIServers[] = { OUString("Gpg4win\\kleopatra.exe"), 
OUString("GNU\\GnuPG\\kleopatra.exe"),
+ OUString("GNU\\GnuPG\\launch-gpa.exe"), 
OUString("GNU\\GnuPG\\gpa.exe"),
+ 
OUString("GNU\\GnuPG\\bin\\kleopatra.exe"), 
OUString("GNU\\GnuPG\\bin\\launch-gpa.exe"),
+ OUString("GNU\\GnuPG\\bin\\gpa.exe") };
+const char* const cPath = "C:\\Program Files (x86)";
 #else
 const OUString aGUIServers[] = { OUString("kleopatra"), 
OUString("seahorse"),  OUString("gpa"), OUString("kgpg") };
 const char* cPath = getenv("PATH");
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


  1   2   3   >