diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-02-16 08:40:56 +0100 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-02-16 17:58:17 +0100 |
commit | b5e1fc7d8fcf9336db0dfb351403aa06dcb226a0 (patch) | |
tree | c5af5984d51a1db1d6ff59bb2360eb4cec4f0b29 /lib/jobs | |
parent | 0a43c023b94e12b3130572f2dd0d6ac8bb4ed110 (diff) | |
download | libquotient-b5e1fc7d8fcf9336db0dfb351403aa06dcb226a0.tar.gz libquotient-b5e1fc7d8fcf9336db0dfb351403aa06dcb226a0.zip |
More cleanup, especially in EncryptedFile
For EncryptedFile:
- JSON converter bodies moved away to .cpp;
- instead of C-style casts, reinterpret_cast is used to convert from
(const) char* to (const) unsigned char*;
- the size for the target plain text takes into account the case where
the cipher block size can be larger than 1 (after reading
https://www.openssl.org/docs/man1.1.1/man3/EVP_DecryptUpdate.html).
- file decryption is wrapped in #ifdef Quotient_E2EE_ENABLED, to avoid
OpenSSL linking errors when compiling without E2EE.
Diffstat (limited to 'lib/jobs')
-rw-r--r-- | lib/jobs/downloadfilejob.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/jobs/downloadfilejob.cpp b/lib/jobs/downloadfilejob.cpp index 634e5fb9..d00fc5f4 100644 --- a/lib/jobs/downloadfilejob.cpp +++ b/lib/jobs/downloadfilejob.cpp @@ -127,7 +127,7 @@ BaseJob::Status DownloadFileJob::prepareResult() QByteArray encrypted = d->tempFile->readAll(); EncryptedFile file = *d->encryptedFile; - auto decrypted = file.decryptFile(encrypted); + const auto decrypted = file.decryptFile(encrypted); d->targetFile->write(decrypted); d->tempFile->remove(); } else { @@ -149,10 +149,10 @@ BaseJob::Status DownloadFileJob::prepareResult() #ifdef Quotient_E2EE_ENABLED if (d->encryptedFile.has_value()) { d->tempFile->seek(0); - auto encrypted = d->tempFile->readAll(); + const auto encrypted = d->tempFile->readAll(); EncryptedFile file = *d->encryptedFile; - auto decrypted = file.decryptFile(encrypted); + const auto decrypted = file.decryptFile(encrypted); d->tempFile->write(decrypted); } else { #endif |