Commit Graph
77 Commits
Author SHA1 Message Date
Janek Bevendorff 113c8eb702 Add CLI tests and improve coding style and i18n
The CLI module was lacking unit test coverage and showed some severe
coding style violations, which this patch addresses.

In addition, all uses of qCritical() with untranslatble raw char*
sequences were removed in favor of proper locale strings. These are
written to STDERR through QTextStreams and support output
redirection for testing purposes. With this change, error messages don't
depend on the global Qt logging settings and targets anymore and go
directly to the terminal or into a file if needed.

This patch also fixes a bug discovered during unit test development,
where the extract command would just dump the raw XML contents without
decrypting embedded Salsa20-protected values first, making the XML
export mostly useless, since passwords are scrambled.

Lastly, all CLI commands received a dedicated -h/--help option.
2018-10-19 21:49:54 +02:00
Janek Bevendorff 18b22834c1 Update and fix test coverage report generation
Generation of unit test coverage reports used to be quite complicated
and required a lot of different settings, including a custom CMake
build type. This patch updates the coverage CMake module to only
require -DWITH_COVERAGE=ON to be set on a normal Debug build in order
to create a coverage target.

This patch also moves away from lcov in favor of gcovr, since lcov appears
to be broken in GCC 8. However, the routines for generating lcov reports
still exist, so provided lcov receives updates and there is sufficient
reason to switch back, it is easy to do so.
2018-10-19 21:45:53 +02:00
Janek Bevendorff e443cde452 Add a new database settings wizard
This patch implements a new database wizard to guide users through the process
of setting up a new database and choosing sane encryption settings.

It also reimplements the master key settings to be more
user-friendly. Users can now add, change, or remove individual composite
key components instead of having to set all components at once. This
avoids confusion about a password being reset if the user only wants to
add a key file.

With these changes comes a major refactor of how database composite keys and key
components are handled. Copying of keys is prohibited and each key
exists only once in memory and is referenced via shared pointers. GUI
components for changing individual keys are encapsulated into separate
classes to be more reusable. The password edit and generator widgets
have also been refactored to be more reusable.
2018-09-25 21:12:47 +02:00
pasdam b4d806ad41 Fixed issues with initial commit 2018-07-06 22:23:52 -04:00
pasdam ad4423d226 Replaced Uuid with QUuid 2018-07-06 22:23:49 -04:00
Louis-Bertrand Varin 8324d03f0a Formatting the code. 2018-03-31 16:01:30 -04:00
Toni Spets d2359df2b0 SymmetricCipher: Add support for AES-128-CBC 2018-02-11 15:31:06 +01:00
Janek Bevendorff 21a6c0fd89 Fix linker definition clashes between libargon2 and libsodium on Windows 2018-01-14 11:21:17 -05:00
Janek Bevendorff 337a21f6d6 Save AES-KDF round parameter as quint64 2018-01-13 14:25:01 -05:00
Janek Bevendorff b04c8c2b6e Explicitly support AES-KDF in KDBX4 and don't convert KDBX4 files with AES-KDF back to KDBX3 when saving 2018-01-13 14:25:00 -05:00
Janek Bevendorff d327c16904 Increase Argon2 warning threshold and set parallelism default value to number of available processors 2018-01-13 14:24:59 -05:00
Janek Bevendorff ccfd7a065c Fix coding style and GUI test 2018-01-13 14:24:57 -05:00
Janek Bevendorff 54fb0d9bd3 Show warning when using inappropriate transform round number
Increase default AES-KDF rounds to 100k
2018-01-13 14:24:57 -05:00
Janek Bevendorff f7d3c90218 Fix compilation error 2018-01-13 14:24:56 -05:00
Jonathan White bef7ba2cfe Implements KDBX4 format with Argon2 KDF
* Adds KDBX4 reader/writer interfaces
* Adds KDBX4 XML reader/write interfaces
* Implements test cases for KDBX4
* Fully compatible with KeePass2
* Corrects minor issues with Argon2 KDF
2018-01-13 14:24:55 -05:00
Jonathan White 542ee42313 Add Argon2Kdf and enable parameters in db settings
Note: This implementation is not yet connected to the
database itself and will corrupt existing kdbx3 db's.

