package/source/xstor/owriteablestream.cxx | 2 +- package/source/zippackage/ZipPackageStream.cxx | 3 +++ sfx2/source/doc/docfile.cxx | 15 +++++++-------- xmloff/source/core/xmlexp.cxx | 1 + xmlsecurity/source/xmlsec/nss/ciphercontext.cxx | 8 ++++---- 5 files changed, 16 insertions(+), 13 deletions(-)
New commits: commit f6536f4db61b73cf7fd4a44bb5ba61eff61f8f91 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Dec 6 13:54:39 2023 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Dec 7 09:28:08 2023 +0100 some cosmetic improvements, better warnings Change-Id: I05a7eeb74088c278aab94519c7f53b0482e38058 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160400 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 59e5e94316a3..68bf5d1688a0 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -1113,7 +1113,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream( sal_Int32 nStreamMod } catch ( const uno::Exception& ex ) { - TOOLS_WARN_EXCEPTION( "package.xstor", "Can't write encryption related properties"); + TOOLS_WARN_EXCEPTION("package.xstor", "GetStream: decrypting stream failed"); SetEncryptionKeyProperty_Impl( xPropertySet, uno::Sequence< beans::NamedValue >() ); throw io::IOException(ex.Message); // TODO: } diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index 02282a03c4e5..d3c80cec2dce 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -947,6 +947,9 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream() } catch( const packages::WrongPasswordException& ) { + // note: due to SHA1 check this fallback is only done for + // * ODF 1.2 files written by OOo < 3.4beta / LO < 3.5 + // * ODF 1.1/OOoXML files written by any version if ( m_rZipPackage.GetStartKeyGenID() == xml::crypto::DigestID::SHA1 ) { SAL_WARN("package", "ZipPackageStream::getDataStream(): SHA1 mismatch, trying fallbacks..."); diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index 42fe7d72b8c5..f4dd7b62e10f 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2954,13 +2954,11 @@ void SfxMedium::Download( const Link<void*,void>& aLink ) } -void SfxMedium::Init_Impl() -/* [Description] - Includes a valid:: sun:: com:: star:: util:: URL (If a file name was - previously in there) in the logical name and if available sets the - physical name as the file name. +/** + Sets m_aLogicName to a valid URL and if available sets + the physical name m_aName to the file name. */ - +void SfxMedium::Init_Impl() { Reference< XOutputStream > rOutStream; @@ -4124,7 +4122,7 @@ bool SfxMedium::SignDocumentContentUsingCertificate( } catch ( const uno::Exception& ) { - SAL_WARN( "sfx.doc", "Couldn't use signing functionality!" ); + TOOLS_WARN_EXCEPTION("sfx.doc", "Couldn't use signing functionality!"); } CloseAndRelease(); @@ -4134,6 +4132,7 @@ bool SfxMedium::SignDocumentContentUsingCertificate( return bChanges; } +// note: this is the only function creating scripting signature bool SfxMedium::SignContents_Impl(weld::Window* pDialogParent, bool bSignScriptingContent, bool bHasValidDocumentSignature, @@ -4294,7 +4293,7 @@ bool SfxMedium::SignContents_Impl(weld::Window* pDialogParent, } catch ( const uno::Exception& ) { - SAL_WARN( "sfx.doc", "Couldn't use signing functionality!" ); + TOOLS_WARN_EXCEPTION("sfx.doc", "Couldn't use signing functionality!"); } CloseAndRelease(); diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 7c6be149fac3..9900fa4d86fe 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -1185,6 +1185,7 @@ lcl_AddGrddl(SvXMLExport const & rExport, const SvXMLExportFlags /*nExportMode*/ #endif } +// note: the point of this is presumably to mitigate SHA/1k info leak of plain text void SvXMLExport::addChaffWhenEncryptedStorage() { uno::Reference< embed::XEncryptionProtectedSource2 > xEncr(mpImpl->mxTargetStorage, uno::UNO_QUERY); diff --git a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx index ff3441249435..9577c6d9c025 100644 --- a/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx +++ b/xmlsecurity/source/xmlsec/nss/ciphercontext.cxx @@ -160,7 +160,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::convertWithCipherContext( c { m_bBroken = true; Dispose(); - throw uno::RuntimeException(); + throw uno::RuntimeException("PK11_CipherOp failed"); } m_nConverted += aToConvert.getLength(); @@ -221,7 +221,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException(); + throw uno::RuntimeException("PK11_CipherOp failed"); } aResult.realloc( nPrefResLen ); @@ -235,7 +235,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException(); + throw uno::RuntimeException("PK11_DigestFinal failed"); } aResult.realloc( nPrefixLen + nFinalLen ); @@ -251,7 +251,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis { m_bBroken = true; Dispose(); - throw uno::RuntimeException(); + throw uno::RuntimeException("incorrect size of padding"); } aResult.realloc( aResult.getLength() - nBytesToRemove );