From 817dc69bb6c96f7494510cd45262aae677323a47 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 13 Jan 2023 15:27:02 +0200 Subject: [PATCH] XUnoTunnel->dynamic_cast in SecurityEnvironment_MSCryptImpl Change-Id: Idb013bd71b2a90cd6fb8927b199eb36e9bfd9c06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145474 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx | 3 --- .../xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx | 7 +------ .../source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx | 3 +-- .../source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx | 6 ++---- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index a9e58a33c746..cad73681efff 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -174,9 +174,6 @@ uno::Sequence< OUString > SAL_CALL SecurityEnvironment_MSCryptImpl::getSupported return { "com.sun.star.xml.crypto.SecurityEnvironment" }; } -/* XUnoTunnel */ -UNO3_GETIMPLEMENTATION_IMPL(SecurityEnvironment_MSCryptImpl); - HCRYPTPROV SecurityEnvironment_MSCryptImpl::getCryptoProvider() { return m_hProv ; } diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx index a4ae45742b98..5867b2b46281 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -49,8 +48,7 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper< css::xml::crypto::XSecurityEnvironment , - css::lang::XServiceInfo, - css::lang::XUnoTunnel > + css::lang::XServiceInfo > { private: //crypto provider and key container @@ -123,9 +121,6 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper< virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - //Methods from XUnoTunnel - UNO3_GETIMPLEMENTATION_DECL(SecurityEnvironment_MSCryptImpl) - /// @throws css::uno::Exception /// @throws css::uno::RuntimeException HCRYPTPROV getCryptoProvider() ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx index 08143f992379..d4eb48f877cd 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx @@ -78,8 +78,7 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL uno::Reference< cssxc::XSecurityEnvironment > xSecEnv = cssxc::SecurityEnvironment::create( mxContext ); /* Setup key slot and certDb */ - uno::Reference< cssl::XUnoTunnel > xSecEnvTunnel( xSecEnv, uno::UNO_QUERY_THROW ); - SecurityEnvironment_MSCryptImpl* pSecEnv = comphelper::getFromUnoTunnel(xSecEnvTunnel); + SecurityEnvironment_MSCryptImpl* pSecEnv = dynamic_cast(xSecEnv.get()); if( pSecEnv == nullptr ) { if( n_hStoreHandle != nullptr ) diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx index 87af0f040866..23833e71106b 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx @@ -102,8 +102,7 @@ SAL_CALL XMLSignature_MSCryptImpl::generate( throw RuntimeException() ; //Get Keys Manager - Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY_THROW ) ; - SecurityEnvironment_MSCryptImpl* pSecEnv = comphelper::getFromUnoTunnel(xSecTunnel); + SecurityEnvironment_MSCryptImpl* pSecEnv = dynamic_cast(aEnvironment.get()); if( pSecEnv == nullptr ) throw RuntimeException() ; @@ -191,8 +190,7 @@ SAL_CALL XMLSignature_MSCryptImpl::validate( Reference< XSecurityEnvironment > xSecEnv = aSecurityCtx->getSecurityEnvironmentByIndex( aSecurityCtx->getDefaultSecurityEnvironmentIndex()); - Reference< XUnoTunnel > xSecTunnel( xSecEnv , UNO_QUERY_THROW ) ; - SecurityEnvironment_MSCryptImpl* pSecEnv = comphelper::getFromUnoTunnel(xSecTunnel); + SecurityEnvironment_MSCryptImpl* pSecEnv = dynamic_cast(xSecEnv.get()); if( pSecEnv == nullptr ) throw RuntimeException() ;