TrueCrypt patch for OS X that adds 64-bit support. See http://www.nerdenmeister.org/2013/08/16/build-truecrypt-on-os-x-64-bit-with-hardware-acceleration
# (c) 2013 www.nerdenmeister.org | |
diff -ur ./Build/Resources/MacOSX/Info.plist.xml ./b/Build/Resources/MacOSX/Info.plist.xml | |
--- ./Build/Resources/MacOSX/Info.plist.xml 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Build/Resources/MacOSX/Info.plist.xml 2014-04-20 22:20:31.000000000 +0100 | |
@@ -38,6 +38,9 @@ | |
<key>LSRequiresCarbon</key> | |
<true/> | |
+ <key>NSPrincipalClass</key> | |
+ <string>NSApplication</string> | |
+ | |
<key>CSResourcesFileMapped</key> | |
<true/> | |
</dict> | |
diff -ur ./Core/Unix/MacOSX/CoreMacOSX.cpp ./b/Core/Unix/MacOSX/CoreMacOSX.cpp | |
--- ./Core/Unix/MacOSX/CoreMacOSX.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Core/Unix/MacOSX/CoreMacOSX.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -108,6 +108,7 @@ | |
void CoreMacOSX::MountAuxVolumeImage (const DirectoryPath &auxMountPoint, const MountOptions &options) const | |
{ | |
+#if 0 | |
// Check FUSE version | |
char fuseVersionString[MAXHOSTNAMELEN + 1] = { 0 }; | |
size_t fuseVersionStringLength = MAXHOSTNAMELEN; | |
@@ -124,7 +125,7 @@ | |
if (fuseVersionMajor < 1 || (fuseVersionMajor == 1 && fuseVersionMinor < 3)) | |
throw HigherFuseVersionRequired (SRC_POS); | |
- | |
+#endif | |
// Mount volume image | |
string volImage = string (auxMountPoint) + FuseService::GetVolumeImagePath(); | |
diff -ur ./Main/Application.cpp ./b/Main/Application.cpp | |
--- ./Main/Application.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/Application.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -36,7 +36,6 @@ | |
FilePath Application::GetConfigFilePath (const wxString &configFileName, bool createConfigDir) | |
{ | |
- wxStandardPaths stdPaths; | |
DirectoryPath configDir; | |
if (!Core->IsInPortableMode()) | |
@@ -46,6 +45,7 @@ | |
configPath.Normalize(); | |
configDir = wstring (configPath.GetFullPath()); | |
#else | |
+ wxStandardPaths stdPaths; | |
configDir = wstring (stdPaths.GetUserDataDir()); | |
#endif | |
} | |
@@ -61,12 +61,12 @@ | |
DirectoryPath Application::GetExecutableDirectory () | |
{ | |
- return wstring (wxFileName (wxStandardPaths().GetExecutablePath()).GetPath()); | |
+ return wstring (wxFileName (wxStandardPaths::Get().GetExecutablePath()).GetPath()); | |
} | |
FilePath Application::GetExecutablePath () | |
{ | |
- return wstring (wxStandardPaths().GetExecutablePath()); | |
+ return wstring (wxStandardPaths::Get().GetExecutablePath()); | |
} | |
void Application::Initialize (UserInterfaceType::Enum type) | |
diff -ur ./Main/CommandLineInterface.cpp ./b/Main/CommandLineInterface.cpp | |
--- ./Main/CommandLineInterface.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/CommandLineInterface.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -380,7 +380,7 @@ | |
ArgQuick = parser.Found (L"quick"); | |
if (parser.Found (L"random-source", &str)) | |
- ArgRandomSourcePath = FilesystemPath (str); | |
+ ArgRandomSourcePath = FilesystemPath (str.wc_str()); | |
if (parser.Found (L"restore-headers")) | |
{ | |
@@ -471,7 +471,7 @@ | |
if (param1IsFile) | |
{ | |
- ArgFilePath.reset (new FilePath (parser.GetParam (0))); | |
+ ArgFilePath.reset (new FilePath (parser.GetParam (0).wc_str())); | |
} | |
} | |
@@ -524,7 +524,7 @@ | |
arr.Add (L""); | |
continue; | |
} | |
- arr.Last() += token.empty() ? L',' : token; | |
+ arr.Last() += token.empty() ? wxString(L',') : token; | |
} | |
else | |
arr.Add (token); | |
@@ -562,12 +562,12 @@ | |
{ | |
filteredVolumes.push_back (volume); | |
} | |
- else if (wxString (volume->Path) == pathFilter.GetFullPath()) | |
+ else if (wxString (wstring(volume->Path)) == pathFilter.GetFullPath()) | |
{ | |
filteredVolumes.push_back (volume); | |
} | |
- else if (wxString (volume->MountPoint) == pathFilter.GetFullPath() | |
- || (wxString (volume->MountPoint) + wxFileName::GetPathSeparator()) == pathFilter.GetFullPath()) | |
+ else if (wxString (wstring(volume->MountPoint)) == pathFilter.GetFullPath() | |
+ || (wxString (wstring(volume->MountPoint)) + wxFileName::GetPathSeparator()) == pathFilter.GetFullPath()) | |
{ | |
filteredVolumes.push_back (volume); | |
} | |
diff -ur ./Main/FatalErrorHandler.cpp ./b/Main/FatalErrorHandler.cpp | |
--- ./Main/FatalErrorHandler.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/FatalErrorHandler.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -23,7 +23,7 @@ | |
# ifdef __ppc__ | |
# include <ppc/ucontext.h> | |
# else | |
-# include <i386/ucontext.h> | |
+# include <ucontext.h> | |
# endif | |
#elif defined (TC_BSD) | |
# include <ucontext.h> | |
@@ -57,7 +57,7 @@ | |
# ifdef __ppc__ | |
faultingInstructionAddress = context->uc_mcontext->ss.srr0; | |
# elif defined (__x86_64__) | |
- faultingInstructionAddress = context->uc_mcontext->ss.rip; | |
+ faultingInstructionAddress = context->uc_mcontext->__ss.__rip; | |
# else | |
faultingInstructionAddress = context->uc_mcontext->ss.eip; | |
# endif | |
diff -ur ./Main/Forms/Forms.cpp ./b/Main/Forms/Forms.cpp | |
--- ./Main/Forms/Forms.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/Forms/Forms.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -263,8 +263,6 @@ | |
VolumeStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( MainPanel, wxID_ANY, _("Volume") ), wxVERTICAL ); | |
VolumeGridBagSizer = new wxGridBagSizer( 0, 0 ); | |
- VolumeGridBagSizer->AddGrowableCol( 1 ); | |
- VolumeGridBagSizer->AddGrowableRow( 0 ); | |
VolumeGridBagSizer->SetFlexibleDirection( wxBOTH ); | |
VolumeGridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); | |
@@ -307,6 +305,9 @@ | |
VolumeGridBagSizer->Add( bSizer21, wxGBPosition( 1, 3 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); | |
+ VolumeGridBagSizer->AddGrowableCol( 1 ); | |
+ VolumeGridBagSizer->AddGrowableRow( 0 ); | |
+ | |
VolumeStaticBoxSizer->Add( VolumeGridBagSizer, 1, wxEXPAND|wxALL, 4 ); | |
LowStaticBoxSizer->Add( VolumeStaticBoxSizer, 1, wxEXPAND, 5 ); | |
@@ -1442,7 +1443,6 @@ | |
bSizer54->Add( bSizer55, 1, wxEXPAND, 5 ); | |
FilesystemOptionsSizer = new wxGridBagSizer( 0, 0 ); | |
- FilesystemOptionsSizer->AddGrowableCol( 1 ); | |
FilesystemOptionsSizer->SetFlexibleDirection( wxBOTH ); | |
FilesystemOptionsSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); | |
FilesystemOptionsSizer->SetEmptyCellSize( wxSize( 0,0 ) ); | |
@@ -1468,6 +1468,8 @@ | |
FilesystemOptionsTextCtrl = new wxTextCtrl( m_panel8, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); | |
FilesystemOptionsSizer->Add( FilesystemOptionsTextCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); | |
+ FilesystemOptionsSizer->AddGrowableCol( 1 ); | |
+ | |
bSizer54->Add( FilesystemOptionsSizer, 0, wxEXPAND, 5 ); | |
sbSizer28->Add( bSizer54, 0, wxEXPAND|wxBOTTOM, 5 ); | |
@@ -2892,7 +2894,6 @@ | |
bSizer7 = new wxBoxSizer( wxVERTICAL ); | |
GridBagSizer = new wxGridBagSizer( 0, 0 ); | |
- GridBagSizer->AddGrowableCol( 1 ); | |
GridBagSizer->SetFlexibleDirection( wxBOTH ); | |
GridBagSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); | |
GridBagSizer->SetEmptyCellSize( wxSize( 0,0 ) ); | |
@@ -2950,6 +2951,8 @@ | |
GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 8, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 ); | |
+ GridBagSizer->AddGrowableCol( 1 ); | |
+ | |
bSizer7->Add( GridBagSizer, 1, wxALL|wxEXPAND, 5 ); | |
this->SetSizer( bSizer7 ); | |
diff -ur ./Main/Forms/MainFrame.cpp ./b/Main/Forms/MainFrame.cpp | |
--- ./Main/Forms/MainFrame.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/Forms/MainFrame.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -828,7 +828,7 @@ | |
// File-hosted volumes | |
if (!volume->Path.IsDevice() && !mountPoint.IsEmpty()) | |
{ | |
- if (wxString (volume->Path).Upper().StartsWith (wstring (mountPoint).c_str())) | |
+ if (wxString (wstring(volume->Path)).Upper().StartsWith (wxString (wstring(mountPoint)))) | |
{ | |
removedVolumes.push_back (volume); | |
continue; | |
@@ -1020,7 +1020,7 @@ | |
if (!ListItemRightClickEventPending) | |
{ | |
ListItemRightClickEventPending = true; | |
- SlotListCtrl->AddPendingEvent (event); | |
+ SlotListCtrl->GetEventHandler()->AddPendingEvent (event); | |
return; | |
} | |
diff -ur ./Main/Forms/SelectDirectoryWizardPage.cpp ./b/Main/Forms/SelectDirectoryWizardPage.cpp | |
--- ./Main/Forms/SelectDirectoryWizardPage.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/Forms/SelectDirectoryWizardPage.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -16,7 +16,7 @@ | |
{ | |
if (!DirectoryTextCtrl->IsEmpty()) | |
{ | |
- return FilesystemPath (DirectoryTextCtrl->GetValue()).IsDirectory(); | |
+ return FilesystemPath (wstring(DirectoryTextCtrl->GetValue())).IsDirectory(); | |
} | |
return false; | |
diff -ur ./Main/Forms/SelectDirectoryWizardPage.h ./b/Main/Forms/SelectDirectoryWizardPage.h | |
--- ./Main/Forms/SelectDirectoryWizardPage.h 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/Forms/SelectDirectoryWizardPage.h 2014-04-20 22:16:15.000000000 +0100 | |
@@ -18,7 +18,7 @@ | |
public: | |
SelectDirectoryWizardPage (wxPanel* parent) : SelectDirectoryWizardPageBase (parent) { } | |
- DirectoryPath GetDirectory () const { return DirectoryPath (DirectoryTextCtrl->GetValue()); } | |
+ DirectoryPath GetDirectory () const { return DirectoryPath (wstring(DirectoryTextCtrl->GetValue())); } | |
bool IsValid (); | |
void SetDirectory (const DirectoryPath &path) { DirectoryTextCtrl->SetValue (wstring (path)); } | |
void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } | |
diff -ur ./Main/GraphicUserInterface.cpp ./b/Main/GraphicUserInterface.cpp | |
--- ./Main/GraphicUserInterface.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/GraphicUserInterface.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -1384,7 +1384,7 @@ | |
#else | |
L"", | |
#endif | |
- L"", wxDD_DEFAULT_STYLE | (existingOnly ? wxDD_DIR_MUST_EXIST : 0), wxDefaultPosition, parent)); | |
+ L"", wxDD_DEFAULT_STYLE | (existingOnly ? wxDD_DIR_MUST_EXIST : 0), wxDefaultPosition, parent).wc_str()); | |
} | |
FilePathList GraphicUserInterface::SelectFiles (wxWindow *parent, const wxString &caption, bool saveMode, bool allowMultiple, const list < pair <wstring, wstring> > &fileExtensions, const DirectoryPath &directory) const | |
@@ -1428,14 +1428,14 @@ | |
if (dialog.ShowModal() == wxID_OK) | |
{ | |
if (!allowMultiple) | |
- files.push_back (make_shared <FilePath> (dialog.GetPath())); | |
+ files.push_back (make_shared <FilePath> (dialog.GetPath().wc_str())); | |
else | |
{ | |
wxArrayString paths; | |
dialog.GetPaths (paths); | |
foreach (const wxString &path, paths) | |
- files.push_back (make_shared <FilePath> (path)); | |
+ files.push_back (make_shared <FilePath> (path.wc_str())); | |
} | |
} | |
diff -ur ./Main/Main.make ./b/Main/Main.make | |
--- ./Main/Main.make 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/Main.make 2014-04-20 22:16:15.000000000 +0100 | |
@@ -68,6 +68,7 @@ | |
RESOURCES += ../Mount/Drive_icon_96dpi.bmp.h | |
RESOURCES += ../Mount/Drive_icon_mask_96dpi.bmp.h | |
RESOURCES += ../Mount/Logo_96dpi.bmp.h | |
+CXXFLAGS += -D_XOPEN_SOURCE | |
endif | |
CXXFLAGS += -I$(BASE_DIR)/Main | |
@@ -83,7 +84,7 @@ | |
ifeq "$(TC_BUILD_CONFIG)" "Release" | |
-CXXFLAGS += $(shell $(WX_CONFIG) $(WX_CONFIG_ARGS) --cxxflags) | |
+CXXFLAGS += $(shell $(WX_CONFIG) $(WX_CONFIG_ARGS) --cxxflags $(WX_CONFIG_LIBS)) | |
WX_LIBS = $(shell $(WX_CONFIG) $(WX_CONFIG_ARGS) --libs $(WX_CONFIG_LIBS)) | |
else | |
diff -ur ./Main/TextUserInterface.cpp ./b/Main/TextUserInterface.cpp | |
--- ./Main/TextUserInterface.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/TextUserInterface.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -116,7 +116,7 @@ | |
for (size_t i = 0; i < length && i < VolumePassword::MaxSize; ++i) | |
{ | |
passwordBuf[i] = (wchar_t) passwordStr[i]; | |
- const_cast <wchar_t *> (passwordStr.c_str())[i] = L'X'; | |
+ const_cast <wchar_t *> (passwordStr.wc_str())[i] = L'X'; | |
} | |
if (verify && verPhase) | |
@@ -763,8 +763,8 @@ | |
ShowString (wxString::Format (L"\rDone: %7.3f%% Speed: %9s Left: %s ", | |
100.0 - double (options->Size - progress.SizeDone) / (double (options->Size) / 100.0), | |
- speed > 0 ? SpeedToString (speed).c_str() : L" ", | |
- speed > 0 ? TimeSpanToString ((options->Size - progress.SizeDone) / speed).c_str() : L"")); | |
+ speed > 0 ? SpeedToString (speed).wc_str() : L" ", | |
+ speed > 0 ? TimeSpanToString ((options->Size - progress.SizeDone) / speed).wc_str() : L"")); | |
} | |
Thread::Sleep (100); | |
diff -ur ./Main/UserPreferences.cpp ./b/Main/UserPreferences.cpp | |
--- ./Main/UserPreferences.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Main/UserPreferences.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -219,7 +219,7 @@ | |
foreach_ref (const Keyfile &keyfile, DefaultKeyfiles) | |
{ | |
- keyfilesXml.InnerNodes.push_back (XmlNode (L"keyfile", wxString (FilesystemPath (keyfile)))); | |
+ keyfilesXml.InnerNodes.push_back (XmlNode (L"keyfile", wxString (wstring(FilesystemPath (keyfile))))); | |
} | |
XmlWriter keyfileWriter (keyfilesCfgPath); | |
diff -ur ./Makefile ./b/Makefile | |
--- ./Makefile 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Makefile 2014-04-20 22:16:15.000000000 +0100 | |
@@ -121,11 +121,16 @@ | |
export CPU_ARCH ?= unknown | |
ARCH = $(shell uname -p) | |
-ifeq "$(ARCH)" "unknown" | |
+ifeq "$(shell uname -s)" "Darwin" | |
+ ARCH = $(shell uname -m) | |
+else ifeq "$(ARCH)" "unknown" | |
ARCH = $(shell uname -m) | |
endif | |
-ifneq (,$(filter i386 i486 i586 i686 x86,$(ARCH))) | |
+ifeq "$(shell uname -s)" "Darwin" | |
+ CPU_ARCH = x64 | |
+ ASM_OBJ_FORMAT = macho64 | |
+else ifneq (,$(filter i386 i486 i586 i686 x86,$(ARCH))) | |
CPU_ARCH = x86 | |
ASM_OBJ_FORMAT = elf32 | |
else ifneq (,$(filter x86_64 x86-64 amd64 x64,$(ARCH))) | |
@@ -173,19 +178,18 @@ | |
PLATFORM := MacOSX | |
APPNAME := TrueCrypt | |
- TC_OSX_SDK ?= /Developer/SDKs/MacOSX10.4u.sdk | |
- CC := gcc-4.0 | |
- CXX := g++-4.0 | |
- | |
- C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -mmacosx-version-min=10.4 -isysroot $(TC_OSX_SDK) | |
- LFLAGS += -mmacosx-version-min=10.4 -Wl,-syslibroot $(TC_OSX_SDK) | |
- WX_CONFIGURE_FLAGS += --with-macosx-version-min=10.4 --with-macosx-sdk=$(TC_OSX_SDK) | |
+ MPPREFIX := /opt/local | |
- ifeq "$(CPU_ARCH)" "x64" | |
- CPU_ARCH = x86 | |
- endif | |
+ PKG_CONFIG_PATH := $(MPPREFIX)/lib/pkgconfig | |
+ CC := gcc | |
+ CXX := g++ | |
+ AS := $(MPPREFIX)/bin/nasm | |
+ | |
+ C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -I./../Pkcs11 -I$(MPPREFIX)/include | |
+ LFLAGS += -L$(MPPREFIX)/lib | |
+ WX_CONFIGURE_FLAGS += | |
- ASM_OBJ_FORMAT = macho | |
+ ASM_OBJ_FORMAT = macho64 | |
ASFLAGS += --prefix _ | |
ifeq "$(TC_BUILD_CONFIG)" "Release" | |
@@ -195,8 +199,8 @@ | |
S := $(C_CXX_FLAGS) | |
C_CXX_FLAGS = $(subst -MMD,,$(S)) | |
- C_CXX_FLAGS += -gfull -arch i386 -arch ppc | |
- LFLAGS += -Wl,-dead_strip -arch i386 -arch ppc | |
+ C_CXX_FLAGS += -gfull | |
+ LFLAGS += -Wl,-dead_strip | |
WX_CONFIGURE_FLAGS += --enable-universal_binary | |
WXCONFIG_CFLAGS += -gfull | |
diff -ur ./Platform/Unix/Process.cpp ./b/Platform/Unix/Process.cpp | |
--- ./Platform/Unix/Process.cpp 2012-02-07 10:36:48.000000000 +0000 | |
+++ ./b/Platform/Unix/Process.cpp 2014-04-20 22:16:15.000000000 +0100 | |
@@ -52,9 +52,9 @@ | |
if (!execFunctor) | |
args[argIndex++] = const_cast <char*> (processName.c_str()); | |
- foreach (const string &arg, arguments) | |
+ for (list<string>::const_iterator arg=arguments.begin(); arg != arguments.end(); ++arg) | |
{ | |
- args[argIndex++] = const_cast <char*> (arg.c_str()); | |
+ args[argIndex++] = const_cast <char*> ((*arg).c_str()); | |
} | |
args[argIndex] = nullptr; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment