QCryptographicHash: no need to store return values just to ignore them

There is no benefit from storing return value from some OpenSSL calls as
the only thing we do is to ignore them. There is also no difference when
we would be returning earlier.

Change-Id: I76c742016a2532c65ffdcd913aafc74a2d1a9623
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit a48bbbaa50860507d7b738d2095adf794eb552d5)
This commit is contained in:
Jan Grulich 2023-01-12 10:26:24 +01:00
parent 5ef1bdcd60
commit 26d9896ec4

View File

@ -620,8 +620,7 @@ void QCryptographicHashPrivate::addData(QByteArrayView bytes) noexcept
method == QCryptographicHash::Blake2s_224) {
blake2s_update(&blake2sContext, reinterpret_cast<const uint8_t *>(data), length);
} else if (!initializationFailed) {
const int ret = EVP_DigestUpdate(context.get(), (const unsigned char *)data, length);
Q_UNUSED(ret);
EVP_DigestUpdate(context.get(), (const unsigned char *)data, length);
}
#else
switch (method) {
@ -755,8 +754,7 @@ void QCryptographicHashPrivate::finalize() noexcept
EVP_MD_CTX_ptr copy = EVP_MD_CTX_ptr(EVP_MD_CTX_new());
EVP_MD_CTX_copy_ex(copy.get(), context.get());
tmpresult.resizeForOverwrite(EVP_MD_get_size(algorithm.get()));
const int ret = EVP_DigestFinal_ex(copy.get(), tmpresult.data(), nullptr);
Q_UNUSED(ret)
EVP_DigestFinal_ex(copy.get(), tmpresult.data(), nullptr);
}
#else
switch (method) {