QMessageAuthenticationCode: make messageHash a QCryptographicHashPrivate
... avoiding one more memory allocation, and giving us access to QCryptographicHashPrivate::result, for use in subsequent commits. The only real adjustment to users of QMACPrivate::messageHash is that instead of messageHash.result(); they now need to use messageHash.finalizeUnchecked(); messageHash.resultView() // .toByteArray() I.e. explicitly finalize. Pick-to: 6.5 Change-Id: I80b1158b062554bbf8afa7241674a892de27f204 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
d53f8d6bbb
commit
494786ce73
@ -996,7 +996,7 @@ public:
|
||||
QByteArray key;
|
||||
QByteArray result;
|
||||
QBasicMutex finalizeMutex;
|
||||
QCryptographicHash messageHash;
|
||||
QCryptographicHashPrivate messageHash;
|
||||
const QCryptographicHash::Algorithm method;
|
||||
|
||||
void initMessageHash();
|
||||
@ -1022,7 +1022,8 @@ void QMessageAuthenticationCodePrivate::initMessageHash()
|
||||
|
||||
if (key.size() > blockSize) {
|
||||
messageHash.addData(key);
|
||||
key = messageHash.result();
|
||||
messageHash.finalizeUnchecked();
|
||||
key = messageHash.resultView().toByteArray();
|
||||
messageHash.reset();
|
||||
}
|
||||
|
||||
@ -1186,6 +1187,7 @@ void QMessageAuthenticationCodePrivate::finalizeUnchecked()
|
||||
{
|
||||
const int blockSize = qt_hash_block_size(method);
|
||||
|
||||
messageHash.finalizeUnchecked();
|
||||
QByteArrayView hashedMessage = messageHash.resultView();
|
||||
|
||||
QVarLengthArray<char> oKeyPad(blockSize);
|
||||
|
Loading…
x
Reference in New Issue
Block a user