Bug 116964 - Calc file with password takes a long time to open and save
Summary: Calc file with password takes a long time to open and save
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.1.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, perf
: 122060 122377 (view as bug list)
Depends on:
Blocks: Password-Protected
  Show dependency treegraph
 
Reported: 2018-04-12 09:52 UTC by Salim Habchi
Modified: 2024-07-21 03:14 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:


Attachments
File for testing (password: 1811) (567.36 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-04-12 09:52 UTC, Salim Habchi
Details
same file without password (549.24 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-04-12 09:53 UTC, Salim Habchi
Details
New file with patch (password: 1811) (566.97 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-04-18 08:51 UTC, Salim Habchi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Salim Habchi 2018-04-12 09:52:02 UTC
Created attachment 141304 [details]
File for testing (password: 1811)

Problem description: 
When you choose to save your file with a password, it takes long time to save and open.

Steps to reproduce:
1. Create a file with a large amount of contents.
2. Save your file with a password (Edit -> Save as).
3. Try to open it.

Operating System: All
Version: 6.1.0.0.alpha0+ Master
Comment 1 Salim Habchi 2018-04-12 09:53:28 UTC
Created attachment 141305 [details]
same file without password
Comment 2 Julien Nabet 2018-04-12 13:12:16 UTC Comment hidden (obsolete)
Comment 3 Salim Habchi 2018-04-12 13:40:04 UTC Comment hidden (obsolete)
Comment 4 Julien Nabet 2018-04-12 13:43:55 UTC Comment hidden (obsolete)
Comment 5 Xavier Van Wijmeersch 2018-04-13 06:42:39 UTC
opening the test file with password, it take 7.0 seconds and without 4.0 seconds a bit slow when switching between sheets and i think its because of the many chart on every sheet

Version: 6.1.0.0.alpha0+
Build ID: 4ab0912cd214a4b0bdcbcdd2711b831dab9ca60a
CPU threads: 8; OS: Linux 4.14; UI render: default; VCL: kde4; 
Locale: nl-BE (en_US.UTF-8); Calc: group
Comment 6 Salim Habchi 2018-04-13 07:40:25 UTC
(In reply to Xavier Van Wijmeersch from comment #5)
> opening the test file with password, it take 7.0 seconds and without 4.0
> seconds a bit slow when switching between sheets and i think its because of
> the many chart on every sheet
> 
> Version: 6.1.0.0.alpha0+
> Build ID: 4ab0912cd214a4b0bdcbcdd2711b831dab9ca60a
> CPU threads: 8; OS: Linux 4.14; UI render: default; VCL: kde4; 
> Locale: nl-BE (en_US.UTF-8); Calc: group

Hello,

Try to add a simple modification to the file with password and save it.

It will take a lot of time.
Comment 7 Xisco Faulí 2018-04-13 07:49:35 UTC
Yes, it hangs in 

Version: 6.1.0.0.alpha0+
Build ID: 24a57e2b854a1b8b3b8533ac72a6614ee29e374a
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group
Comment 8 Xisco Faulí 2018-04-13 07:55:36 UTC
In previous versions like

Version: 5.2.0.0.alpha0+
Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53
Threads 4; Ver: 4.10; Render: default;

or

Version: 4.3.0.0.alpha1+
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e

it hangs at import time...
Comment 9 Xisco Faulí 2018-04-13 08:11:03 UTC
The import hang was fixed by

author	Mike Kaganski <mike.kaganski@collabora.com>	2017-11-07 13:33:48 +0300
committer	Noel Grandin <noel.grandin@collabora.co.uk>	2017-11-07 14:26:11 +0100
commit f657454b69c813b90a8b3c1adb2feef1066dbd35 (patch)
tree d1c57e8dc220ae1a5e7d1a2b49025685042318f3
parent 55d00081d0dc4cfa3361fa9da9389042f98773b5 (diff)
tdf#31231: properly check for SvXMLImportFlags::ALL
A regression from commit dc28e90d200a839d4017d548217ee5ce8a23f84

Adding Mike Kaganski to the loop in case Salim Habchi needs help to fix the export part...
Comment 10 Salim Habchi 2018-04-13 08:43:41 UTC
Import = when you open the file ?
Export = when you save the file ?

Thank you very much, I will explore the tracks you gave me.
Comment 11 Salim Habchi 2018-04-18 08:07:19 UTC
here is my commit on gerrit for this bug

https://gerrit.libreoffice.org/#/c/53083/
Comment 12 Salim Habchi 2018-04-18 08:35:30 UTC
I decreased the number of iterations in PBDFK2 because it was set to 100000 but it 

takes a lot of time to save a file (10 min).

the problem comes from these iterations.

I put the number of iterations to 1000.

now it takes 10 sec to save a file.

the derived key is sufficient for this type of files and it is very secure if you choose a good password.

The informations below shows how long an attacker would take to cover the entire password space of a single salted hashed password.

Complexity password

* Comprehensive8: 4 hours 46 minutes

* 8 random lowercase letters: 12 hours

* 8 random letters: 123 days

* 8 letters + digits + punctuation OR 4 random Diceware words: 325 years

From: https://cryptosense.com/blog/parameter-choice-for-pbkdf2/
Other link: https://www.cloudberrylab.com/download/CloudBerry%20Lab%20Security%20Considerations.pdf

If you want to test this patch with the old testing file you must save at least one time the file with this patch.

I will add the same file with my patch.
Comment 13 Julien Nabet 2018-04-18 08:37:27 UTC
Thorsten: noticing you had removed a similar loop in https://cgit.freedesktop.org/libreoffice/core/commit/?id=39805f65189cd0085fe8f1071ae75cdec450c65e, thought you might be interested in the patch proposed by Salim.
Comment 14 Salim Habchi 2018-04-18 08:51:43 UTC
Created attachment 141448 [details]
New file with patch (password: 1811)
Comment 15 Telesto 2018-05-19 19:54:08 UTC
See also bug 105844 comment 12 & 13
Comment 16 Buovjaga 2019-04-18 20:40:04 UTC
*** Bug 122060 has been marked as a duplicate of this bug. ***
Comment 17 Buovjaga 2019-04-18 20:40:41 UTC
*** Bug 122377 has been marked as a duplicate of this bug. ***
Comment 18 QA Administrators 2022-07-13 03:30:07 UTC Comment hidden (obsolete)
Comment 19 Erhard 2022-07-21 17:12:56 UTC
I have performed a re-test in the way as I had reported in bug 122060.
Used version:
Version: 7.2.5.1 / LibreOffice Community
Build ID: 20(Build:1)
CPU threads: 8; OS: Linux 5.3; UI render: default; VCL: kf5 (cairo+xcb)
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Calc: threaded

Test Result:
Used file size (type ods): 76.1 KiB
Save time: 6 - 7 seconds

For comparison:
A file with same content and password, but of type xlsx (size is 244 KiB), saves in about 2 seconds.
A file with same content and without password, of type ods, saves in about 1 second.

Conclusion: It behaves better now, but saving is still slow in comparison with an xlsx file. And I'd say it's still unacceptably slow for a file of such small size.
Comment 20 QA Administrators 2024-07-21 03:14:17 UTC
Dear Salim Habchi,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug