VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/COMReg/COMReg.vcxproj5
-rw-r--r--src/Common/Dlgcode.c69
-rw-r--r--src/Setup/ComSetup.cpp9
-rw-r--r--src/Setup/Portable.vcxproj8
-rw-r--r--src/Setup/Setup.vcxproj8
-rw-r--r--src/SetupDLL/ComSetup.cpp9
-rw-r--r--src/SetupDLL/SetupDLL.vcxproj6
7 files changed, 97 insertions, 17 deletions
diff --git a/src/COMReg/COMReg.vcxproj b/src/COMReg/COMReg.vcxproj
index 4c5987a3..8af84056 100644
--- a/src/COMReg/COMReg.vcxproj
+++ b/src/COMReg/COMReg.vcxproj
@@ -65,7 +65,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>..\Common\Debug\Zip.lib;..\Crypto\Debug\crypto.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>..\Common\Debug\Zip.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>copy Debug\VeraCryptCOMRegBase.exe "..\Debug\Setup Files\VeraCryptCOMRegBase.exe"</Command>
@@ -88,8 +88,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateMapFile>true</GenerateMapFile>
+ <DelayLoadDLLs>bcrypt.dll</DelayLoadDLLs>
</Link>
<PostBuildEvent>
<Command>copy Release\VeraCryptCOMRegBase.exe "..\Release\Setup Files\VeraCryptCOMRegBase.exe"</Command>
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 6a068529..6c98b4d7 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -868,6 +868,75 @@ BOOL TCCopyFile (wchar_t *sourceFileName, wchar_t *destinationFile)
return TCCopyFileBase (src, dst);
}
+#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)
{
diff --git a/src/Setup/ComSetup.cpp b/src/Setup/ComSetup.cpp
index 9ae0a23d..8c0e93af 100644
--- a/src/Setup/ComSetup.cpp
+++ b/src/Setup/ComSetup.cpp
@@ -23,8 +23,13 @@
#include "ComSetup.h"
#include "Dlgcode.h"
#include "Resource.h"
-#include "../Mount/MainCom_i.c"
-#include "../Format/FormatCom_i.c"
+
+#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
+ EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+
+// Define GUIDs of "VeraCrypt.exe and" "VeraCrypt Format.exe" type libraries
+MIDL_DEFINE_GUID(GUID, LIBID_TrueCryptMainCom, 0x9ACF6176, 0x5FC4, 0x4690, 0xA0, 0x25, 0xB3, 0x30, 0x6A, 0x50, 0xEB, 0x6A);
+MIDL_DEFINE_GUID(GUID, LIBID_TrueCryptFormatCom, 0x56327DDA, 0xF1A7, 0x4e13, 0xB1, 0x28, 0x52, 0x0D, 0x12, 0x9B, 0xDE, 0xF6);
extern "C" BOOL RegisterComServers (wchar_t *modulePath)
diff --git a/src/Setup/Portable.vcxproj b/src/Setup/Portable.vcxproj
index a493c304..d60f68cc 100644
--- a/src/Setup/Portable.vcxproj
+++ b/src/Setup/Portable.vcxproj
@@ -107,7 +107,7 @@
</ClCompile>
<Link>
<AdditionalOptions>/NODEFAULTLIB:LIBCMTD %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>libcmtd.lib;atls.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Crypto\Debug\crypto.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>libcmtd.lib;atls.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptPortable.exe</OutputFile>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@@ -147,7 +147,7 @@ copy PortableDebug\VeraCryptPortable.exe "..\Debug\Setup Files\VeraCrypt Portabl
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4089 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>atls.lib;mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>atls.lib;mpr.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptPortable.exe</OutputFile>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@@ -185,7 +185,7 @@ copy PortableDebug\VeraCryptPortable.exe "..\Debug\Setup Files\VeraCrypt Portabl
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4089 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptPortable.exe</OutputFile>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@@ -223,7 +223,7 @@ copy PortableDebug\VeraCryptPortable.exe "..\Debug\Setup Files\VeraCrypt Portabl
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4089 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptPortable.exe</OutputFile>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
diff --git a/src/Setup/Setup.vcxproj b/src/Setup/Setup.vcxproj
index a82b967d..2d10ba22 100644
--- a/src/Setup/Setup.vcxproj
+++ b/src/Setup/Setup.vcxproj
@@ -107,7 +107,7 @@
</ClCompile>
<Link>
<AdditionalOptions>/NODEFAULTLIB:LIBCMTD %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>libcmtd.lib;atls.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Crypto\Debug\crypto.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>libcmtd.lib;atls.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@@ -148,7 +148,7 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" &gt;NUL
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4089 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>atls.lib;mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>atls.lib;mpr.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@@ -186,7 +186,7 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" &gt;NUL
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4089 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@@ -224,7 +224,7 @@ copy Debug\VeraCryptSetup.exe "..\Debug\Setup Files\VeraCrypt Setup.exe" &gt;NUL
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4089 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>mpr.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
diff --git a/src/SetupDLL/ComSetup.cpp b/src/SetupDLL/ComSetup.cpp
index 39a0339e..e1ab2cfd 100644
--- a/src/SetupDLL/ComSetup.cpp
+++ b/src/SetupDLL/ComSetup.cpp
@@ -23,8 +23,13 @@
#include "ComSetup.h"
#include "Dlgcode.h"
#include "Resource.h"
-#include "../Mount/MainCom_i.c"
-#include "../Format/FormatCom_i.c"
+
+#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
+ EXTERN_C __declspec(selectany) const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+
+// Define GUIDs of "VeraCrypt.exe and" "VeraCrypt Format.exe" type libraries
+MIDL_DEFINE_GUID(GUID, LIBID_TrueCryptMainCom, 0x9ACF6176, 0x5FC4, 0x4690, 0xA0, 0x25, 0xB3, 0x30, 0x6A, 0x50, 0xEB, 0x6A);
+MIDL_DEFINE_GUID(GUID, LIBID_TrueCryptFormatCom, 0x56327DDA, 0xF1A7, 0x4e13, 0xB1, 0x28, 0x52, 0x0D, 0x12, 0x9B, 0xDE, 0xF6);
/*
* Same as RegisterComServers() in Setup project, but
diff --git a/src/SetupDLL/SetupDLL.vcxproj b/src/SetupDLL/SetupDLL.vcxproj
index 71a61ba5..af0d6fb8 100644
--- a/src/SetupDLL/SetupDLL.vcxproj
+++ b/src/SetupDLL/SetupDLL.vcxproj
@@ -89,7 +89,7 @@
</ClCompile>
<Link>
<AdditionalOptions>/NODEFAULTLIB:LIBCMTD %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>version.lib;msi.lib;libcmtd.lib;atls.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Crypto\Debug\crypto.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>version.lib;msi.lib;libcmtd.lib;atls.lib;mpr.lib;..\Common\Debug\Zip.lib;..\Common\Debug\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.dll</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@@ -130,7 +130,7 @@ copy Debug\VeraCryptSetup.dll "..\Debug\Setup Files\VeraCryptSetup.dll" &gt;NUL:
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4089 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>version.lib;atls.lib;msi.lib;mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>version.lib;atls.lib;msi.lib;mpr.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.dll</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
@@ -169,7 +169,7 @@ copy Debug\VeraCryptSetup.dll "..\Debug\Setup Files\VeraCryptSetup.dll" &gt;NUL:
</ClCompile>
<Link>
<AdditionalOptions>/IGNORE:4089 %(AdditionalOptions)</AdditionalOptions>
- <AdditionalDependencies>version.lib;msi.lib;mpr.lib;..\Common\Release\Zip.lib;..\Crypto\Release\crypto.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>version.lib;msi.lib;mpr.lib;..\Common\Release\Zip.lib;..\Common\Release\lzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptSetup.exe</OutputFile>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>