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

Tor Lillqvist tml at collabora.com
Tue Nov 8 13:58:06 UTC 2016


 xmlsecurity/inc/sigstruct.hxx          |    2 --
 xmlsecurity/source/helper/xsecctl.hxx  |    8 --------
 xmlsecurity/source/helper/xsecsign.cxx |   23 +----------------------
 3 files changed, 1 insertion(+), 32 deletions(-)

New commits:
commit 51663ac544b5ac2a20e21909c6fc6b1b6447fafd
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Nov 8 15:46:30 2016 +0200

    Fallout from previous commit 248dbe1de5eeea9e9173e53a0b1891f63ff73d68
    
    Remove SignatureInformation::nSecurityEnvironmentIndex as it was
    always -1.
    
    Change-Id: I39247e5c40ce36e394c30b450626eca533f46267

diff --git a/xmlsecurity/inc/sigstruct.hxx b/xmlsecurity/inc/sigstruct.hxx
index e662d36..1b6cdb8 100644
--- a/xmlsecurity/inc/sigstruct.hxx
+++ b/xmlsecurity/inc/sigstruct.hxx
@@ -68,7 +68,6 @@ typedef ::std::vector< SignatureReferenceInformation > SignatureReferenceInforma
 struct SignatureInformation
 {
     sal_Int32 nSecurityId;
-    sal_Int32 nSecurityEnvironmentIndex;
     css::xml::crypto::SecurityOperationStatus nStatus;
     // For ODF: XAdES digests (SHA256) or the old SHA1, from css::xml::crypto::DigestID
     sal_Int32 nDigestID;
@@ -106,7 +105,6 @@ struct SignatureInformation
     {
         nSecurityId = nId;
         nStatus = css::xml::crypto::SecurityOperationStatus_UNKNOWN;
-        nSecurityEnvironmentIndex = -1;
     }
 };
 
diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx
index 8e4c5d9..a994174 100644
--- a/xmlsecurity/source/helper/xsecsign.cxx
+++ b/xmlsecurity/source/helper/xsecsign.cxx
@@ -90,15 +90,7 @@ cssu::Reference< cssxc::sax::XReferenceResolvedListener > XSecController::prepar
     args[2] = cssu::makeAny(OUString::number(nIdOfSignatureElementCollector));
 
     //for nss, the internal module is used for signing, which needs to be improved later
-    sal_Int32 nEnvIndex = internalSignatureInfor.signatureInfor.nSecurityEnvironmentIndex;
-    if( nEnvIndex < 0 || nEnvIndex >= m_xSecurityContext->getSecurityEnvironmentNumber())
-    {// set defaultEnv
-        args[3] = cssu::makeAny(m_xSecurityContext->getSecurityEnvironment());
-    }
-    else
-    {
-        args[3] = cssu::makeAny(m_xSecurityContext->getSecurityEnvironmentByIndex(nEnvIndex));
-    }
+    args[3] = cssu::makeAny(m_xSecurityContext->getSecurityEnvironment());
 
     args[4] = cssu::makeAny(m_xXMLSignature);
     xInitialization->initialize(args);
@@ -239,7 +231,6 @@ void XSecController::setX509Certificate(
     if ( index == -1 )
     {
         InternalSignatureInformation isi(nSecurityId, nullptr);
-        isi.signatureInfor.nSecurityEnvironmentIndex = -1;
         isi.signatureInfor.ouX509IssuerName = ouX509IssuerName;
         isi.signatureInfor.ouX509SerialNumber = ouX509SerialNumber;
         isi.signatureInfor.ouX509Certificate = ouX509Cert;
@@ -254,7 +245,6 @@ void XSecController::setX509Certificate(
         si.ouX509SerialNumber = ouX509SerialNumber;
         si.ouX509Certificate = ouX509Cert;
         si.ouCertDigest = ouX509CertDigest;
-        si.nSecurityEnvironmentIndex = -1;
     }
 }
 
commit 248dbe1de5eeea9e9173e53a0b1891f63ff73d68
Author: Tor Lillqvist <tml at collabora.com>
Date:   Tue Nov 8 15:36:48 2016 +0200

    Bin pointless (overloaded) member function
    
    The XSecController::setX509Certificate() overload that took a
    sal_Int32 nSecurityEnvironmentIndex was called in just one place, and
    -1 was always passed for the nSecurityEnvironmentIndex.
    
    Change-Id: Ic37b7053c90a6fbb8b4e5b6485483d34c605b965

diff --git a/xmlsecurity/source/helper/xsecctl.hxx b/xmlsecurity/source/helper/xsecctl.hxx
index eaf4e66..e2d606f 100644
--- a/xmlsecurity/source/helper/xsecctl.hxx
+++ b/xmlsecurity/source/helper/xsecctl.hxx
@@ -381,14 +381,6 @@ public:
         const OUString& ouX509SerialNumber,
         const OUString& ouX509Cert,
         const OUString& ouX509CertDigest);
-    // see the other setX509Certifcate function
-    void setX509Certificate(
-        sal_Int32 nSecurityId,
-        const sal_Int32 nSecurityEnvironmentIndex,
-        const OUString& ouX509IssuerName,
-        const OUString& ouX509SerialNumber,
-        const OUString& ouX509Cert,
-        const OUString& ouX509CertDigest);
 
     void setDate(
         sal_Int32 nSecurityId,
diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx
index a6b5a21..8e4c5d9 100644
--- a/xmlsecurity/source/helper/xsecsign.cxx
+++ b/xmlsecurity/source/helper/xsecsign.cxx
@@ -234,23 +234,12 @@ void XSecController::setX509Certificate(
     const OUString& ouX509Cert,
     const OUString& ouX509CertDigest)
 {
-    setX509Certificate(nSecurityId, -1, ouX509IssuerName, ouX509SerialNumber, ouX509Cert, ouX509CertDigest);
-}
-
-void XSecController::setX509Certificate(
-    sal_Int32 nSecurityId,
-    const sal_Int32 nSecurityEnvironmentIndex,
-    const OUString& ouX509IssuerName,
-    const OUString& ouX509SerialNumber,
-    const OUString& ouX509Cert,
-    const OUString& ouX509CertDigest)
-{
     int index = findSignatureInfor( nSecurityId );
 
     if ( index == -1 )
     {
         InternalSignatureInformation isi(nSecurityId, nullptr);
-        isi.signatureInfor.nSecurityEnvironmentIndex = nSecurityEnvironmentIndex;
+        isi.signatureInfor.nSecurityEnvironmentIndex = -1;
         isi.signatureInfor.ouX509IssuerName = ouX509IssuerName;
         isi.signatureInfor.ouX509SerialNumber = ouX509SerialNumber;
         isi.signatureInfor.ouX509Certificate = ouX509Cert;
@@ -265,7 +254,7 @@ void XSecController::setX509Certificate(
         si.ouX509SerialNumber = ouX509SerialNumber;
         si.ouX509Certificate = ouX509Cert;
         si.ouCertDigest = ouX509CertDigest;
-        si.nSecurityEnvironmentIndex = nSecurityEnvironmentIndex;
+        si.nSecurityEnvironmentIndex = -1;
     }
 }
 


More information about the Libreoffice-commits mailing list