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.

Change-Id: I7549d6e1c116a4cdc29dac74b867dfa6647022a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit d235953a82bf8df5a6011dcf55331e287f0e6e65)
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2023-02-22 08:00:18 +01:00
parent 080f2654bb
commit 54aedff72f

View File

@ -1151,11 +1151,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();
}
/*!