diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-15 13:12:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-15 18:03:51 +0200 |
commit | 6e267990695548db227c918679b907c60263cb81 (patch) | |
tree | 96bca33746fe1a26a348a35c74a1dee8977c349d /xmlsecurity/source/xmlsec/nss | |
parent | 11bfced0a4f1d5f3ccaf8e1c87c11733ca71f29d (diff) |
loplugin:ostr in xmlsecurity
Change-Id: Ifb936c230f68447b3bb5993705adb5e5b790371f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167668
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Diffstat (limited to 'xmlsecurity/source/xmlsec/nss')
7 files changed, 41 insertions, 41 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx index c6031b7e1566..19e4e3ab991f 100644 --- a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx +++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx @@ -41,7 +41,7 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI if (!xResult->m_pSlot) { SAL_WARN("xmlsecurity.nss", "PK11_GetBestSlot failed"); - throw uno::RuntimeException("PK11_GetBestSlot failed"); + throw uno::RuntimeException(u"PK11_GetBestSlot failed"_ustr); } SECItem aKeyItem = { siBuffer, @@ -52,7 +52,7 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI if (!xResult->m_pSymKey) { SAL_WARN("xmlsecurity.nss", "PK11_ImportSymKey failed"); - throw uno::RuntimeException("PK11_ImportSymKey failed"); + throw uno::RuntimeException(u"PK11_ImportSymKey failed"_ustr); } if (nNSSCipherID == CKM_AES_GCM) @@ -68,7 +68,7 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI if (!xResult->m_pSecParam) { SAL_WARN("xmlsecurity.nss", "SECITEM_AllocItem failed"); - throw uno::RuntimeException("SECITEM_AllocItem failed"); + throw uno::RuntimeException(u"SECITEM_AllocItem failed"_ustr); } assert(aInitializationVector.getLength() == nAESGCMIVSize); xResult->m_AESGCMIV = aInitializationVector; @@ -92,14 +92,14 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI if (!xResult->m_pSecParam) { SAL_WARN("xmlsecurity.nss", "PK11_ParamFromIV failed"); - throw uno::RuntimeException("PK11_ParamFromIV failed"); + throw uno::RuntimeException(u"PK11_ParamFromIV failed"_ustr); } xResult->m_pContext = PK11_CreateContextBySymKey( nNSSCipherID, bEncryption ? CKA_ENCRYPT : CKA_DECRYPT, xResult->m_pSymKey, xResult->m_pSecParam); if (!xResult->m_pContext) { SAL_WARN("xmlsecurity.nss", "PK11_CreateContextBySymKey failed"); - throw uno::RuntimeException("PK11_CreateContextBySymKey failed"); + throw uno::RuntimeException(u"PK11_CreateContextBySymKey failed"_ustr); } } @@ -111,7 +111,7 @@ uno::Reference< xml::crypto::XCipherContext > OCipherContext::Create( CK_MECHANI if (SAL_MAX_INT8 < xResult->m_nBlockSize) { SAL_WARN("xmlsecurity.nss", "PK11_GetBlockSize unexpected result"); - throw uno::RuntimeException("PK11_GetBlockSize unexpected result"); + throw uno::RuntimeException(u"PK11_GetBlockSize unexpected result"_ustr); } return xResult; } @@ -160,7 +160,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( c if (SAL_MAX_INT32 - nAESGCMIVSize - nAESGCMTagSize <= static_cast<size_t>(m_aLastBlock.getLength()) + static_cast<size_t>(aData.getLength())) { m_bBroken = true; - throw uno::RuntimeException("overflow"); + throw uno::RuntimeException(u"overflow"_ustr); } m_aLastBlock.realloc(m_aLastBlock.getLength() + aData.getLength()); memcpy(m_aLastBlock.getArray() + m_aLastBlock.getLength() - aData.getLength(), aData.getConstArray(), aData.getLength()); @@ -228,7 +228,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( c { m_bBroken = true; Dispose(); - throw uno::RuntimeException("PK11_CipherOp failed"); + throw uno::RuntimeException(u"PK11_CipherOp failed"_ustr); } m_nConverted += aToConvert.getLength(); @@ -268,7 +268,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("PK11_Encrypt failed"); + throw uno::RuntimeException(u"PK11_Encrypt failed"_ustr); } assert(outLen == sal::static_int_cast<unsigned>(aResult.getLength() - nAESGCMIVSize)); } @@ -278,7 +278,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("inconsistent IV"); + throw uno::RuntimeException(u"inconsistent IV"_ustr); } aResult.realloc(m_aLastBlock.getLength() - nAESGCMIVSize - nAESGCMTagSize); if (PK11_Decrypt(m_pSymKey, CKM_AES_GCM, m_pSecParam, @@ -289,7 +289,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("PK11_Decrypt failed"); + throw uno::RuntimeException(u"PK11_Decrypt failed"_ustr); } assert(outLen == sal::static_int_cast<unsigned>(aResult.getLength())); } @@ -297,7 +297,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("incorrect size of input"); + throw uno::RuntimeException(u"incorrect size of input"_ustr); } Dispose(); return aResult; @@ -309,7 +309,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis // if it is decryption, the amount of data should be rounded to the block size even in case of padding if ( ( !m_bPadding || !m_bEncryption ) && nSizeForPadding ) - throw uno::RuntimeException("The data should contain complete blocks only." ); + throw uno::RuntimeException(u"The data should contain complete blocks only."_ustr ); if ( m_bW3CPadding && m_bEncryption ) { @@ -327,7 +327,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { if (rtl_random_getBytes(nullptr, pLastBlock + nOldLastBlockLen, nPaddingSize - 1) != rtl_Random_E_None) { - throw uno::RuntimeException("rtl_random_getBytes failed"); + throw uno::RuntimeException(u"rtl_random_getBytes failed"_ustr); } } pLastBlock[m_aLastBlock.getLength() - 1] = static_cast< sal_Int8 >( nPaddingSize ); @@ -345,7 +345,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("PK11_CipherOp failed"); + throw uno::RuntimeException(u"PK11_CipherOp failed"_ustr); } aResult.realloc( nPrefResLen ); @@ -359,7 +359,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("PK11_DigestFinal failed"); + throw uno::RuntimeException(u"PK11_DigestFinal failed"_ustr); } aResult.realloc( nPrefixLen + nFinalLen ); @@ -376,7 +376,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException("incorrect size of padding"); + throw uno::RuntimeException(u"incorrect size of padding"_ustr); } aResult.realloc(aResult.getLength() - aResult[aResult.getLength()-1]); diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx index 6bffc8ed2800..2647f7991657 100644 --- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx +++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx @@ -214,7 +214,7 @@ const OUString & ONSSInitializer::getMozillaCurrentProfile(const css::uno::Refer mozilla::MozillaProductType_Firefox, mozilla::MozillaProductType_Mozilla }; - uno::Reference<uno::XInterface> xInstance = rxContext->getServiceManager()->createInstanceWithContext("com.sun.star.mozilla.MozillaBootstrap", rxContext); + uno::Reference<uno::XInterface> xInstance = rxContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.mozilla.MozillaBootstrap"_ustr, rxContext); OSL_ENSURE( xInstance.is(), "failed to create instance" ); uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap(xInstance,uno::UNO_QUERY); @@ -255,7 +255,7 @@ css::uno::Sequence<css::xml::crypto::NSSProfile> SAL_CALL ONSSInitializer::getNS mozilla::MozillaProductType_Firefox, mozilla::MozillaProductType_Mozilla }; - uno::Reference<uno::XInterface> xInstance = m_xContext->getServiceManager()->createInstanceWithContext("com.sun.star.mozilla.MozillaBootstrap", m_xContext); + uno::Reference<uno::XInterface> xInstance = m_xContext->getServiceManager()->createInstanceWithContext(u"com.sun.star.mozilla.MozillaBootstrap"_ustr, m_xContext); OSL_ENSURE(xInstance.is(), "failed to create instance" ); uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap(xInstance,uno::UNO_QUERY); @@ -282,10 +282,10 @@ css::uno::Sequence<css::xml::crypto::NSSProfile> SAL_CALL ONSSInitializer::getNS { TOOLS_WARN_EXCEPTION("xmlsecurity.xmlsec", "getMozillaCurrentProfile:"); } - aProfileList.push_back({"MANUAL", sUserSelect, mozilla::MozillaProductType_Default}); + aProfileList.push_back({u"MANUAL"_ustr, sUserSelect, mozilla::MozillaProductType_Default}); const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER"); - aProfileList.push_back({"MOZILLA_CERTIFICATE_FOLDER", + aProfileList.push_back({u"MOZILLA_CERTIFICATE_FOLDER"_ustr, pEnv ? OStringToOUString(pEnv, osl_getThreadTextEncoding()) : OUString(), mozilla::MozillaProductType_Default}); @@ -436,7 +436,7 @@ bool nsscrypto_initialize(css::uno::Reference<css::uno::XComponentContext> const if (true) #else #if defined SYSTEM_NSS || defined ANDROID - OUString rootModule("libnssckbi" SAL_DLLEXTENSION); + OUString rootModule(u"libnssckbi" SAL_DLLEXTENSION ""_ustr); #else OUString rootModule("${LO_LIB_DIR}/libnssckbi" SAL_DLLEXTENSION); #endif @@ -565,10 +565,10 @@ css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL ONSSInitializer b1KData = ( nDigestID == css::xml::crypto::DigestID::SHA512_1K ); } else - throw css::lang::IllegalArgumentException("Unexpected digest requested.", css::uno::Reference< css::uno::XInterface >(), 1 ); + throw css::lang::IllegalArgumentException(u"Unexpected digest requested."_ustr, css::uno::Reference< css::uno::XInterface >(), 1 ); if ( aParams.hasElements() ) - throw css::lang::IllegalArgumentException("Unexpected arguments provided for digest creation.", css::uno::Reference< css::uno::XInterface >(), 2 ); + throw css::lang::IllegalArgumentException(u"Unexpected arguments provided for digest creation."_ustr, css::uno::Reference< css::uno::XInterface >(), 2 ); css::uno::Reference< css::xml::crypto::XDigestContext > xResult; if( initNSS( m_xContext ) ) @@ -595,20 +595,20 @@ css::uno::Reference< css::xml::crypto::XCipherContext > SAL_CALL ONSSInitializer nNSSCipherID = CKM_AES_GCM; break; default: - throw css::lang::IllegalArgumentException("Unexpected cipher requested.", css::uno::Reference< css::uno::XInterface >(), 1); + throw css::lang::IllegalArgumentException(u"Unexpected cipher requested."_ustr, css::uno::Reference< css::uno::XInterface >(), 1); } if ( aKey.getLength() != 16 && aKey.getLength() != 24 && aKey.getLength() != 32 ) - throw css::lang::IllegalArgumentException("Unexpected key length.", css::uno::Reference< css::uno::XInterface >(), 2 ); + throw css::lang::IllegalArgumentException(u"Unexpected key length."_ustr, css::uno::Reference< css::uno::XInterface >(), 2 ); if ( aParams.hasElements() ) - throw css::lang::IllegalArgumentException("Unexpected arguments provided for cipher creation.", css::uno::Reference< css::uno::XInterface >(), 5 ); + throw css::lang::IllegalArgumentException(u"Unexpected arguments provided for cipher creation."_ustr, css::uno::Reference< css::uno::XInterface >(), 5 ); css::uno::Reference< css::xml::crypto::XCipherContext > xResult; if( initNSS( m_xContext ) ) { if ( aInitializationVector.getLength() != PK11_GetIVLength( nNSSCipherID ) ) - throw css::lang::IllegalArgumentException("Unexpected length of initialization vector.", css::uno::Reference< css::uno::XInterface >(), 3 ); + throw css::lang::IllegalArgumentException(u"Unexpected length of initialization vector."_ustr, css::uno::Reference< css::uno::XInterface >(), 3 ); xResult = OCipherContext::Create( nNSSCipherID, aKey, aInitializationVector, bEncryption, bW3CPadding ); assert(xResult.is()); @@ -620,7 +620,7 @@ css::uno::Reference< css::xml::crypto::XCipherContext > SAL_CALL ONSSInitializer /* XServiceInfo */ OUString SAL_CALL ONSSInitializer::getImplementationName() { - return "com.sun.star.xml.crypto.NSSInitializer"; + return u"com.sun.star.xml.crypto.NSSInitializer"_ustr; } sal_Bool SAL_CALL ONSSInitializer::supportsService( const OUString& rServiceName ) diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index e35fe7ca0c78..bbdef624742f 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -138,7 +138,7 @@ SecurityEnvironment_NssImpl::~SecurityEnvironment_NssImpl() { /* XServiceInfo */ OUString SAL_CALL SecurityEnvironment_NssImpl::getImplementationName() { - return "com.sun.star.xml.crypto.SecurityEnvironment"; + return u"com.sun.star.xml.crypto.SecurityEnvironment"_ustr; } /* XServiceInfo */ @@ -148,7 +148,7 @@ sal_Bool SAL_CALL SecurityEnvironment_NssImpl::supportsService( const OUString& /* XServiceInfo */ Sequence< OUString > SAL_CALL SecurityEnvironment_NssImpl::getSupportedServiceNames() { - Sequence<OUString> seqServiceNames{ "com.sun.star.xml.crypto.SecurityEnvironment" }; + Sequence<OUString> seqServiceNames{ u"com.sun.star.xml.crypto.SecurityEnvironment"_ustr }; return seqServiceNames; } diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx index d8b0b0e6e16a..8a3c5551ad7a 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx @@ -88,7 +88,7 @@ void SAL_CALL SEInitializer_NssImpl::freeSecurityContext( const uno::Reference< /* XServiceInfo */ OUString SAL_CALL SEInitializer_NssImpl::getImplementationName( ) { - return "com.sun.star.xml.crypto.SEInitializer"; + return u"com.sun.star.xml.crypto.SEInitializer"_ustr; } sal_Bool SAL_CALL SEInitializer_NssImpl::supportsService( const OUString& rServiceName ) { @@ -96,7 +96,7 @@ sal_Bool SAL_CALL SEInitializer_NssImpl::supportsService( const OUString& rServi } uno::Sequence< OUString > SAL_CALL SEInitializer_NssImpl::getSupportedServiceNames( ) { - return { "com.sun.star.xml.crypto.SEInitializer" }; + return { u"com.sun.star.xml.crypto.SEInitializer"_ustr }; } namespace { @@ -118,12 +118,12 @@ NSSInitializer_NssImpl::NSSInitializer_NssImpl(const uno::Reference<uno::XCompon OUString NSSInitializer_NssImpl::getImplementationName() { - return "com.sun.star.xml.crypto.NSSInitializer"; + return u"com.sun.star.xml.crypto.NSSInitializer"_ustr; } uno::Sequence<OUString> SAL_CALL NSSInitializer_NssImpl::getSupportedServiceNames() { - return { "com.sun.star.xml.crypto.NSSInitializer" }; + return { u"com.sun.star.xml.crypto.NSSInitializer"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* diff --git a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx index b8bfa1311dc6..c0fc6a4fc7c4 100644 --- a/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/x509certificate_nssimpl.cxx @@ -481,7 +481,7 @@ sal_Int32 SAL_CALL X509Certificate_NssImpl::getCertificateUsage( ) /* XServiceInfo */ OUString SAL_CALL X509Certificate_NssImpl::getImplementationName() { - return "com.sun.star.xml.security.gpg.XCertificate_NssImpl"; + return u"com.sun.star.xml.security.gpg.XCertificate_NssImpl"_ustr; } /* XServiceInfo */ diff --git a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx index 9ccf0ab982e6..92e8cfd7b6ca 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx @@ -127,7 +127,7 @@ void SAL_CALL XMLSecurityContext_NssImpl::setDefaultSecurityEnvironmentIndex( sa /* XServiceInfo */ OUString SAL_CALL XMLSecurityContext_NssImpl::getImplementationName() { - return "com.sun.star.xml.crypto.XMLSecurityContext"; + return u"com.sun.star.xml.crypto.XMLSecurityContext"_ustr; } /* XServiceInfo */ @@ -137,7 +137,7 @@ sal_Bool SAL_CALL XMLSecurityContext_NssImpl::supportsService( const OUString& s /* XServiceInfo */ uno::Sequence< OUString > SAL_CALL XMLSecurityContext_NssImpl::getSupportedServiceNames() { - return { "com.sun.star.xml.crypto.XMLSecurityContext" }; + return { u"com.sun.star.xml.crypto.XMLSecurityContext"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx index 23b6ddac84c2..ce61942dda27 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx @@ -238,7 +238,7 @@ SAL_CALL XMLSignature_NssImpl::validate( // limit possible key data to valid X509 certificates only, no KeyValues if (xmlSecPtrListAdd(&(pDsigCtx->keyInfoReadCtx.enabledKeyData), BAD_CAST xmlSecNssKeyDataX509GetKlass()) < 0) - throw RuntimeException("failed to limit allowed key data"); + throw RuntimeException(u"failed to limit allowed key data"_ustr); xmlBufferPtr pBuf = xmlBufferCreate(); xmlNodeDump(pBuf, nullptr, pNode, 0, 0); @@ -289,7 +289,7 @@ SAL_CALL XMLSignature_NssImpl::validate( /* XServiceInfo */ OUString SAL_CALL XMLSignature_NssImpl::getImplementationName() { - return "com.sun.star.xml.crypto.XMLSignature"; + return u"com.sun.star.xml.crypto.XMLSignature"_ustr; } /* XServiceInfo */ @@ -307,7 +307,7 @@ sal_Bool SAL_CALL XMLSignature_NssImpl::supportsService(const OUString& rService /* XServiceInfo */ Sequence<OUString> SAL_CALL XMLSignature_NssImpl::getSupportedServiceNames() { - return { "com.sun.star.xml.crypto.XMLSignature" }; + return { u"com.sun.star.xml.crypto.XMLSignature"_ustr }; } extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |