summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/xmlsec
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-11-07 12:50:17 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-11-08 06:50:24 +0100
commit74f884d48ed27e1ce861620a57802ad156a86d15 (patch)
treeb3c467e4add03b7a4d0622c13900df4f3ab39692 /xmlsecurity/source/xmlsec
parentc049ac6503c0f0f6bb7170b68c19ccb400c525f7 (diff)
new loplugin:fieldcast
new plugin to look for class fields that are always cast to some subtype, which indicates that they should probably just be declared to be that subtype. Perform one of the suggested improvements in xmlsecurity/ Change-Id: Ia68df422c37f05cbcf9c02ba5d0853f8eca4f120 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159063 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlsecurity/source/xmlsec')
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx12
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx2
2 files changed, 7 insertions, 7 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 32ece48520d6..2ab5b011e2c7 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -344,14 +344,15 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::getCertificate( const OUS
}
Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl::buildCertificatePath( const Reference< XCertificate >& begin ) {
- // Remember the signing certificate.
- m_xSigningCertificate = begin;
- const X509Certificate_NssImpl* xcert = dynamic_cast<X509Certificate_NssImpl*>(begin.get());
+ X509Certificate_NssImpl* xcert = dynamic_cast<X509Certificate_NssImpl*>(begin.get());
if( xcert == nullptr ) {
throw RuntimeException() ;
}
+ // Remember the signing certificate.
+ m_xSigningCertificate = xcert;
+
const CERTCertificate* cert = xcert->getNssCert() ;
if (!cert)
return {};
@@ -796,10 +797,9 @@ xmlSecKeysMngrPtr SecurityEnvironment_NssImpl::createKeysManager() {
throw RuntimeException();
// Adopt the private key of the signing certificate, if it has any.
- if (auto pCertificate
- = dynamic_cast<X509Certificate_NssImpl*>(m_xSigningCertificate.get()))
+ if (m_xSigningCertificate)
{
- SECKEYPrivateKey* pPrivateKey = SECKEY_CopyPrivateKey(pCertificate->getPrivateKey());
+ SECKEYPrivateKey* pPrivateKey = SECKEY_CopyPrivateKey(m_xSigningCertificate->getPrivateKey());
if (pPrivateKey)
{
xmlSecKeyDataPtr pKeyData = xmlSecNssPKIAdoptKey(pPrivateKey, nullptr);
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
index 253d3ea1f4e3..c0e469899852 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
@@ -52,7 +52,7 @@ private:
std::vector< PK11SlotInfo* > m_Slots;
/// The last used certificate which has the private key for signing.
- css::uno::Reference<css::security::XCertificate> m_xSigningCertificate;
+ rtl::Reference<X509Certificate_NssImpl> m_xSigningCertificate;
std::mutex m_mutex;