Skip to content

Commit

Permalink
QCryptographicHash: no need to store return values just to ignore them
Browse files Browse the repository at this point in the history
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.

Pick-to: 6.5
Change-Id: I76c742016a2532c65ffdcd913aafc74a2d1a9623
Reviewed-by: Mårten Nordheim <[email protected]>
  • Loading branch information
grulja committed Jan 12, 2023
1 parent def2a3d commit a48bbba
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/corelib/tools/qcryptographichash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a48bbba

Please sign in to comment.