diff options
Diffstat (limited to 'src/engine/cache.cpp')
-rw-r--r-- | src/engine/cache.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/engine/cache.cpp b/src/engine/cache.cpp index 92a79eb9..2349a357 100644 --- a/src/engine/cache.cpp +++ b/src/engine/cache.cpp | |||
@@ -273,7 +273,7 @@ extern "C" HRESULT CacheCalculatePayloadWorkingPath( | |||
273 | ExitOnFailure(hr, "Failed to get working folder for payload."); | 273 | ExitOnFailure(hr, "Failed to get working folder for payload."); |
274 | 274 | ||
275 | hr = StrAllocConcat(psczWorkingPath, pPayload->sczKey, 0); | 275 | hr = StrAllocConcat(psczWorkingPath, pPayload->sczKey, 0); |
276 | ExitOnFailure(hr, "Failed to append SHA1 hash as payload unverified path."); | 276 | ExitOnFailure(hr, "Failed to append Id as payload unverified path."); |
277 | 277 | ||
278 | LExit: | 278 | LExit: |
279 | return hr; | 279 | return hr; |
@@ -291,7 +291,7 @@ extern "C" HRESULT CacheCalculateContainerWorkingPath( | |||
291 | ExitOnFailure(hr, "Failed to get working folder for container."); | 291 | ExitOnFailure(hr, "Failed to get working folder for container."); |
292 | 292 | ||
293 | hr = StrAllocConcat(psczWorkingPath, pContainer->sczHash, 0); | 293 | hr = StrAllocConcat(psczWorkingPath, pContainer->sczHash, 0); |
294 | ExitOnFailure(hr, "Failed to append SHA1 hash as container unverified path."); | 294 | ExitOnFailure(hr, "Failed to append hash as container unverified path."); |
295 | 295 | ||
296 | LExit: | 296 | LExit: |
297 | return hr; | 297 | return hr; |
@@ -1750,23 +1750,23 @@ static HRESULT VerifyHash( | |||
1750 | UNREFERENCED_PARAMETER(wzUnverifiedPayloadPath); | 1750 | UNREFERENCED_PARAMETER(wzUnverifiedPayloadPath); |
1751 | 1751 | ||
1752 | HRESULT hr = S_OK; | 1752 | HRESULT hr = S_OK; |
1753 | BYTE rgbActualHash[SHA1_HASH_LEN] = { }; | 1753 | BYTE rgbActualHash[SHA512_HASH_LEN] = { }; |
1754 | DWORD64 qwHashedBytes; | 1754 | DWORD64 qwHashedBytes; |
1755 | LPWSTR pszExpected = NULL; | 1755 | LPWSTR pszExpected = NULL; |
1756 | LPWSTR pszActual = NULL; | 1756 | LPWSTR pszActual = NULL; |
1757 | 1757 | ||
1758 | // TODO: create a cryp hash file that sends progress. | 1758 | // TODO: create a cryp hash file that sends progress. |
1759 | hr = CrypHashFileHandle(hFile, PROV_RSA_FULL, CALG_SHA1, rgbActualHash, sizeof(rgbActualHash), &qwHashedBytes); | 1759 | hr = CrypHashFileHandle(hFile, PROV_RSA_AES, CALG_SHA_512, rgbActualHash, sizeof(rgbActualHash), &qwHashedBytes); |
1760 | ExitOnFailure(hr, "Failed to calculate hash for path: %ls", wzUnverifiedPayloadPath); | 1760 | ExitOnFailure(hr, "Failed to calculate hash for path: %ls", wzUnverifiedPayloadPath); |
1761 | 1761 | ||
1762 | // Compare hashes. | 1762 | // Compare hashes. |
1763 | if (cbHash != sizeof(rgbActualHash) || 0 != memcmp(pbHash, rgbActualHash, SHA1_HASH_LEN)) | 1763 | if (cbHash != sizeof(rgbActualHash) || 0 != memcmp(pbHash, rgbActualHash, SHA512_HASH_LEN)) |
1764 | { | 1764 | { |
1765 | hr = CRYPT_E_HASH_VALUE; | 1765 | hr = CRYPT_E_HASH_VALUE; |
1766 | 1766 | ||
1767 | // Best effort to log the expected and actual hash value strings. | 1767 | // Best effort to log the expected and actual hash value strings. |
1768 | if (SUCCEEDED(StrAllocHexEncode(pbHash, cbHash, &pszExpected)) && | 1768 | if (SUCCEEDED(StrAllocHexEncode(pbHash, cbHash, &pszExpected)) && |
1769 | SUCCEEDED(StrAllocHexEncode(rgbActualHash, SHA1_HASH_LEN, &pszActual))) | 1769 | SUCCEEDED(StrAllocHexEncode(rgbActualHash, (SIZE_T)qwHashedBytes, &pszActual))) |
1770 | { | 1770 | { |
1771 | ExitOnFailure(hr, "Hash mismatch for path: %ls, expected: %ls, actual: %ls", wzUnverifiedPayloadPath, pszExpected, pszActual); | 1771 | ExitOnFailure(hr, "Hash mismatch for path: %ls, expected: %ls, actual: %ls", wzUnverifiedPayloadPath, pszExpected, pszActual); |
1772 | } | 1772 | } |