1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(db): use SQLCipher 3.x crypto even with SQLCipher 4.x

Fix #5451
This commit is contained in:
Anthony Bilinski 2018-12-08 01:38:35 -08:00
parent 2ff649e80d
commit e80dbe2d83
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C

View File

@ -181,6 +181,15 @@ bool RawDatabase::open(const QString& path, const QString& hexKey)
return false;
}
// #5451 SQLCipher 4.x has new crypto defaults that won't work with DBs saved with 3.x.
// manually use existing 3.x defaults for now, until SQLCipher upgrade is functional.
if (!execNow("PRAGMA cipher_page_size = 1024; PRAGMA kdf_iter = 64000;"
" PRAGMA cipher_hmac_algorithm = HMAC_SHA1; PRAGMA cipher_kdf_algorithm = PBKDF2_HMAC_SHA1;")) {
qWarning() << "Failed to prepare SQLCipher for version 3.x";
close();
return false;
}
if (!execNow("SELECT count(*) FROM sqlite_master")) {
qWarning() << "Database is unusable, check that the password is correct";
close();