* Implemented memory and parallelism parameters for Argon2Kdf
* Using libargon2; libsodium does not support Argon2d algorithm
* Moved basic rounds parameter into Kdf class
* Reimplemented benchmark algorithm; previous was utterly broken
2018-01-13 14:23:30 -05:00
Jonathan White 61c4fe8992 Formatting and consistency fixes 2018-01-13 14:23:29 -05:00
Janek Bevendorff 4592de8fb6 Make benchmark() method non-virtual 2018-01-13 14:23:28 -05:00
Janek Bevendorff 15648991fc Refactor Kdf class, remove fields concept 2018-01-13 14:23:28 -05:00
Janek Bevendorff 0d6ca0945b Reformat code, fix minor style issues, make kdf() getter const 2018-01-13 14:23:27 -05:00
angelsl e5ec585f98 Use GCRY_MD_FLAG_SECURE in CryptoHash 2018-01-13 14:23:26 -05:00
angelsl 6a0d05e1ef Add support for various algorithms for kdbx4
* Add SHA512 support to CryptoHash
* Add ChaCha20 support
* Add HMAC support
* Add new HmacBlockStream, used in KDBX 4
* Add support for ChaCha20 protected stream
2018-01-13 14:23:26 -05:00
angelsl 33974d710a Move constants in KeePass2.h to KeePass2.cpp and add a list of KDFs and ciphers 2018-01-13 14:23:25 -05:00
angelsl 663b8dcb08 Remove unused SymmetricCipherSalsa20 2018-01-13 14:23:24 -05:00
angelsl 2e19af5032 Pull out KDFs into their own class hierarchy
In preparation for multiple KDFs in KDBX 4
2018-01-13 14:23:20 -05:00
Jonathan White 28ad6ed552 Merge branch 'master' into develop 2017-12-11 21:10:25 -05:00
Michal Kaptur 0ff75e7a88 Fixed memory leaks in non-gui tests
Fixed 2 memory leaks in production code and a few in testcases. As a
result leak_check_at_exit ASAN option does not need to turned off for
non-gui tests.
Smart pointers should be used elsewhere for consistency, but the sooner
this fixes are delivered, the lesser memory leaks are introduced.
2017-11-27 23:36:09 +01:00
Toni Spets 248ae9d4ba SymmetricCipher: Add keySize(), don't rely on state for sizes
This additionally makes keySize() and blockSize() work before
setting the key and IV. Required for SSH agent decryption.
2017-11-19 14:38:59 +02:00
Toni Spets a81a5fa31b SymmetricCipher: Support CTR mode
Includes AES-256-CTR non-stream tests
2017-11-19 14:38:59 +02:00
Peter Nirschl a895729b9e 🐛 Fix result propagation in SymmetricCipherGcrypt::process
The boolean 'ok' has always been set to true, regardless of possible errors.
2017-10-21 20:00:28 +02:00
rockihack e53754d202 Fix build on mac os with qt 5.9.1 2017-10-03 15:01:54 -04:00
Timothy Redaelli a01607e869 Add support for Twofish in KeePass2 code 2017-01-28 17:53:11 +01:00
Josh Soref ca8ddd5f39 spelling: decrypt 2017-01-14 17:31:38 +01:00
Felix Geyer 7c7014d951 Drop obsolete GCRYPT_HAS_SALSA20 ifdef. 2016-10-02 21:44:33 -04:00
Felix Geyer dc7b6623a9 Merge branch '2.0' 2015-10-11 10:44:30 +02:00
Felix Geyer 316a7e6fb7 Expose version of used libraries in the About dialog. 2015-10-10 17:10:29 +02:00
Felix Geyer 7fa0eddc5f Make C++11 mandatory. 2015-09-12 13:55:50 +02:00
Felix Geyer 60daa2b41b Require libgcrypt >= 1.6.0.
Remove our own Salsa20 implementation as libgcrypt ships one
with that version.
2015-09-12 13:51:49 +02:00
Felix Geyer 7db9c78855 Ignore libgcrypt errors in CryptoHash::CryptoHash().
Postponed until after 2.0 when I'll use excpetions.

Should be safe as we check basic functioning in Crypto::testSha256().
2015-05-14 20:44:17 +02:00
Felix Geyer ade684d501 Crypto::selfTest(): test AES in ECB mode. 2015-05-10 00:02:08 +02:00
Felix Geyer e0d4b4b625 Adapt Salsa20 backend to the new interface. 2015-05-09 23:21:50 +02:00
Felix Geyer f6243675c9 Warn if result of processInPlace() is unchecked.
Fix callers accordingly.
2015-05-09 23:21:50 +02:00
Felix Geyer a762cef0a9 Catch and handle all errors from libgcrypt. 2015-05-09 23:21:44 +02:00
Felix Geyer a7f4e2d0cd Add Twofish tests to Crypto::selfTest(). 2015-05-09 18:15:01 +02:00
Felix Geyer e41bf008e9 Use Q_BYTE_ORDER for endianness detection.
A hardcoded list of architectures is always incomplete.
2015-05-03 20:00:23 +02:00
Felix Geyer 0d6117bf4c Do some basic self-checks when initializing the crypto backend. 2014-06-15 11:17:40 +02:00
Felix Geyer b9370c6e79 More careful null checking and member initalization. 2014-03-22 12:10:49 +01:00
Felix Geyer 2190260a68 Small optimization in SymmetricCipherGcrypt::processInPlace(). 2014-01-18 20:47:45 +01:00
Felix Geyer 0b6b149351 Use the libgcrypt SALSA20 cipher if available. 2014-01-12 13:42:56 +01:00
Felix Geyer 8c7e655274 Add compatibility with libgcrypt 1.6.
Closes #129
2014-01-12 12:39:39 +01:00