145 Commits
Author SHA1 Message Date
Xisco Fauli 651a778ba1 cid#1700595: silence Unchecked return value
Change-Id: I68a2ed40de7b41f3c1704e0f149d555bde82919e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210282
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-31 15:56:16 +02:00
Andrea Gelmini 318520ca2a Fix typos
Change-Id: I85443b13c724e53d96fc80081c365bc4d9fc71bb

Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209807
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-08-25 15:48:01 +02:00
Michael Stahl aac2961770 oox,svl,vcl: use more appropriate random numbers
Signed-off-by: Michael Stahl <michael.stahl@collabora.com>
Change-Id: I9d6f200cc5a146f46dca64af270b77d0ce6abf6b
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8174
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 52ba487c3d84a89a027c3130bc86afdcfe57a860)
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/8261
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
(cherry picked from commit 63ab1f905bddbac4871a246d61aa59d09f122e5c)
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/8277
(cherry picked from commit 396747a0e319943e7d411b0d6bc8d8abcc3e4f19)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209276
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-08-19 00:20:32 +02:00
Michael Stahl b76587cda0 oox: remove AgileEncryptionPreset::AES_128_SHA1
Should never be produced in practice.
SHA1 may still be used when loading existing document.

Signed-off-by: Michael Stahl <michael.stahl@collabora.com>
Change-Id: Id14c10186a8fae270e75b6cc1cda191dabd9392c
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5166
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
(cherry picked from commit de8c258fac0c878cbb52b9bf819e16ea16e0b484)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207315
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-25 23:57:14 +02:00
Michael Stahl 25d359ed07 oox: OOXML export: use AgileEngine instead of Standard2007Engine
AgileEngine is supported since MS Office 2010 so not much point in using
older and weaker cryptography today.

Signed-off-by: Michael Stahl <michael.stahl@collabora.com>
Change-Id: Id6ea9ae14bdc84b2877edf45a8e2717cbf3e9af1
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5165
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
(cherry picked from commit 21c1cc0eb20964a5a3b9626cbf85f8485aa02c91)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207314
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-25 23:57:10 +02:00
Caolán McNamara 1ec3db717f Conform AlignEngine parsing to what section 2.3.4.10 of the spec has
Change-Id: Ibb9162b1ce7993ef74665ec0329c95b423fa8174
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/201874
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2026-03-17 20:27:44 +01:00
Tomaž Vajngerl 4fa74cefc3 tools: use string_view instead of OString in XmlWriter
Change-Id: I55dd06fc432d9686b370274a4621d61c035a99dc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193997
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2025-11-19 07:33:37 +01:00
Arnaud VERSINI 234b42d449 comphelper : use more u16string_view instead of const OUString&
Change-Id: Ie571697e63a97e7a6d306ee6f551c4bcf9aa99fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184941
Reviewed-by: Arnaud Versini <arnaud.versini@pm.me>
Tested-by: Jenkins
2025-06-09 16:26:55 +02:00
Julien Nabet a399c4fae0 tdf#166241: add AES_192_CBC/AES_192_EBC
+ improve SALT management by taking the max between encryptedHashInput.size()
and comphelper::roundUp(mInfo.saltSize, mInfo.blockSize)

+ add QA tests

Change-Id: I90dce73928e0b204500ac659eb80cd1499a4f065
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184407
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-04-23 17:22:07 +02:00
Tomaž Vajngerl c8cba8ae30 move CryptTools from oox to comphelper so we can reuse it
Also move the relevant tests and clean-up the names a bit to make
it mroe consistent.

Change-Id: I929ef9c13b954fd6a506471231d1bc41e4ef9980
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176027
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-11-04 21:51:32 +01:00
Tomaž Vajngerl 29fb374c52 CryptTools: simplify the define conditions a bit
Change-Id: I6ef207eae6fbeec2ba77fa46a3274e43d02fe1e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176022
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-11-04 21:20:14 +01:00
Bogdan Buzea d3dd616f56 tdf#163486: PVS: Identical branches
V1037 Two or more case-branches perform the same actions. Check lines: 289, 293

Change-Id: I9828b4d5b7faca449c5377a0bd8223cddf883a43
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175423
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-10-23 11:50:06 +02:00
Mike Kaganski 3a37d8320c Optimize TokenMap and AttributeList in oox and xo
Shaves lots of string allocations, and uses optimized code paths

