QMessageAuthenticationCode: use QCryptographicHashPrivate in finalizeUnchecked()

... basically inlining static QCH::hash(), which, however, accepts
only one piece of data, while we have two.

Avoids the memory allocation of the QCH d-pointer. The toByteArray()
is now the only memory allocation left in finalizeUnchecked(), and
will be removed in a subsequent commit.

Pick-to: 6.5
Change-Id: I7549d6e1c116a4cdc29dac74b867dfa6647022a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2023-02-22 08:00:18 +01:00
parent 29050fa65b
commit d235953a82

View File

@ -1159,11 +1159,12 @@ void QMessageAuthenticationCodePrivate::finalizeUnchecked()
for (int i = 0; i < blockSize; ++i)
oKeyPad[i] = keyData[i] ^ 0x5c;
QCryptographicHash hash(method);
QCryptographicHashPrivate hash(method);
hash.addData(oKeyPad);
hash.addData(hashedMessage);
hash.finalizeUnchecked();
result = hash.result();
result = hash.resultView().toByteArray();
}
/*!