diff options
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r-- | src/Common/Dlgcode.c | 95 |
1 files changed, 83 insertions, 12 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 681761bf..6c98b4d7 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -7,5 +7,5 @@ and which is governed by the 'License Agreement for Encryption for the Masses' Modifications and additions to the original source code (contained in this file) - and all other portions of this file are Copyright (c) 2013-2017 IDRIX + and all other portions of this file are Copyright (c) 2013-2025 IDRIX and are governed by the Apache License 2.0 the full text of which is contained in the file License.txt included in VeraCrypt binary and source @@ -312,10 +312,10 @@ static unsigned char gpbSha512CodeSignCertFingerprint[64] = { static unsigned char gpbSha512MSCodeSignCertFingerprint[64] = { - 0xEB, 0x76, 0x2E, 0xD3, 0x5B, 0x4A, 0xB1, 0x0E, 0xF5, 0x3B, 0x99, 0x4E, - 0xC1, 0xF7, 0x48, 0x88, 0xF6, 0xA0, 0xE9, 0xAC, 0x32, 0x69, 0xCF, 0x20, - 0xE1, 0x60, 0xC4, 0x0C, 0xEF, 0x01, 0x1F, 0xCB, 0x41, 0x95, 0x72, 0xB9, - 0xED, 0x63, 0x0C, 0x6B, 0xB9, 0xE9, 0xA2, 0x72, 0xA6, 0x78, 0x96, 0x4C, - 0x69, 0x9F, 0x90, 0x3F, 0xB1, 0x3C, 0x64, 0xF2, 0xAB, 0xCF, 0x14, 0x1D, - 0xEC, 0x7C, 0xB0, 0xC7 + 0x17, 0x8C, 0x1B, 0x37, 0x70, 0xBF, 0x8B, 0xDF, 0x84, 0x55, 0xC5, 0x18, + 0x13, 0x64, 0xE9, 0x65, 0x6D, 0x67, 0xCA, 0x0C, 0xD6, 0x3B, 0x9E, 0x7B, + 0x9B, 0x6A, 0x63, 0xD6, 0x19, 0xAE, 0xD7, 0xBA, 0xBE, 0x5C, 0xCB, 0xD1, + 0x07, 0x89, 0x07, 0xFB, 0x12, 0xC0, 0x2C, 0x94, 0x86, 0xEB, 0x67, 0x0B, + 0x9C, 0x97, 0xEB, 0x20, 0x38, 0x13, 0x9C, 0x0F, 0x56, 0x93, 0x1B, 0x19, + 0x6F, 0x8F, 0x6A, 0x39 }; @@ -869,4 +869,73 @@ BOOL TCCopyFile (wchar_t *sourceFileName, wchar_t *destinationFile) } +#if !defined(_WIN64) && defined(NDEBUG) && !defined (VC_SKIP_OS_DRIVER_REQ_CHECK) +// in 32-bit build, Crypto project is not compiled so we need to provide this function here + +#pragma comment(lib, "bcrypt.lib") + +void sha512(unsigned char* result, const unsigned char* source, uint64_t sourceLen) +{ + BCRYPT_ALG_HANDLE hAlg = NULL; + BCRYPT_HASH_HANDLE hHash = NULL; + NTSTATUS status = 0; + + // Open an algorithm provider for SHA512. + status = BCryptOpenAlgorithmProvider( + &hAlg, + BCRYPT_SHA512_ALGORITHM, + NULL, + 0); + if (!BCRYPT_SUCCESS(status)) + { + goto cleanup; + } + + // Create a hash handle. + status = BCryptCreateHash( + hAlg, + &hHash, + NULL, + 0, + NULL, // Optional secret, not needed for SHA512 + 0, + 0); + if (!BCRYPT_SUCCESS(status)) + { + goto cleanup; + } + + // Hash the data. Note: BCryptHashData takes an ULONG for the length. + status = BCryptHashData( + hHash, + (PUCHAR)source, + (ULONG)sourceLen, + 0); + if (!BCRYPT_SUCCESS(status)) + { + goto cleanup; + } + + // Finalize the hash computation and write the result. + status = BCryptFinishHash( + hHash, + result, + SHA512_DIGESTSIZE, + 0); + if (!BCRYPT_SUCCESS(status)) + { + goto cleanup; + } + +cleanup: + if (hHash) + { + BCryptDestroyHash(hHash); + } + if (hAlg) + { + BCryptCloseAlgorithmProvider(hAlg, 0); + } +} +#endif BOOL VerifyModuleSignature (const wchar_t* path) @@ -1047,5 +1116,5 @@ BOOL IsOSVersionAtLeast (OSVersionEnum reqMinOS, int reqMinServicePack) } -BOOL IsWin10BuildAtLeast(DWORD minBuild) +BOOL IsWin10BuildAtLeast(int minBuild) { // Must first be recognized as Windows 10 or higher @@ -2179,5 +2248,5 @@ BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam L"Portions of this software:\r\n" - L"Copyright \xA9 2013-2024 IDRIX. All rights reserved.\r\n" + L"Copyright \xA9 2013-2025 IDRIX. All rights reserved.\r\n" L"Copyright \xA9 2003-2012 TrueCrypt Developers Association. All Rights Reserved.\r\n" L"Copyright \xA9 1998-2000 Paul Le Roux. All Rights Reserved.\r\n" @@ -2192,5 +2261,5 @@ BOOL CALLBACK AboutDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam L"This software as a whole:\r\n" - L"Copyright \xA9 2013-2024 IDRIX. All rights reserved.\r\n\r\n" + L"Copyright \xA9 2013-2025 IDRIX. All rights reserved.\r\n\r\n" L"An IDRIX Release"); @@ -8221,5 +8290,5 @@ int DriverUnmountVolume (HWND hwndDlg, int nDosDriveNo, BOOL forced) unmount.ignoreOpenFiles = forced; - bResult = DeviceIoControl (hDriver, TC_IOCTL_DISMOUNT_VOLUME, &unmount, + bResult = DeviceIoControl (hDriver, TC_IOCTL_UNMOUNT_VOLUME, &unmount, sizeof (unmount), &unmount, sizeof (unmount), &dwResult, NULL); @@ -14884,4 +14953,5 @@ void GetAppRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed) } +#ifndef _M_ARM64 // use RDSEED or RDRAND from CPU as source of entropy if enabled if ( IsCpuRngEnabled() && @@ -14892,4 +14962,5 @@ void GetAppRandomSeed (unsigned char* pbRandSeed, size_t cbRandSeed) WHIRLPOOL_add (digest, sizeof(digest), &tctx); } +#endif WHIRLPOOL_finalize (&tctx, digest); @@ -15983,3 +16054,3 @@ cleanup: return result; } -#endif
\ No newline at end of file +#endif |