Change-Id: I8e33e2aecdc7e0d2f2c31b774daa36304b3973ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173179
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-09-12 23:09:23 +02:00
Noel Grandin 239ceb3155 loplugin:ostr in oox
Change-Id: I08124ce2da1facbe2e84aa4a7a8e25fec24fa962
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167428
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-05-10 09:51:34 +02:00
Caolán McNamara e5aa87aeeb drop requirement for rtl_random_getBytes to have "Pool" arg
Seeing as since:

commit e9531b792d
Date:   Tue Feb 6 14:39:47 2024 +0100

    sal: rtlRandomPool: require OS random device, abort if not present

    Both rtl_random_createPool() and rtl_random_getBytes() first try to get
    random data from the OS, via /dev/urandom or rand_s() (documented to
    call RtlGenRandom(), see [1]).

we don't use the initial arg to rtl_random_getBytes anymore, drop the
requirement to have one. Then simplify our usages of that, and
addtionally deprecate rtl_random_createPool and rtl_random_destroyPool.

Change-Id: I13dcc067714a8a741a4e8f2bfcf2006373f832c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167067
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-05-08 11:29:54 +02:00
Michael Stahl b85c2459ce check that rtl_random_getBytes() was successful
... everywhere it is used to generate material for encryption.

Change-Id: Id3390376bb2f3a5fa1bbfd735850fce886ef7db2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162873
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-02-01 13:54:32 +01:00
Mike Kaganski 0fa827dbb2 Drop std::as_const from css::uno::Sequence iterations
Obsoleted by commit 2484de6728 (Remove
non-const Sequence::begin()/end() in internal code, 2021-10-15) and
commit fb3c04bd19 (Drop non-const
Sequence::operator[] in internal code, 2021-11-05).

