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:
parent
f6b780b583
commit
57a7db746a
@ -1309,7 +1309,6 @@ public:
|
|||||||
|
|
||||||
HashBlock key;
|
HashBlock key;
|
||||||
HashResult result;
|
HashResult result;
|
||||||
QBasicMutex finalizeMutex;
|
|
||||||
QCryptographicHashPrivate messageHash;
|
QCryptographicHashPrivate messageHash;
|
||||||
const QCryptographicHash::Algorithm method;
|
const QCryptographicHash::Algorithm method;
|
||||||
|
|
||||||
@ -1318,7 +1317,7 @@ public:
|
|||||||
void finalize();
|
void finalize();
|
||||||
|
|
||||||
// when not called from the static hash() function, this function needs to be
|
// 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;
|
void finalizeUnchecked() noexcept;
|
||||||
// END functions that need to be called with finalizeMutex held
|
// END functions that need to be called with finalizeMutex held
|
||||||
};
|
};
|
||||||
@ -1571,7 +1570,7 @@ QByteArray QMessageAuthenticationCode::result() const
|
|||||||
|
|
||||||
void QMessageAuthenticationCodePrivate::finalize()
|
void QMessageAuthenticationCodePrivate::finalize()
|
||||||
{
|
{
|
||||||
const auto lock = qt_scoped_lock(finalizeMutex);
|
const auto lock = qt_scoped_lock(messageHash.finalizeMutex);
|
||||||
if (!result.isEmpty())
|
if (!result.isEmpty())
|
||||||
return;
|
return;
|
||||||
finalizeUnchecked();
|
finalizeUnchecked();
|
||||||
|
Loading…
Reference in New Issue
Block a user