QMessageAuthenticationCode: reuse messageHash mutex

QMessageAuthenticationCode operates the embedded QCryptographicHash in
an unshared way, in which QCryptographicHashPrivate::finalizeMutex is
never used. So kick QMessageAuthenticationCodePrivate::finalizeMutex
out and use QCryptographicHashPrivate::finalizeMutex instead.

The only effect it the reduction in QMessageAuthenticationCodePrivate
size by sizeof(QBasicMutex).

Pick-to: 6.5
Change-Id: I02208eb42f8247939619f74ad3e040cb0d34b5ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2023-03-19 15:30:02 +01:00 committed by Thiago Macieira
parent f6b780b583
commit 57a7db746a

View File

@ -1309,7 +1309,6 @@ public:
HashBlock key;
HashResult result;
QBasicMutex finalizeMutex;
QCryptographicHashPrivate messageHash;
const QCryptographicHash::Algorithm method;
@ -1318,7 +1317,7 @@ public:
void finalize();
// when not called from the static hash() function, this function needs to be
// called with finalizeMutex held:
// called with messageHash.finalizeMutex held:
void finalizeUnchecked() noexcept;
// END functions that need to be called with finalizeMutex held
};
@ -1571,7 +1570,7 @@ QByteArray QMessageAuthenticationCode::result() const
void QMessageAuthenticationCodePrivate::finalize()
{
const auto lock = qt_scoped_lock(finalizeMutex);
const auto lock = qt_scoped_lock(messageHash.finalizeMutex);
if (!result.isEmpty())
return;
finalizeUnchecked();