Change-Id: Idbafef5d34c0d4771cbbf75b9db9712e504164cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162640
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-01-27 12:43:48 +01:00
Stephan Bergmann 71d4abc51b -Werror,-Wdeprecated-declarations (Emscripten)
> oox/source/crypto/CryptTools.cxx:57:40: error: 'HMAC_CTX_free' is deprecated [-Werror,-Wdeprecated-declarations]
>         void operator()(HMAC_CTX* p) { HMAC_CTX_free(p); }
>                                        ^
> workdir/UnpackedTarball/openssl/include/openssl/hmac.h:35:1: note: 'HMAC_CTX_free' has been explicitly marked deprecated here
> OSSL_DEPRECATEDIN_3_0 void HMAC_CTX_free(HMAC_CTX *ctx);
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
> #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
>                                                 ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
> #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
>                                                    ^
> oox/source/crypto/CryptTools.cxx:112:29: error: 'HMAC_CTX_new' is deprecated [-Werror,-Wdeprecated-declarations]
>         mpHmacContext.reset(HMAC_CTX_new());
>                             ^
> workdir/UnpackedTarball/openssl/include/openssl/hmac.h:33:1: note: 'HMAC_CTX_new' has been explicitly marked deprecated here
> OSSL_DEPRECATEDIN_3_0 HMAC_CTX *HMAC_CTX_new(void);
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
> #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
>                                                 ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
> #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
>                                                    ^
> oox/source/crypto/CryptTools.cxx:125:9: error: 'HMAC_Init_ex' is deprecated [-Werror,-Wdeprecated-declarations]
>         HMAC_Init_ex(mpHmacContext.get(), rKey.data(), rKey.size(), aEvpMd, nullptr);
>         ^
> workdir/UnpackedTarball/openssl/include/openssl/hmac.h:43:1: note: 'HMAC_Init_ex' has been explicitly marked deprecated here
> OSSL_DEPRECATEDIN_3_0 int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
> #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
>                                                 ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
> #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
>                                                    ^
> oox/source/crypto/CryptTools.cxx:499:12: error: 'HMAC_Update' is deprecated [-Werror,-Wdeprecated-declarations]
>     return HMAC_Update(mpImpl->mpHmacContext.get(), rInput.data(), nActualInputLength) != 0;
>            ^
> workdir/UnpackedTarball/openssl/include/openssl/hmac.h:45:1: note: 'HMAC_Update' has been explicitly marked deprecated here
> OSSL_DEPRECATEDIN_3_0 int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data,
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
> #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
>                                                 ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
> #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
>                                                    ^
> oox/source/crypto/CryptTools.cxx:512:12: error: 'HMAC_Final' is deprecated [-Werror,-Wdeprecated-declarations]
>     (void) HMAC_Final(mpImpl->mpHmacContext.get(), aHash.data(), &nSizeWritten);
>            ^
> workdir/UnpackedTarball/openssl/include/openssl/hmac.h:47:1: note: 'HMAC_Final' has been explicitly marked deprecated here
> OSSL_DEPRECATEDIN_3_0 int HMAC_Final(HMAC_CTX *ctx, unsigned char *md,
> ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:182:49: note: expanded from macro 'OSSL_DEPRECATEDIN_3_0'
> #   define OSSL_DEPRECATEDIN_3_0                OSSL_DEPRECATED(3.0)
>                                                 ^
> workdir/UnpackedTarball/openssl/include/openssl/macros.h:62:52: note: expanded from macro 'OSSL_DEPRECATED'
> #     define OSSL_DEPRECATED(since) __attribute__((deprecated))
>                                                    ^

Change-Id: Ia9edc299b7cd4728fe32adbca8e1212170c328ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162248
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-01-18 21:09:30 +01:00
Caolán McNamara 15ff0c3828 cid#1545975 COPY_INSTEAD_OF_MOVE
and

cid#1545955 COPY_INSTEAD_OF_MOVE
cid#1545954 COPY_INSTEAD_OF_MOVE
cid#1545952 COPY_INSTEAD_OF_MOVE
cid#1545948 COPY_INSTEAD_OF_MOVE
cid#1545943 COPY_INSTEAD_OF_MOVE
cid#1545935 COPY_INSTEAD_OF_MOVE
cid#1545930 COPY_INSTEAD_OF_MOVE
cid#1545928 COPY_INSTEAD_OF_MOVE
cid#1545925 COPY_INSTEAD_OF_MOVE
cid#1545922 COPY_INSTEAD_OF_MOVE

Change-Id: I28d830504337f417829c675b1eb9c763b83b30c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160522
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2023-12-10 11:57:35 +01:00
Stephan Bergmann f53172a114 Extended loplugin:ostr: oox
Change-Id: Ic3ee80433571767dba9de1ecfb00d2d96beae4db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159690
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-11-19 22:04:26 +01:00
Stephan Bergmann 44bd87fd78 Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: oox
Change-Id: Ic5bcb44fbe56804e23bcdfd039a77c010858ca02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158206
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-10-20 07:58:45 +02:00
Balazs Varga 9254fbce6b tdf#156835 - FILEOPEN XLSX: add SHA-384 encryption support for ooxml import
Password protected file with SHA-384 encryption does not open before this
patch.

Change-Id: I482233f788b8e9da210ad6d2a6c4ece18d05d248
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156282
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2023-08-30 14:34:39 +02:00
Noel Grandin e899a75fc6 Revert "Convert XFastParser into a normal C++ interface"
This reverts commit 5e68d6cfad.

Reason for revert: Seems like outside users have been using this API

Change-Id: I8814cf1eb4f000eeb4cbbb5db9c282d001465993
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152441
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-01 15:07:18 +02:00
Noel Grandin 5e68d6cfad Convert XFastParser into a normal C++ interface
There is no need for it to be an UNO interface anymore (ever since
we started supporting dynamic_cast on UNO objects).

Which means that XImportFilter2 also needs become a C++ interface.

Change-Id: Ice2db0f098271bba32b199bd083b08cb8410ce93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152388
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-06-01 11:59:06 +02:00
Caolán McNamara 5583d5c714 ofz#55499 output buffer has to at least be the same size as input buffer
Change-Id: Ie80b058673c47db11334554189ad878a884e26db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146306
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2023-01-29 15:23:12 +00:00
Andras Timar 6053df3ecd NSS initialization guard
Change-Id: I61a5886d0d13eaef6a61479e35d52a85937075ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142385
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146042
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2023-01-25 12:24:34 +00:00
Noel Grandin ceaff89c97 use more string_view in oox
Change-Id: Ib0d7015a898073d51ac2638d62a19eadcba37685
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140653
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-28 08:42:01 +02:00
Noel Grandin 81002bc718 clang-tidy modernize-pass-by-value in oox
Change-Id: Ia553a24693f2ffc0f580c9869b82f0d01a1a0ffb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137693
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-08-02 14:36:02 +02:00
Noel Grandin 250a70dc37 use more string_view in oox
Change-Id: I25fe1cbfae43bb533e7dfc2561d0b70976aa6a40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132985
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-04-14 11:25:07 +02:00
Mike Kaganski 8a017d25a6 Avoid COW overhead using css::uno::Sequence
The scenarios are:

1. Calling sequence's begin() and end() in pairs to pass to algorithms
   (both calls use getArray(), which does the COW checks)
2. In addition to #1, calling end() again when checking result of find
   algorithms, and/or begin() to calculate result's distance
3. Using non-const sequences in range-based for loops, which internally
   do #1
4. Assigning sequence to another sequence variable, and then modifying
   one of them

In many cases, the sequences could be made const, or treated as const
for the purposes of the algorithms (using std::as_const, std::cbegin,
and std::cend). Where algorithm modifies the sequence, it was changed
to only call getArray() once. For that, css::uno::toNonConstRange was
introduced, which returns a struct (sublclass of std::pair) with two
iterators [begin, end], that are calculated using one call to begin()
and one call to getLength().

To handle #4, css::uno::Sequence::swap was introduced, that swaps the
internal pointer to uno_Sequence. So when a local Sequence variable
should be assigned to another variable, and the latter will be modified
further, it's now possible to use swap instead, so the two sequences
are kept independent.

The modified places were found by temporarily removing non-const end().

Change-Id: I8fe2787f200eecb70744e8b77fbdf7a49653f628
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123542
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2021-10-14 06:00:49 +02:00
Noel Grandin 9c9ff9e89f clang-tidy:readability-redundant-member-init
Change-Id: I78339f1df1f0c55c7edaa552940b07d1ada3aeb5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121386
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-01 10:01:44 +02:00
Julien Nabet 399a6472f6 Potentially uninitialized local variable 'aEvpMd' used
Seen on Win10:
cd C:/cygwin/home/serva/lode/dev/core/oox && C:/cygwin/home/serva/lode/opt/bin/make -j 1 -rs build
[build DEP] LNK:Library/ooxlo.dll
[build CXX] oox/source/crypto/CryptTools.cxx
C:\cygwin\home\serva\lode\dev\core\oox\source\crypto\CryptTools.cxx(122) : error C2220: the following warning is treated as an error
C:\cygwin\home\serva\lode\dev\core\oox\source\crypto\CryptTools.cxx(122) : warning C4701: potentially uninitialized local variable 'aEvpMd' used
C:\cygwin\home\serva\lode\dev\core\oox\source\crypto\CryptTools.cxx(122) : warning C4703: potentially uninitialized local pointer variable 'aEvpMd' used
make[1]: *** [C:/cygwin/home/serva/lode/dev/core/solenv/gbuild/LinkTarget.mk:301: C:/cygwin/home/serva/lode/dev/core/workdir/CxxObject/oox/source/crypto/CryptTools.o] Error 2
make: *** [Makefile:122: oox.build] Error 2

Change-Id: Id9409c95aa3edf866671ef8418e7ade3cbc1e718
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116740
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2021-06-05 19:08:08 +02:00
Noel 8332d6d820 loplugin:stringviewparam include comparisons with string literals
Change-Id: I8ba1214500dddaf413c506a4b82f43d63cda804b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106559
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-30 12:32:14 +01:00
Noel bb06f51308 loplugin:stringviewparam extend to comparison operators
which means that some call sites have to change to use
unicode string literals i.e. u"foo" instead of "foo"

Change-Id: Ie51c3adf56d343dd1d1710777f9d2a43ee66221c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106125
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-24 09:45:04 +01:00
Philipp Hofer c4ab5393e1 tdf#123936 Formatting files in module oox with clang-format
Change-Id: Ie061189450e0f9004ca503bb28164885812f2acc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105694
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2020-11-19 19:22:02 +01:00
Gabor Kelemen 877f40ac3f tdf#42949 Fix new IWYU warnings in directories [h-r]*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I886b6f446293d3b1cfbf4ae05e8dbd7fabab9f20
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105510
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-10 14:13:14 +01:00
Caolán McNamara e11cdf021a ofz#26128 check at start instead of end if encryptedHashValue is too small
Change-Id: I10774802c96f6f0912a4ee3bf9a6a2a9482b7c94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103918
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-10-04 18:02:11 +02:00
Stephan Bergmann 646a69757b Fix endianness issues in OOX crypto routines
...without which CppunitTest_sw_ooxmlencryption failed on (big-endian) s390x:

* The 32-bit segment counter in AgileEngine::de-/encrypt apparently needs to be
  stored in LSB format (at least, if it is, CppunitTest_sw_ooxmlencryption
  ultimately succeeded, whereas otherwise it failed).

* The UTF-16 string in Standard2007Engine::calculateEncryptionKey apparently
  needs to be in LSB format (at least, if it is, CppunitTest_sw_ooxmlencryption
  ultimately succeeded, whereas otherwise it failed).

* The various 32-bit values in the EncryptionStandardHeader and
  EncryptionVerifierAES data structures apparently need to be written out in LSB
  format in Standard2007Engine::writeEncryptionInfo, given that they are always
  read in LSB format in Standard2007Engine::readEncryptionInfo.

Change-Id: I3a1efbfe324b1bbd539b88dc5d40bb44f9676ffa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103315
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-09-24 18:07:36 +02:00
Caolán McNamara de74d98c58 OUStringLiteral/OStringLiteral coverity PARSE_ERROR workaround
do more like

commit 121771e37f
Date:   Mon Sep 21 09:17:54 2020 +0200

    Make some OUStringLiteral vars constexpr

cause coverity can live with that

Change-Id: I9efd7f848289c4865997a44c6780373068422227
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103147
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-09-22 12:58:14 +02:00
Caolán McNamara 7a8952726c ofz#24770 oom
Change-Id: I0ccae77753fa9a1efb9cb405920f8ee8ffe9fbb2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101565
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-08-28 22:01:51 +02:00
Stephan Bergmann 33ecd0d5c4 Change OUStringLiteral from char[] to char16_t[]
This is a prerequisite for making conversion from OUStringLiteral to OUString
more efficient at least for C++20 (by replacing its internals with a constexpr-
generated sal_uString-compatible layout with a SAL_STRING_STATIC_FLAG refCount,
conditionally for C++20 for now).

For a configure-wise bare-bones build on Linux, size reported by `du -bs
instdir` grew by 118792 bytes from 1155636636 to 1155755428.

In most places just a u"..." string literal prefix had to be added.  In some
places

  char const a[] = "...";

variables have been changed to char16_t, and a few places required even further
changes to code (which prompted the addition of include/o3tl/string_view.hxx
helper function o3tl::equalsIgnoreAsciiCase and the additional
OUString::createFromAscii overload).

For all uses of macros expanding to string literals, the relevant uses have been
rewritten as

  u"" MACRO

instead of changing the macro definitions.  It should be possible to change at
least some of those macro definitions (and drop the u"" from their call sites)
in follow-up commits.

Change-Id: Iec4ef1a057d412d22443312d40c6a8a290dc6144
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101483
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-08-28 08:07:09 +02:00
Caolán McNamara 2730ae520d ofz#24934 practically infinite loop on eof
Change-Id: Iaa6121f3a0088978c57718610bc9baf9bcfe6fee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101489
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-08-27 20:33:50 +02:00
Noel Grandin 3457da6abe loplugin:stringstatic also look for local statics
Add some API to O*StringLiteral, to make it easier
to use in some places that were using O*String

Change-Id: I1fb93bd47ac2065c9220d509aad3f4320326d99e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100270
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-13 08:16:03 +02:00
Caolán McNamara 11112bdb2d ofz#24317 hash too short
Change-Id: I6b2df62f0d18c6918a82a002f1e9a364c877caf1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99211
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-22 12:52:20 +02:00
Caolán McNamara 92146170f1 fix --with-tls=openssl build with openssl upgrade
Change-Id: I0fece9f692637dc6948355c210534f5333fab7ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99030
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-20 12:23:42 +02:00
Caolán McNamara 57d6ba4e49 fix some warnings with --with-tls=openssl
Change-Id: I17cc8919aeecaddb09f2fbf37611b672e4859ff0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99029
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-07-20 11:59:04 +02:00
Noel Grandin 1c4c096f73 compact namespace: oox
Change-Id: I9ea016adcec334437da45296ee325453347836ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99002
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-19 21:07:36 +02:00
Miklos Vajna 4fcd42afd3 comphelper: don't hardcode hash sizes in Hash::getLength()
Instead move the constants from filter to comphelper and reuse them.

Change-Id: Ib7061e9028ccf6067b4e86f50145c1472c2b01d4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98785
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-07-15 09:16:05 +02:00
Stephan Bergmann 740d87c0cc Upcoming improved loplugin:staticanonymous -> redundantstatic: oox
Change-Id: I1c6a2852e4794529ec7d55ceae485196a8170e24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97617
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-07-01 19:50:18 +02:00
Vasily Melenchuk b9353394f4 [MS-OFFCRYPTO] convert oox implementation into UNO service
To permit pluggable crypto services, abstract existing
implementation behind an XPackageEncryption API.

Previous code already had two halfway-polymorphic classes (agile and
standard 2007 engine), so we're not adding much additional layers.

As MS crypto always uses OLE storage to wrap content into one single
file, current implementation passes all substorage names down into
XPackageEncryption APi, so different downstream implementations (e.g.
for MS RMS, or Azure AIP) are possible.

Because OleStorage classes are internal to LibO core, access is provided
via XInput/XOutput stream API function.

Change-Id: Icc32a4e0ce215090c3b739f1dcaa0654b36b7f08
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/84436
Tested-by: Jenkins
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
2020-05-25 10:04:15 +02:00