QMessageAuthenticationCode: replace result QByteArray with QSmallByteArray
This minimizes the impedance mismatch between QCryptographicViewPrivate and QMessageAuthenticationCodePrivate and is the penultimate step to finally marking QMAC's finalizeUnchecked() noexcept, too (QCH's has been for a few Qt versions now). It also enables adding a QMAC::resultView() a la QCH::resultView(), but that's another commit, as 6.5 is closed for new API. Pick-to: 6.5 Change-Id: I3fe228585c560d8d32e99e12bba2be21fddaf642 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
289a54a809
commit
57a8c3173d
@ -1012,7 +1012,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
QByteArray key;
|
QByteArray key;
|
||||||
QByteArray result;
|
HashResult result;
|
||||||
QBasicMutex finalizeMutex;
|
QBasicMutex finalizeMutex;
|
||||||
QCryptographicHashPrivate messageHash;
|
QCryptographicHashPrivate messageHash;
|
||||||
const QCryptographicHash::Algorithm method;
|
const QCryptographicHash::Algorithm method;
|
||||||
@ -1190,7 +1190,7 @@ bool QMessageAuthenticationCode::addData(QIODevice *device)
|
|||||||
QByteArray QMessageAuthenticationCode::result() const
|
QByteArray QMessageAuthenticationCode::result() const
|
||||||
{
|
{
|
||||||
d->finalize();
|
d->finalize();
|
||||||
return d->result;
|
return d->result.toByteArrayView().toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QMessageAuthenticationCodePrivate::finalize()
|
void QMessageAuthenticationCodePrivate::finalize()
|
||||||
@ -1219,7 +1219,7 @@ void QMessageAuthenticationCodePrivate::finalizeUnchecked()
|
|||||||
messageHash.addData(hashedMessage.toByteArrayView());
|
messageHash.addData(hashedMessage.toByteArrayView());
|
||||||
messageHash.finalizeUnchecked();
|
messageHash.finalizeUnchecked();
|
||||||
|
|
||||||
result = hash.resultView().toByteArray();
|
result = messageHash.result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1234,7 +1234,7 @@ QByteArray QMessageAuthenticationCode::hash(const QByteArray &message, const QBy
|
|||||||
mac.initMessageHash();
|
mac.initMessageHash();
|
||||||
mac.messageHash.addData(message);
|
mac.messageHash.addData(message);
|
||||||
mac.finalizeUnchecked();
|
mac.finalizeUnchecked();
|
||||||
return mac.result;
|
return mac.result.toByteArrayView().toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
Loading…
Reference in New Issue
Block a user