QCryptographicHash: fix missing EVP_DigestInit_ex() after EVP_MD_CTX_reset()

EVP_MD_CTX_reset() alone is not sufficient. A following
EVP_DigestUpdate() crashes, so re-init the context, too.

Amends 189444d8c4.

Pick-to: 6.5
Change-Id: I5dede0adddd7f6b0c62540f6d45917b3236e3d02
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
bb10
Marc Mutz 2023-03-10 13:50:30 +01:00
parent a6bf36d409
commit 4ac7ac5b59
1 changed files with 1 additions and 0 deletions

View File

@ -550,6 +550,7 @@ void QCryptographicHashPrivate::reset() noexcept
if (context && !initializationFailed) {
// everything already set up - just reset the context
EVP_MD_CTX_reset(context.get());
initializationFailed = !EVP_DigestInit_ex(context.get(), algorithm.get(), nullptr);
return;
}