-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database unlock is slow in 2.7.0-beta1 #7487
Comments
I suppose Botan is less optimized than libargon2. @droidmonkey Should we do some benchmarks? |
From 2 to 9 seconds is extreme and interesting. I definitely notice a slower speed with botan, but not >4x slower. https://github.com/microsoft/vcpkg/tree/master/ports%2Fbotan https://github.com/msys2/MINGW-packages/tree/master/mingw-w64-libbotan @randombit I am building Botan using vcpkg, might we be missing an optimization flag in there? |
Are you sure you are not using their Also I have no idea of the performance of Argon2 on VC. In general I use GCC/Clang on Linux, and IME the VC optimizer is significantly less good. The iteration count for Argon2 seems really high given that RFC 9106 recommends no more than |
When I tried it with Iterations 3 Memory 2047MB Parallelism 8, it took about 1-2 seconds with KeePassXC 2.6.6, 1.3 seconds with KeePass 2.50, and about 6-7 seconds with KeePassXC 2.7.0-beta1. When I tried it again with Iterations 128 Memory 64MB Parallelism 8, it took about 8 seconds, so I don't think the impact of Iterations is significant. (Is it better to reduce the number of iterations? The default setting of the KeePass 2.50 is Memory 64MB, so I used it.) |
It should definitely not be slower than KeePass2. In fact, it should be much faster than that. |
You reduced iterations and significantly increased memory. Do one or the other. I certainly don't see the level of degradation that you do under a 1 second benchmark. My database decrypts in roughly the same time between my mobile (KeePassDX) and laptop (KPXC 2.7.0). My laptop should be much faster than mobile, but it's not. I'll have to check on the dbg mode. |
Comparing Botan: 4.8 s (via [Why this discrepancy is so large in favor of Botan I have no idea] ... oh now I see why ...
OK so for |
Oof that is a big deal if we aren't doing parallelism in threads. This may make me want to go back to the reference implementation. |
I am in favour of that until this is fixed. I can confirm that 2.6.6 with p > 1 decrypts much faster. When I benchmark to 128MiB at 16 threads, I get 6 rounds in 2.7.0-beta1 and 44 rounds in 2.6.6. But that's not all. If I set p = 1, I still get 6 rounds in 2.7.0-beta1 (not surprisingly), but 10 rounds in 2.6.6. So while the missing support for threads is the biggest issue, the whole thing seems less efficient than the reference implementation. |
Luckily it's not a big deal to go back to libargon2. Will try to get that in a PR tonight for review. @randombit why not just embed and wrap the reference implementation by Botan API? Their license is CC0 / Apache. |
@droidmonkey The way their code is written, integrating it/adapting it would be harder than just adding threading and SIMD support directly. PR adding threads is up now, SSSE3 version is written but needs some debugging still. I'll backport these in the next 2.x release. Probably too late to get into upcoming Ubuntu 22.04 though. Wish this issue had been raised sooner. :/ |
Great, thanks for resolving this quickly. @droidmonkey Could we perhaps compile conditionally, depending on the installed Botan version? |
Just as an FYI, I wrote a quick tool to properly benchmark the performance of @phoerious I'm curious about the results you are seeing with |
Windows, Ryzen 3950X, so I guess not. Also tested it on the Threadripper 2920X machine I'm working on right now (Ubuntu Linux, AVX2 only) and I get roughly the same performance there (8 vs. 7, sometimes 8). Here's
I can test the Ryzen in the evening. |
@randombit Here's the results on my Ryzen (Windows, compiled via Msys2):
|
* Fix #7487 - Botan does not use threads when calculating Argon2 KDF leading to very poor performance for a parallelism value > 1. * Include port file for vcpkg backed builds
* Fix #7487 - Botan does not use threads when calculating Argon2 KDF leading to very poor performance for a parallelism value > 1. * Include port file for vcpkg backed builds
* Fix #7487 - Botan does not use threads when calculating Argon2 KDF leading to very poor performance for a parallelism value > 1. * Include port file for vcpkg backed builds
* Fix #7487 - Botan does not use threads when calculating Argon2 KDF leading to very poor performance for a parallelism value > 1. * Include port file for vcpkg backed builds
* Fix keepassxreboot#7487 - Botan does not use threads when calculating Argon2 KDF leading to very poor performance for a parallelism value > 1. * Include port file for vcpkg backed builds
Overview
Unlocking a database in KeePassXC 2.7.0-beta1 is much slower than unlocking the same database in KeePassXC 2.6.6 or KeePass 2.50.
Steps to Reproduce
Expected Behavior
Unlocking the database takes about 2 seconds.
Actual Behavior
Unlocking the database takes about 9 seconds.
Context
With KeePassXC 2.6.6 or KeePass 2.50, unlocking takes about 2 seconds.
I created a database with KeePassXC 2.6.6, KeePassXC 2.7.0-beta1 and KeePass 2.50, but it happened with any database.
I suspected antivirus (Kaspersky) interference and paused protection before unlocking it, but it didn't improve.
It was also reproduced in Windows 11 Insider Preview Dev on VMware Player.
CPU: Core i7-7700K
RAM: DDR4-2400 16GB
KeePassXC - 2.7.0-beta1
Revision: 046e508
Operating System: Windows 10 21H2
The text was updated successfully, but these errors were encountered: