VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Translations/Language.ro.xml10
-rw-r--r--Translations/Language.sv.xml6
-rw-r--r--src/Build/CMakeLists.txt15
-rw-r--r--src/Build/Include/Makefile.inc16
-rwxr-xr-xsrc/Build/build_veracrypt_macosx.sh103
-rw-r--r--src/Common/BootEncryption.cpp28
-rw-r--r--src/Common/Common.rc4
-rw-r--r--src/Common/Dlgcode.c50
-rw-r--r--src/Crypto/Crypto.vcxproj1
-rw-r--r--src/Crypto/Crypto.vcxproj.filters3
-rw-r--r--src/Crypto/Crypto_vs2019.vcxproj1
-rw-r--r--src/Crypto/Sha2.c15
-rw-r--r--src/Crypto/Sha2Intel.c278
-rw-r--r--src/Crypto/Sources1
-rw-r--r--src/Crypto/config.h9
-rw-r--r--src/Crypto/cpu.c47
-rw-r--r--src/Crypto/cpu.h18
-rw-r--r--src/Driver/veracrypt_vs2019.vcxproj6
-rw-r--r--src/Driver/veracrypt_vs2019.vcxproj.filters3
-rw-r--r--src/Format/Format_vs2019.vcxproj2
-rw-r--r--src/Main/CommandLineInterface.cpp9
-rw-r--r--src/Main/CommandLineInterface.h1
-rw-r--r--src/Main/Forms/MainFrame.cpp7
-rw-r--r--src/Main/Forms/MainFrame.h1
-rw-r--r--src/Main/GraphicUserInterface.cpp8
-rw-r--r--src/Main/GraphicUserInterface.h1
-rw-r--r--src/Main/UserInterface.cpp98
-rw-r--r--src/Makefile5
-rw-r--r--src/VeraCrypt_vs2019.sln1
-rw-r--r--src/Volume/Volume.make8
31 files changed, 641 insertions, 115 deletions
diff --git a/.gitignore b/.gitignore
index 7a526a64..412edcca 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,7 @@
src/Main/veracrypt
*.osse41
*.ossse3
+*.oshani
# VC macOS build artifacts
src/Main/VeraCrypt
diff --git a/Translations/Language.ro.xml b/Translations/Language.ro.xml
index ce18a950..1d78fcfc 100644
--- a/Translations/Language.ro.xml
+++ b/Translations/Language.ro.xml
@@ -1636,11 +1636,11 @@
<entry lang="ro" key="IDC_DISABLE_MEMORY_PROTECTION">Dezactivare protecție memorie pentru compatibilitate unelte de accesibilitate</entry>
<entry lang="ro" key="DISABLE_MEMORY_PROTECTION_WARNING">AVERTIZARE: dezactivarea protecției memoriei reduce significant securitatea. Activați această opțiune NUMAI dacă aveți de nevoie de uneltele de accesibilitate, cum ar fi naratoarele, pentru a interacționa cu interfața VeraCrypt.</entry>
<entry lang="ro" key="LINUX_LANGUAGE">Limba</entry>
- <entry lang="en" key="LINUX_SELECT_SYS_DEFAULT_LANG">Select system's default language</entry>
- <entry lang="en" key="LINUX_RESTART_FOR_LANGUAGE_CHANGE">For the language change to come into effect, VeraCrypt needs to be restarted.</entry>
- <entry lang="en" key="ERR_XTS_MASTERKEY_VULNERABLE">WARNING: The volume's master key is vulnerable to an attack that compromises data security.\n\nPlease create a new volume and transfer the data to it.</entry>
- <entry lang="en" key="ERR_SYSENC_XTS_MASTERKEY_VULNERABLE">WARNING: The encrypted system's master key is vulnerable to an attack that compromises data security.\nPlease decrypt the system partition/drive and then re-encrypt it.</entry>
- <entry lang="en" key="ERR_XTS_MASTERKEY_VULNERABLE_SHORT">WARNING: The volume's master key has a security vulnerability.</entry>
+ <entry lang="ro" key="LINUX_SELECT_SYS_DEFAULT_LANG">Selectați limba implicită a sistemului</entry>
+ <entry lang="ro" key="LINUX_RESTART_FOR_LANGUAGE_CHANGE">Pentru a se aplica modificarea limbii, VeraCrypt trebuie repornit.</entry>
+ <entry lang="ro" key="ERR_XTS_MASTERKEY_VULNERABLE">AVERTIZARE: Cheia principală a volumului este vulnerabilă la un atac care compromite securitatea datelor.\n\nTrebuie să creați un volum nou și să transferați datele pe acesta.</entry>
+ <entry lang="ro" key="ERR_SYSENC_XTS_MASTERKEY_VULNERABLE">AVERTIZARE: Cheia principală a sistemului criptat este vulnerabilă la un atac care compromite securitatea datelor.\nDecriptați partiția/unitatea de sistem și apoi recriptați-o.</entry>
+ <entry lang="ro" key="ERR_XTS_MASTERKEY_VULNERABLE_SHORT">AVERTIZARE: Cheia principală a volumului are o vulnerabilitate de securitate.</entry>
</localization>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="VeraCrypt">
diff --git a/Translations/Language.sv.xml b/Translations/Language.sv.xml
index 2f079c6e..a31b5bd5 100644
--- a/Translations/Language.sv.xml
+++ b/Translations/Language.sv.xml
@@ -1511,8 +1511,8 @@
<entry lang="sv" key="LINUX_MAX_HIDDEN_SIZE">Högsta möjliga dolda volymstorlek för den här volymen är {0}.</entry>
<entry lang="sv" key="LINUX_OPEN_OUTER_VOL">Öppna yttre volym</entry>
<entry lang="sv" key="LINUX_OUTER_VOL_IS_MOUNTED">Yttre volym har skapats och monterats som "{0}". Till den här volymen ska du nu kopiera några känsliga filer som du faktiskt INTE vill dölja. Filerna kommer att finnas där för alla som tvingar dig att avslöja ditt lösenord. Du kommer bara att avslöja lösenordet för denna yttre volym, inte för den dolda. Filerna som du verkligen bryr dig om kommer att lagras i den dolda volymen, som kommer att skapas senare. När du är klar med kopieringen klickar du på Nästa. Demontera inte volymen.\n\nObs: När du har klickat på Nästa kommer den yttre volymen att analyseras för att bestämma storleken på ett oavbrutet område med ledigt utrymme vars ände är i linje med slutet av volymen. Detta område kommer att rymma den dolda volymen, så det kommer att begränsa dess maximala storlek. Proceduren säkerställer att inga data på den yttre volymen skrivs över av den dolda volymen.</entry>
- <entry lang="sv" key="LINUX_ERROR_TRY_ENCRYPT_SYSTEM_DRIVE">Fel: Du försöker kryptera en systemenhet.\nVeraCrypt kan inte kryptera en systemenhet endast under Windows.</entry>
- <entry lang="sv" key="LINUX_ERROR_TRY_ENCRYPT_SYSTEM_PARTITION">Fel: Du försöker kryptera en systempartition.\nVeraCrypt kan inte kryptera systempartitioner endast under Windows.</entry>
+ <entry lang="sv" key="LINUX_ERROR_TRY_ENCRYPT_SYSTEM_DRIVE">Fel: Du försöker kryptera en systemenhet.\n\nVeraCrypt kan endast kryptera en systemenhet under Windows.</entry>
+ <entry lang="sv" key="LINUX_ERROR_TRY_ENCRYPT_SYSTEM_PARTITION">Fel: Du försöker kryptera en systempartition.\n\nVeraCrypt kan endast kryptera systempartitioner under Windows.</entry>
<entry lang="sv" key="LINUX_WARNING_FORMAT_DESTROY_FS">VARNING: Formatering av enheten kommer att förstöra alla data på filsystemet "{0}".\n\nVill du fortsätta?</entry>
<entry lang="sv" key="LINUX_MOUNTET_HINT">Filsystemet för den valda enheten är för närvarande monterat. Demontera "{0}" innan du fortsätter.</entry>
<entry lang="sv" key="LINUX_HIDDEN_PASS_NO_DIFF">Den dolda volymen kan inte ha samma lösenord, PIM och nyckelfiler som den yttre volymen</entry>
@@ -1620,7 +1620,7 @@
<entry lang="sv" key="EMV_CPLC_NOTFOUND">CPLC hittades inte i EMV-kortet.</entry>
<entry lang="sv" key="EMV_PAN_NOTFOUND">Inget primärt kontonummer (PAN) hittades i EMV-kortet.</entry>
<entry lang="sv" key="INVALID_EMV_PATH">EMV-sökvägen är ogiltig.</entry>
- <entry lang="sv" key="EMV_KEYFILE_DATA_NOTFOUND">Det går inte att bygga en nyckelfil från EMV-kortdata. Något av följande saknas:\n- ICC Public Key Certificate.\n- Utfärdarens Public Key Certificate.\n- CPLC-data.</entry>
+ <entry lang="sv" key="EMV_KEYFILE_DATA_NOTFOUND">Det går inte att bygga en nyckelfil från EMV-kortdata.\n\nNågot av följande saknas:\n- ICC-publiknyckelcertifikat.\n- Utfärdarens publiknyckelcertifikat.\n- CPLC-data.</entry>
<entry lang="sv" key="SCARD_W_REMOVED_CARD">Inget kort i läsaren.\n\nSe till att kortet är korrekt placerat.</entry>
<entry lang="sv" key="FORMAT_EXTERNAL_FAILED">Windows format.com-kommandot misslyckades med att formatera volymen som NTFS/exFAT/ReFS: Fel 0x%.8X.\n\nÅtergår till att använda Windows FormatEx API.</entry>
<entry lang="sv" key="FORMATEX_API_FAILED">Windows FormatEx API kunde inte formatera volymen som NTFS/exFAT/ReFS.\n\nFelstatus = %s.</entry>
diff --git a/src/Build/CMakeLists.txt b/src/Build/CMakeLists.txt
index ce3d372b..458040e8 100644
--- a/src/Build/CMakeLists.txt
+++ b/src/Build/CMakeLists.txt
@@ -111,6 +111,15 @@ if ( UNIX )
file(READ "/etc/centos-release" CENTOS_RELEASE)
string(REGEX MATCH "release ([0-9 /\\.]+)" _ ${CENTOS_RELEASE})
set(PLATFORM_VERSION ${CMAKE_MATCH_1})
+
+ # Get fedora release version
+ elseif(EXISTS "/etc/fedora-release")
+
+ set ( PLATFORM "Fedora" )
+
+ file(READ "/etc/fedora-release" FEDORA_RELEASE)
+ string(REGEX MATCH "release ([0-9 /\\.]+)" _ ${FEDORA_RELEASE})
+ set(PLATFORM_VERSION ${CMAKE_MATCH_1})
# Only if distribution uses systemd and if all previous files didn't exist
# i.e OpenSUSE
@@ -128,6 +137,8 @@ if ( UNIX )
set ( PLATFORM "Debian" )
elseif ( FULL_PLATFORM MATCHES "^.*CentOS.*$" )
set ( PLATFORM "CentOS" )
+ elseif ( FULL_PLATFORM MATCHES "^.*Fedora.*$" )
+ set ( PLATFORM "Fedora" )
endif ( )
# Get ditribution release version
@@ -164,7 +175,7 @@ if ( PLATFORM STREQUAL "Debian" OR PLATFORM STREQUAL "Ubuntu" )
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
endif( )
-elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) )
+elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) OR ( PLATFORM STREQUAL "Fedora" ))
execute_process(COMMAND arch OUTPUT_VARIABLE ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -295,7 +306,7 @@ if ( ( PLATFORM STREQUAL "Debian" ) OR ( PLATFORM STREQUAL "Ubuntu" ) )
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${DEBIAN_PREINST};${DEBIAN_POSTINST};${DEBIAN_PRERM};${DEBIAN_POSTRM})
set(CPACK_DEBIAN_PACKAGE_CONFLICTS "${CONFLICT_PACKAGE}")
-elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) )
+elseif ( ( PLATFORM STREQUAL "CentOS" ) OR ( PLATFORM STREQUAL "openSUSE" ) OR ( PLATFORM STREQUAL "Fedora" ))
# RPM control script(s)
file( MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Packaging/rpm-control)
diff --git a/src/Build/Include/Makefile.inc b/src/Build/Include/Makefile.inc
index b7ed20c9..11ab12c2 100644
--- a/src/Build/Include/Makefile.inc
+++ b/src/Build/Include/Makefile.inc
@@ -14,7 +14,7 @@ $(NAME): $(NAME).a
clean:
@echo Cleaning $(NAME)
- rm -f $(APPNAME) $(NAME).a $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSSSE41) $(OBJSSSSE3) $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) $(OBJSSSE41:.osse41=.d) $(OBJSSSSE3:.ossse3=.d) *.gch
+ rm -f $(APPNAME) $(NAME).a $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSHANI) $(OBJSSSE41) $(OBJSSSSE3) $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) $(OBJSHANI:.oshani=.d) $(OBJSSSE41:.osse41=.d) $(OBJSSSSE3:.ossse3=.d) *.gch
%.o: %.c
@echo Compiling $(<F)
@@ -27,6 +27,10 @@ clean:
%.osse41: %.c
@echo Compiling $(<F)
$(CC) $(CFLAGS) -mssse3 -msse4.1 -c $< -o $@
+
+%.oshani: %.c
+ @echo Compiling $(<F)
+ $(CC) $(CFLAGS) -mssse3 -msse4.1 -msha -c $< -o $@
%.ossse3: %.c
@echo Compiling $(<F)
@@ -39,6 +43,10 @@ clean:
%.osse41: %.cpp
@echo Compiling $(<F)
$(CXX) $(CXXFLAGS) -mssse3 -msse4.1 -c $< -o $@
+
+%.oshani: %.cpp
+ @echo Compiling $(<F)
+ $(CXX) $(CXXFLAGS) -mssse3 -msse4.1 -msha -c $< -o $@
%.ossse3: %.cpp
@echo Compiling $(<F)
@@ -88,10 +96,10 @@ TR_SED_BIN := tr '\n' ' ' | tr -s ' ' ',' | sed -e 's/^,//g' -e 's/,$$/n/' | tr
# Dependencies
--include $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) $(OBJSSSE41:.osse41=.d) $(OBJSSSSE3:.ossse3=.d)
+-include $(OBJS:.o=.d) $(OBJSEX:.oo=.d) $(OBJSNOOPT:.o0=.d) $(OBJSHANI:.oshani=.d) $(OBJSSSE41:.osse41=.d) $(OBJSSSSE3:.ossse3=.d)
-$(NAME).a: $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSSSE41) $(OBJSSSSE3)
+$(NAME).a: $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSHANI) $(OBJSSSE41) $(OBJSSSSE3)
@echo Updating library $@
- $(AR) $(AFLAGS) -rcu $@ $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSSSE41) $(OBJSSSSE3)
+ $(AR) $(AFLAGS) -rcu $@ $(OBJS) $(OBJSEX) $(OBJSNOOPT) $(OBJSHANI) $(OBJSSSE41) $(OBJSSSSE3)
$(RANLIB) $@
diff --git a/src/Build/build_veracrypt_macosx.sh b/src/Build/build_veracrypt_macosx.sh
index 5319fa6a..13302442 100755
--- a/src/Build/build_veracrypt_macosx.sh
+++ b/src/Build/build_veracrypt_macosx.sh
@@ -7,36 +7,77 @@
# code distribution packages.
#
+# Exit immediately if a command exits with a non-zero status
+set -e
+
# Absolute path this script is in
-SCRIPTPATH=$(cd "$(dirname "$0")"; pwd)
+SCRIPTPATH=$(cd "$(dirname "$0")" && pwd)
# source directory which contains the Makefile
-SOURCEPATH=$(cd "$(dirname "$SCRIPTPATH/../.")"; pwd)
+SOURCEPATH=$(cd "$(dirname "$SCRIPTPATH/../.")" && pwd)
# directory where the VeraCrypt project has been checked out
-PARENTDIR=$(cd "$(dirname "$SCRIPTPATH/../../../.")"; pwd)
+PARENTDIR=$(cd "$(dirname "$SCRIPTPATH/../../../.")" && pwd)
+
+# Default wxWidgets version
+DEFAULT_WX_VERSION="3.2.5"
+WX_VERSION="$DEFAULT_WX_VERSION"
+
+# Initialize flags
+brew=false
+package=false
+fuset=false
+local_build=false
-while getopts bpf flag
+# Function to display usage information
+usage() {
+ echo "Usage: $0 [options]"
+ echo "Options:"
+ echo " -b Use Homebrew to build with precompiled packages"
+ echo " -p Create a package after building"
+ echo " -f Build with FUSE-T support"
+ echo " -l Use local wxWidgets and disable universal binaries"
+ echo " -v <version> Specify wxWidgets version (default: $DEFAULT_WX_VERSION)"
+ echo " -h Display this help message"
+ exit 1
+}
+
+# Parse command-line options
+while getopts "bpflv:h" flag
do
case "${flag}" in
b) brew=true;;
p) package=true;;
f) fuset=true;;
+ l) local_build=true;;
+ v)
+ if [ -z "$OPTARG" ]; then
+ echo "Error: -v requires a version argument."
+ usage
+ fi
+ WX_VERSION=${OPTARG}
+ ;;
+ h) usage;;
+ *) usage;;
esac
done
-export VC_OSX_FUSET=0
+export VC_OSX_FUSET=$([ "$fuset" = true ] && echo 1 || echo 0)
-if [ -n "$fuset" ]; then
+if [ "$fuset" = true ]; then
echo "Building VeraCrypt with FUSE-T support"
- VC_OSX_FUSET=1
else
echo "Building VeraCrypt with MacFUSE support"
fi
-if [ -n "$brew" ]; then
- export VC_OSX_SDK=$(xcrun --show-sdk-version) #use the latest version installed, this might fail
+if [ "$brew" = true ]; then
+ if ! command -v brew &> /dev/null; then
+ echo "Homebrew is not installed. Please install Homebrew or run without the -b flag."
+ exit 1
+ fi
+
+ export VC_OSX_SDK=$(xcrun --show-sdk-version) # use the latest version installed, this might fail
export VC_OSX_TARGET=${VC_OSX_SDK}
echo "Using MacOSX SDK $VC_OSX_SDK with target set to $VC_OSX_TARGET"
- cd $SOURCEPATH
+ cd "$SOURCEPATH"
echo "Building VeraCrypt with precompiled homebrew packages"
cellar=$(brew --cellar "wxwidgets")
@@ -48,43 +89,49 @@ if [ -n "$brew" ]; then
export CPU_ARCH=$(uname -m)
export AS=$(which yasm)
export COMPILE_ASM=$( if [[ "$CPU_ARCH" != "arm64" ]]; then echo true; else echo false; fi )
- make clean && make
- if [ -n "$package" ]; then
+ make clean
+ make
+ if [ "$package" = true ]; then
make package
fi
exit 0
fi
-# Check the condition of wxBuildConsole and wxWidgets-3.2.5 in the original PARENTDIR
+if [ "$local_build" = true ]; then
+ echo "Building VeraCrypt with local wxWidgets support and no universal binary"
+ export LOCAL_DEVELOPMENT_BUILD=true
+fi
+
+# Check the condition of wxBuildConsole and wxWidgets-$WX_VERSION in the original PARENTDIR
if [ -d "$PARENTDIR/wxBuildConsole" ]; then
echo "Using existing PARENTDIR: $PARENTDIR, wxBuildConsole is present."
-elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then
- echo "Using existing PARENTDIR: $PARENTDIR, wxWidgets-3.2.5 is present."
+elif [ -d "$PARENTDIR/wxWidgets-$WX_VERSION" ]; then
+ echo "Using existing PARENTDIR: $PARENTDIR, wxWidgets-$WX_VERSION is present."
else
# Change PARENTDIR to /tmp and check conditions again
export PARENTDIR="/tmp"
if [ -d "$PARENTDIR/wxBuildConsole" ]; then
echo "Switched to PARENTDIR: /tmp, wxBuildConsole is present in /tmp."
- elif [ -d "$PARENTDIR/wxWidgets-3.2.5" ]; then
- echo "Switched to PARENTDIR: /tmp, wxWidgets-3.2.5 is present in /tmp."
+ elif [ -d "$PARENTDIR/wxWidgets-$WX_VERSION" ]; then
+ echo "Switched to PARENTDIR: /tmp, wxWidgets-$WX_VERSION is present in /tmp."
else
- echo "Error: Neither wxBuildConsole nor wxWidgets-3.2.5 found in /tmp. Exiting."
+ echo "Error: Neither wxBuildConsole nor wxWidgets-$WX_VERSION found in /tmp. Exiting."
exit 1
fi
fi
-# The sources of wxWidgets 3.2.5 must be extracted to the parent directory
-export WX_ROOT=$PARENTDIR/wxWidgets-3.2.5
+# The sources of wxWidgets $WX_VERSION must be extracted to the parent directory
+export WX_ROOT="$PARENTDIR/wxWidgets-$WX_VERSION"
# this will be the temporary wxWidgets directory
-export WX_BUILD_DIR=$PARENTDIR/wxBuild-3.2.5
+export WX_BUILD_DIR="$PARENTDIR/wxBuild-$WX_VERSION"
# define the SDK version to use and OSX minimum target. We target 12 by default
export VC_OSX_TARGET=12
export VC_OSX_SDK=$(xcrun --show-sdk-version) #use the latest version installed
echo "Using MacOSX SDK $VC_OSX_SDK with target set to $VC_OSX_TARGET"
-cd $SOURCEPATH
+cd "$SOURCEPATH"
echo "Building VeraCrypt"
# Check if wx-config exists in WX_BUILD_DIR
@@ -92,8 +139,12 @@ if [ -L "${WX_BUILD_DIR}/wx-config" ]; then
echo "wx-config already exists in ${WX_BUILD_DIR}. Skipping wxbuild."
else
echo "Using wxWidgets sources in $WX_ROOT"
- make WXSTATIC=FULL wxbuild || exit 1
+ make WXSTATIC=FULL wxbuild
+fi
+make WXSTATIC=FULL clean
+make WXSTATIC=FULL
+if [ "$package" = true ]; then
+ make WXSTATIC=FULL package
fi
-make WXSTATIC=FULL clean || exit 1
-make WXSTATIC=FULL || exit 1
-make WXSTATIC=FULL package || exit 1
+
+echo "VeraCrypt build completed successfully."
diff --git a/src/Common/BootEncryption.cpp b/src/Common/BootEncryption.cpp
index c9b275dc..f79e7339 100644
--- a/src/Common/BootEncryption.cpp
+++ b/src/Common/BootEncryption.cpp
@@ -2636,7 +2636,7 @@ namespace VeraCrypt
bool EfiBoot::IsEfiBoot() {
DWORD BootOrderLen;
BootOrderLen = GetFirmwareEnvironmentVariable(L"BootOrder", EfiVarGuid, tempBuf, sizeof(tempBuf));
- return BootOrderLen != 0;
+ return (BootOrderLen != 0) || (GetLastError() != ERROR_INVALID_FUNCTION);
}
void EfiBoot::DeleteStartExec(uint16 statrtOrderNum, wchar_t* type) {
@@ -2651,16 +2651,9 @@ namespace VeraCrypt
}
// Check EFI
if (!IsEfiBoot()) {
- dwLastError = GetLastError();
- if (dwLastError != ERROR_SUCCESS)
- {
- if (!bPrivilegesSet)
- SetPrivilege(SE_SYSTEM_ENVIRONMENT_NAME, FALSE);
- // format message to append the error code to the exception message
- wchar_t szMsg[128];
- StringCchPrintfW(szMsg, ARRAYSIZE(szMsg), L"Failed to detect EFI environment (error code 0x%.8X)", dwLastError);
- throw ErrorException(szMsg, SRC_POS);
- }
+ if (!bPrivilegesSet)
+ SetPrivilege(SE_SYSTEM_ENVIRONMENT_NAME, FALSE);
+ throw ErrorException(L"Failed to detect EFI environment (error ERROR_INVALID_FUNCTION)", SRC_POS);
}
wchar_t varName[256];
StringCchPrintfW(varName, ARRAYSIZE (varName), L"%s%04X", type == NULL ? L"Boot" : type, statrtOrderNum);
@@ -2720,16 +2713,9 @@ namespace VeraCrypt
}
// Check EFI
if (!IsEfiBoot()) {
- dwLastError = GetLastError();
- if (dwLastError != ERROR_SUCCESS)
- {
- if (!bPrivilegesSet)
- SetPrivilege(SE_SYSTEM_ENVIRONMENT_NAME, FALSE);
- // format message to append the error code to the exception message
- wchar_t szMsg[1024];
- StringCchPrintfW(szMsg, ARRAYSIZE(szMsg), L"Failed to detect EFI environment (error code 0x%.8X)", dwLastError);
- throw ErrorException(szMsg, SRC_POS);
- }
+ if (!bPrivilegesSet)
+ SetPrivilege(SE_SYSTEM_ENVIRONMENT_NAME, FALSE);
+ throw ErrorException(L"Failed to detect EFI environment (error ERROR_INVALID_FUNCTION)", SRC_POS);
}
if (bDeviceInfoValid)
diff --git a/src/Common/Common.rc b/src/Common/Common.rc
index cbd401d8..41778dfc 100644
--- a/src/Common/Common.rc
+++ b/src/Common/Common.rc
@@ -344,9 +344,9 @@ IDD_TEXT_EDIT_DLG DIALOGEX 0, 0, 372, 220
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- PUSHBUTTON "OK",IDOK,306,201,58,14
+ PUSHBUTTON "OK",IDOK,244,201,58,14
CONTROL "",IDC_INFO_BOX_TEXT,"RichEdit20W",ES_MULTILINE | ES_WANTRETURN | ES_NUMBER | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,5,6,361,188
- DEFPUSHBUTTON "Cancel",IDCANCEL,240,201,58,14
+ DEFPUSHBUTTON "Cancel",IDCANCEL,308,201,58,14
END
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 269817d8..b91167d4 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -4165,6 +4165,7 @@ BOOL CALLBACK TextEditDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case WM_INITDIALOG:
{
prm = (TEXT_INFO_DIALOG_PARAM_PTR)lParam;
+ LocalizeDialog (hwndDlg, NULL);
// increase size limit of rich edit control
SendMessage(GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), EM_EXLIMITTEXT, 0, -1);
@@ -4175,9 +4176,43 @@ BOOL CALLBACK TextEditDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
if (prm->ReadOnly)
{
// switch rich edit control to ReadOnly
- SendMessage(GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), ES_READONLY, TRUE, 0);
+ SendMessage(GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), EM_SETREADONLY , TRUE, 0);
// hide cancel button
- ShowWindow(GetDlgItem(hwndDlg, IDCANCEL), SW_HIDE);
+ HWND hwndCancel = GetDlgItem(hwndDlg, IDCANCEL);
+ ShowWindow(hwndCancel, SW_HIDE);
+
+ // Reposition OK button to Cancel button's position
+ HWND hwndOK = GetDlgItem(hwndDlg, IDOK);
+ if (hwndOK && hwndCancel)
+ {
+ // Get Cancel button's position in screen coordinates
+ RECT rectCancel;
+ if (GetWindowRect(hwndCancel, &rectCancel))
+ {
+ // Convert Cancel button's position to dialog's client coordinates
+ POINT ptCancel = { rectCancel.left, rectCancel.top };
+ ScreenToClient(hwndDlg, &ptCancel);
+
+ // Get OK button's current size
+ RECT rectOK;
+ if (GetWindowRect(hwndOK, &rectOK))
+ {
+ int width = rectOK.right - rectOK.left;
+ int height = rectOK.bottom - rectOK.top;
+
+ // Move OK button to Cancel button's position
+ SetWindowPos(
+ hwndOK,
+ NULL,
+ ptCancel.x,
+ ptCancel.y,
+ width,
+ height,
+ SWP_NOZORDER | SWP_NOACTIVATE
+ );
+ }
+ }
+ }
}
SendMessage (hwndDlg, TC_APPMSG_LOAD_TEXT_BOX_CONTENT, 0, 0);
@@ -4189,8 +4224,12 @@ BOOL CALLBACK TextEditDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
{
if (!prm->ReadOnly)
{
- prm->Text.resize(GetWindowTextLengthA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT)) + 1);
- GetWindowTextA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), &(prm->Text)[0], (int) prm->Text.size());
+ // read content of the text box as UTF16 and then convert it to UTF8
+ HWND hEdit = GetDlgItem(hwndDlg, IDC_INFO_BOX_TEXT);
+ int size = GetWindowTextLengthW(hEdit);
+ std::vector<WCHAR> buffer(size + 1);
+ GetWindowTextW(hEdit, buffer.data(), size + 1);
+ prm->Text = WideToUtf8String(buffer.data());
}
NormalCursor ();
EndDialog (hwndDlg, IDOK);
@@ -4207,7 +4246,8 @@ BOOL CALLBACK TextEditDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case TC_APPMSG_LOAD_TEXT_BOX_CONTENT:
{
- SetWindowTextA (GetDlgItem (hwndDlg, IDC_INFO_BOX_TEXT), prm->Text.c_str());
+ // convert prm->Text to UTF16 using Utf8StringToWide
+ SetWindowTextW(GetDlgItem(hwndDlg, IDC_INFO_BOX_TEXT), Utf8StringToWide(prm->Text).c_str());
}
return 0;
diff --git a/src/Crypto/Crypto.vcxproj b/src/Crypto/Crypto.vcxproj
index 97a472f7..0f79395f 100644
--- a/src/Crypto/Crypto.vcxproj
+++ b/src/Crypto/Crypto.vcxproj
@@ -223,6 +223,7 @@
<ClCompile Include="SerpentFast.c" />
<ClCompile Include="SerpentFast_simd.cpp" />
<ClCompile Include="Sha2.c" />
+ <ClCompile Include="Sha2Intel.c" />
<ClCompile Include="Streebog.c" />
<ClCompile Include="t1ha2.c" />
<ClCompile Include="t1ha2_selfcheck.c" />
diff --git a/src/Crypto/Crypto.vcxproj.filters b/src/Crypto/Crypto.vcxproj.filters
index 5d149bdd..3d384f97 100644
--- a/src/Crypto/Crypto.vcxproj.filters
+++ b/src/Crypto/Crypto.vcxproj.filters
@@ -87,6 +87,9 @@
<ClCompile Include="blake2s_SSSE3.c">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="Sha2Intel.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Aes.h">
diff --git a/src/Crypto/Crypto_vs2019.vcxproj b/src/Crypto/Crypto_vs2019.vcxproj
index ab3d5f3b..0abf740a 100644
--- a/src/Crypto/Crypto_vs2019.vcxproj
+++ b/src/Crypto/Crypto_vs2019.vcxproj
@@ -339,6 +339,7 @@
<ClCompile Include="SerpentFast.c" />
<ClCompile Include="SerpentFast_simd.cpp" />
<ClCompile Include="Sha2.c" />
+ <ClCompile Include="Sha2Intel.c" />
<ClCompile Include="Streebog.c" />
<ClCompile Include="t1ha2.c" />
<ClCompile Include="t1ha2_selfcheck.c" />
diff --git a/src/Crypto/Sha2.c b/src/Crypto/Sha2.c
index 3cce21d7..5ae9cae2 100644
--- a/src/Crypto/Sha2.c
+++ b/src/Crypto/Sha2.c
@@ -306,6 +306,9 @@ extern "C"
void sha256_sse4(void *input_data, uint_32t digest[8], uint_64t num_blks);
void sha256_rorx(void *input_data, uint_32t digest[8], uint_64t num_blks);
void sha256_avx(void *input_data, uint_32t digest[8], uint_64t num_blks);
+#if CRYPTOPP_SHANI_AVAILABLE
+ void sha256_intel(void *input_data, uint_32t digest[8], uint_64t num_blks);
+#endif
#endif
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32
@@ -717,6 +720,13 @@ void StdSha256Transform(sha256_ctx* ctx, void* mp, uint_64t num_blks)
#ifndef NO_OPTIMIZED_VERSIONS
#if CRYPTOPP_BOOL_X64
+#if CRYPTOPP_SHANI_AVAILABLE
+void IntelSha256Transform(sha256_ctx* ctx, void* mp, uint_64t num_blks)
+{
+ sha256_intel(mp, ctx->hash, num_blks);
+}
+#endif
+
void Avx2Sha256Transform(sha256_ctx* ctx, void* mp, uint_64t num_blks)
{
if (num_blks > 1)
@@ -775,6 +785,11 @@ void sha256_begin(sha256_ctx* ctx)
{
#ifndef NO_OPTIMIZED_VERSIONS
#if CRYPTOPP_BOOL_X64
+#if CRYPTOPP_SHANI_AVAILABLE
+ if (HasSHA256())
+ sha256transfunc = IntelSha256Transform;
+ else
+#endif
if (g_isIntel && HasSAVX2() && HasSBMI2())
sha256transfunc = Avx2Sha256Transform;
else if (g_isIntel && HasSAVX())
diff --git a/src/Crypto/Sha2Intel.c b/src/Crypto/Sha2Intel.c
new file mode 100644
index 00000000..943115bf
--- /dev/null
+++ b/src/Crypto/Sha2Intel.c
@@ -0,0 +1,278 @@
+/*
+* Support for SHA-256 x86 instrinsic
+* Based on public domain code by Sean Gulley
+* (https://github.com/mitls/hacl-star/tree/master/experimental/hash)
+*
+* Botan is released under the Simplified BSD License (see license.txt)
+*/
+
+/* November 10th 2024: Modified for VeraCrypt */
+
+#include "Sha2.h"
+#include "Common/Endian.h"
+#include "cpu.h"
+#include "misc.h"
+
+#if defined(_UEFI) || defined(CRYPTOPP_DISABLE_ASM)
+#define NO_OPTIMIZED_VERSIONS
+#endif
+
+#ifndef NO_OPTIMIZED_VERSIONS
+
+#if CRYPTOPP_SHANI_AVAILABLE
+
+#ifndef _MSC_VER
+#include <signal.h>
+#include <setjmp.h>
+
+typedef void (*SigHandler)(int);
+
+static jmp_buf s_jmpNoSHA;
+static void SigIllHandlerSHA(int p)
+{
+ longjmp(s_jmpNoSHA, 1);
+}
+#endif
+
+int TrySHA256()
+{
+ volatile int result = 0;
+#ifdef _MSC_VER
+ __try
+#else
+ SigHandler oldHandler = signal(SIGILL, SigIllHandlerSHA);
+ if (oldHandler == SIG_ERR)
+ return 0;
+ if (setjmp(s_jmpNoSHA))
+ result = 0;
+ else
+#endif
+ {
+ // Known input message block
+ __m128i msg0 = _mm_setr_epi32(0x12345678, 0x9ABCDEF0, 0x87654321, 0x0FEDCBA9);
+ __m128i msg1 = _mm_setr_epi32(0x11111111, 0x22222222, 0x33333333, 0x44444444);
+
+ // SHA256 message schedule update
+ __m128i tmp = _mm_sha256msg1_epu32(msg0, msg1);
+
+ // Verify result - these values were pre-computed for the given input
+#ifdef _MSC_VER
+ if (tmp.m128i_u32[0] == 0xD8131B44 &&
+ tmp.m128i_u32[1] == 0x9DE6E22B &&
+ tmp.m128i_u32[2] == 0xA86D643A &&
+ tmp.m128i_u32[3] == 0x74320FED)
+#else
+ if (((uint32_t*)(&tmp))[0] == 0xD8131B44 &&
+ ((uint32_t*)(&tmp))[1] == 0x9DE6E22B &&
+ ((uint32_t*)(&tmp))[2] == 0xA86D643A &&
+ ((uint32_t*)(&tmp))[3] == 0x74320FED)
+#endif
+ result = 1;
+ }
+#ifdef _MSC_VER
+ __except (EXCEPTION_EXECUTE_HANDLER)
+ {
+ // ignore error if SHA instructions not supported
+ }
+#else
+ signal(SIGILL, oldHandler);
+#endif
+
+ return result;
+}
+
+//
+void sha256_intel(void *mp, uint_32t state[8], uint_64t num_blks)
+{
+ // Constants table - align for better performance
+ CRYPTOPP_ALIGN_DATA(64)
+ static const uint_32t K[64] = {
+ 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
+ 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
+ 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
+ 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
+ 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
+ 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
+ 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
+ 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2,
+ };
+
+ const __m128i* K_mm = (const __m128i*)K;
+ const __m128i* input_mm = (const __m128i*)mp;
+
+ // Create byte shuffle mask for big-endian to little-endian conversion
+ const __m128i MASK = _mm_set_epi64x(0x0c0d0e0f08090a0b, 0x0405060700010203);
+
+ // Load initial values
+ __m128i STATE0 = _mm_loadu_si128((__m128i*)&state[0]);
+ __m128i STATE1 = _mm_loadu_si128((__m128i*)&state[4]);
+
+ // Adjust byte ordering
+ STATE0 = _mm_shuffle_epi32(STATE0, 0xB1); // CDAB
+ STATE1 = _mm_shuffle_epi32(STATE1, 0x1B); // EFGH
+
+ __m128i TMP = _mm_alignr_epi8(STATE0, STATE1, 8); // ABEF
+ STATE1 = _mm_blend_epi16(STATE1, STATE0, 0xF0); // CDGH
+ STATE0 = TMP;
+
+ while(num_blks > 0) {
+ // Save current state
+ const __m128i ABEF_SAVE = STATE0;
+ const __m128i CDGH_SAVE = STATE1;
+
+ __m128i MSG;
+
+ __m128i TMSG0 = _mm_shuffle_epi8(_mm_loadu_si128(input_mm), MASK);
+ __m128i TMSG1 = _mm_shuffle_epi8(_mm_loadu_si128(input_mm + 1), MASK);
+ __m128i TMSG2 = _mm_shuffle_epi8(_mm_loadu_si128(input_mm + 2), MASK);
+ __m128i TMSG3 = _mm_shuffle_epi8(_mm_loadu_si128(input_mm + 3), MASK);
+
+ // Rounds 0-3
+ MSG = _mm_add_epi32(TMSG0, _mm_load_si128(K_mm));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ // Rounds 4-7
+ MSG = _mm_add_epi32(TMSG1, _mm_load_si128(K_mm + 1));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG0 = _mm_sha256msg1_epu32(TMSG0, TMSG1);
+
+ // Rounds 8-11
+ MSG = _mm_add_epi32(TMSG2, _mm_load_si128(K_mm + 2));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG1 = _mm_sha256msg1_epu32(TMSG1, TMSG2);
+
+ // Rounds 12-15
+ MSG = _mm_add_epi32(TMSG3, _mm_load_si128(K_mm + 3));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG0 = _mm_add_epi32(TMSG0, _mm_alignr_epi8(TMSG3, TMSG2, 4));
+ TMSG0 = _mm_sha256msg2_epu32(TMSG0, TMSG3);
+ TMSG2 = _mm_sha256msg1_epu32(TMSG2, TMSG3);
+
+ // Rounds 16-19
+ MSG = _mm_add_epi32(TMSG0, _mm_load_si128(K_mm + 4));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG1 = _mm_add_epi32(TMSG1, _mm_alignr_epi8(TMSG0, TMSG3, 4));
+ TMSG1 = _mm_sha256msg2_epu32(TMSG1, TMSG0);
+ TMSG3 = _mm_sha256msg1_epu32(TMSG3, TMSG0);
+
+ // Rounds 20-23
+ MSG = _mm_add_epi32(TMSG1, _mm_load_si128(K_mm + 5));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG2 = _mm_add_epi32(TMSG2, _mm_alignr_epi8(TMSG1, TMSG0, 4));
+ TMSG2 = _mm_sha256msg2_epu32(TMSG2, TMSG1);
+ TMSG0 = _mm_sha256msg1_epu32(TMSG0, TMSG1);
+
+ // Rounds 24-27
+ MSG = _mm_add_epi32(TMSG2, _mm_load_si128(K_mm + 6));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG3 = _mm_add_epi32(TMSG3, _mm_alignr_epi8(TMSG2, TMSG1, 4));
+ TMSG3 = _mm_sha256msg2_epu32(TMSG3, TMSG2);
+ TMSG1 = _mm_sha256msg1_epu32(TMSG1, TMSG2);
+
+ // Rounds 28-31
+ MSG = _mm_add_epi32(TMSG3, _mm_load_si128(K_mm + 7));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG0 = _mm_add_epi32(TMSG0, _mm_alignr_epi8(TMSG3, TMSG2, 4));
+ TMSG0 = _mm_sha256msg2_epu32(TMSG0, TMSG3);
+ TMSG2 = _mm_sha256msg1_epu32(TMSG2, TMSG3);
+
+ // Rounds 32-35
+ MSG = _mm_add_epi32(TMSG0, _mm_load_si128(K_mm + 8));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG1 = _mm_add_epi32(TMSG1, _mm_alignr_epi8(TMSG0, TMSG3, 4));
+ TMSG1 = _mm_sha256msg2_epu32(TMSG1, TMSG0);
+ TMSG3 = _mm_sha256msg1_epu32(TMSG3, TMSG0);
+
+ // Rounds 36-39
+ MSG = _mm_add_epi32(TMSG1, _mm_load_si128(K_mm + 9));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG2 = _mm_add_epi32(TMSG2, _mm_alignr_epi8(TMSG1, TMSG0, 4));
+ TMSG2 = _mm_sha256msg2_epu32(TMSG2, TMSG1);
+ TMSG0 = _mm_sha256msg1_epu32(TMSG0, TMSG1);
+
+ // Rounds 40-43
+ MSG = _mm_add_epi32(TMSG2, _mm_load_si128(K_mm + 10));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG3 = _mm_add_epi32(TMSG3, _mm_alignr_epi8(TMSG2, TMSG1, 4));
+ TMSG3 = _mm_sha256msg2_epu32(TMSG3, TMSG2);
+ TMSG1 = _mm_sha256msg1_epu32(TMSG1, TMSG2);
+
+ // Rounds 44-47
+ MSG = _mm_add_epi32(TMSG3, _mm_load_si128(K_mm + 11));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG0 = _mm_add_epi32(TMSG0, _mm_alignr_epi8(TMSG3, TMSG2, 4));
+ TMSG0 = _mm_sha256msg2_epu32(TMSG0, TMSG3);
+ TMSG2 = _mm_sha256msg1_epu32(TMSG2, TMSG3);
+
+ // Rounds 48-51
+ MSG = _mm_add_epi32(TMSG0, _mm_load_si128(K_mm + 12));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG1 = _mm_add_epi32(TMSG1, _mm_alignr_epi8(TMSG0, TMSG3, 4));
+ TMSG1 = _mm_sha256msg2_epu32(TMSG1, TMSG0);
+ TMSG3 = _mm_sha256msg1_epu32(TMSG3, TMSG0);
+
+ // Rounds 52-55
+ MSG = _mm_add_epi32(TMSG1, _mm_load_si128(K_mm + 13));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG2 = _mm_add_epi32(TMSG2, _mm_alignr_epi8(TMSG1, TMSG0, 4));
+ TMSG2 = _mm_sha256msg2_epu32(TMSG2, TMSG1);
+
+ // Rounds 56-59
+ MSG = _mm_add_epi32(TMSG2, _mm_load_si128(K_mm + 14));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ TMSG3 = _mm_add_epi32(TMSG3, _mm_alignr_epi8(TMSG2, TMSG1, 4));
+ TMSG3 = _mm_sha256msg2_epu32(TMSG3, TMSG2);
+
+ // Rounds 60-63
+ MSG = _mm_add_epi32(TMSG3, _mm_load_si128(K_mm + 15));
+ STATE1 = _mm_sha256rnds2_epu32(STATE1, STATE0, MSG);
+ STATE0 = _mm_sha256rnds2_epu32(STATE0, STATE1, _mm_shuffle_epi32(MSG, 0x0E));
+
+ // Add values back to state
+ STATE0 = _mm_add_epi32(STATE0, ABEF_SAVE);
+ STATE1 = _mm_add_epi32(STATE1, CDGH_SAVE);
+
+ input_mm += 4;
+ num_blks--;
+ }
+
+ // Shuffle state back to correct order
+ STATE0 = _mm_shuffle_epi32(STATE0, 0x1B); // FEBA
+ STATE1 = _mm_shuffle_epi32(STATE1, 0xB1); // DCHG
+
+ // Save state
+ _mm_storeu_si128((__m128i*)&state[0], _mm_blend_epi16(STATE0, STATE1, 0xF0)); // DCBA
+ _mm_storeu_si128((__m128i*)&state[4], _mm_alignr_epi8(STATE1, STATE0, 8)); // HGFE
+}
+
+#endif
+#endif
diff --git a/src/Crypto/Sources b/src/Crypto/Sources
index 9542d4b6..bd990382 100644
--- a/src/Crypto/Sources
+++ b/src/Crypto/Sources
@@ -39,6 +39,7 @@ SOURCES = \
SerpentFast.c \
SerpentFast_simd.cpp \
Sha2.c \
+ Sha2Intel.c \
t1ha_selfcheck.c \
t1ha2.c \
t1ha2_selfcheck.c \
diff --git a/src/Crypto/config.h b/src/Crypto/config.h
index d2a9cfea..774f7951 100644
--- a/src/Crypto/config.h
+++ b/src/Crypto/config.h
@@ -152,6 +152,15 @@
#define CRYPTOPP_BOOL_SSE41_INTRINSICS_AVAILABLE 0
#endif
+#if !defined(CRYPTOPP_DISABLE_SHANI) && !defined(_M_ARM) && !defined(_M_ARM64) && !defined(__arm__) && !defined(__aarch64__) && !defined(__arm64__) && defined(CRYPTOPP_BOOL_SSE41_INTRINSICS_AVAILABLE) && \
+ (defined(__SHA__) || (_MSC_VER >= 1900) || (__SUNPRO_CC >= 0x5160) || \
+ (CRYPTOPP_GCC_VERSION >= 40900) || (__INTEL_COMPILER >= 1600) || \
+ (CRYPTOPP_LLVM_CLANG_VERSION >= 30400) || (CRYPTOPP_APPLE_CLANG_VERSION >= 50100))
+ #define CRYPTOPP_SHANI_AVAILABLE 1
+#else
+ #define CRYPTOPP_SHANI_AVAILABLE 0
+#endif
+
// how to allocate 16-byte aligned memory (for SSE2)
#if defined(_MSC_VER)
#define CRYPTOPP_MM_MALLOC_AVAILABLE
diff --git a/src/Crypto/cpu.c b/src/Crypto/cpu.c
index effde6ba..30263361 100644
--- a/src/Crypto/cpu.c
+++ b/src/Crypto/cpu.c
@@ -17,6 +17,10 @@
#ifdef CRYPTOPP_CPUID_AVAILABLE
+#if defined(__GNUC__) || defined(__clang__)
+ #include <cpuid.h> // for __get_cpuid and __get_cpuid_count
+#endif
+
#if _MSC_VER >= 1400 && CRYPTOPP_BOOL_X64
int CpuId(uint32 input, uint32 output[4])
@@ -207,6 +211,7 @@ volatile int g_x86DetectionDone = 0;
volatile int g_hasISSE = 0, g_hasSSE2 = 0, g_hasSSSE3 = 0, g_hasMMX = 0, g_hasAESNI = 0, g_hasCLMUL = 0, g_isP4 = 0;
volatile int g_hasAVX = 0, g_hasAVX2 = 0, g_hasBMI2 = 0, g_hasSSE42 = 0, g_hasSSE41 = 0, g_isIntel = 0, g_isAMD = 0;
volatile int g_hasRDRAND = 0, g_hasRDSEED = 0;
+volatile int g_hasSHA256 = 0;
volatile uint32 g_cacheLineSize = CRYPTOPP_L1_CACHE_LINE_SIZE;
VC_INLINE int IsIntel(const uint32 output[4])
@@ -306,6 +311,39 @@ static int Detect_MS_HyperV_AES ()
#endif
+#if defined(__SHA__) || defined(__INTEL_COMPILER) || CRYPTOPP_SHANI_AVAILABLE
+extern int TrySHA256();
+#endif
+
+static BOOL CheckSHA256Support() {
+#if CRYPTOPP_BOOL_X64 && CRYPTOPP_SHANI_AVAILABLE
+#if defined(_MSC_VER) // Windows with MSVC
+ int cpuInfo[4] = { 0 };
+ __cpuidex(cpuInfo, 7, 0);
+ return (cpuInfo[1] & (1 << 29)) != 0? TRUE : FALSE;
+
+#elif defined(__GNUC__) || defined(__clang__) // Linux, FreeBSD, macOS with GCC/Clang
+ unsigned int eax = 0, ebx = 0, ecx = 0, edx = 0;
+ // First check if CPUID leaf 7 is supported
+ if (__get_cpuid(0, &eax, &ebx, &ecx, &edx)) {
+ if (eax >= 7) {
+ // Now check SHA-256 support in leaf 7, sub-leaf 0
+ if (__get_cpuid_count(7, 0, &eax, &ebx, &ecx, &edx)) {
+ return (ebx & (1 << 29)) != 0? TRUE : FALSE;
+ }
+ }
+ }
+ return FALSE;
+
+#else
+ #error "Unsupported compiler"
+#endif
+#else
+ return FALSE;
+#endif
+}
+
+
void DetectX86Features()
{
uint32 cpuid[4] = {0}, cpuid1[4] = {0}, cpuid2[4] = {0};
@@ -334,6 +372,7 @@ void DetectX86Features()
g_hasAESNI = g_hasSSE2 && (cpuid1[2] & (1<<25));
#endif
g_hasCLMUL = g_hasSSE2 && (cpuid1[2] & (1<<1));
+ g_hasSHA256 = CheckSHA256Support();
#if !defined (_UEFI) && ((defined(__AES__) && defined(__PCLMUL__)) || defined(__INTEL_COMPILER) || CRYPTOPP_BOOL_AESNI_INTRINSICS_AVAILABLE)
// Hypervisor = bit 31 of ECX of CPUID leaf 0x1
@@ -344,6 +383,13 @@ void DetectX86Features()
}
#endif
+#if defined(__SHA__) || defined(__INTEL_COMPILER) || CRYPTOPP_SHANI_AVAILABLE
+ if (!g_hasSHA256)
+ {
+ g_hasSHA256 = TrySHA256();
+ }
+#endif
+
if ((cpuid1[3] & (1 << 25)) != 0)
g_hasISSE = 1;
else
@@ -439,6 +485,7 @@ void DisableCPUExtendedFeatures ()
g_hasSSSE3 = 0;
g_hasAESNI = 0;
g_hasCLMUL = 0;
+ g_hasSHA256 = 0;
}
#endif
diff --git a/src/Crypto/cpu.h b/src/Crypto/cpu.h
index 2661bf1c..b0df6462 100644
--- a/src/Crypto/cpu.h
+++ b/src/Crypto/cpu.h
@@ -207,6 +207,22 @@ extern __m128i _mm_aesdeclast_si128(__m128i v, __m128i rkey);
#endif
#endif
+#if CRYPTOPP_SHANI_AVAILABLE
+#if defined(TC_WINDOWS_DRIVER) || defined (_UEFI)
+#if defined(__cplusplus)
+extern "C" {
+#endif
+extern __m128i __cdecl _mm_sha256msg1_epu32(__m128i, __m128i);
+extern __m128i __cdecl _mm_sha256msg2_epu32(__m128i, __m128i);
+extern __m128i __cdecl _mm_sha256rnds2_epu32(__m128i, __m128i, __m128i);
+#if defined(__cplusplus)
+}
+#endif
+#else
+#include <immintrin.h>
+#endif
+#endif
+
#if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X32 || CRYPTOPP_BOOL_X64
#if defined(__cplusplus)
@@ -234,6 +250,7 @@ extern volatile int g_hasCLMUL;
extern volatile int g_isP4;
extern volatile int g_hasRDRAND;
extern volatile int g_hasRDSEED;
+extern volatile int g_hasSHA256;
extern volatile int g_isIntel;
extern volatile int g_isAMD;
extern volatile uint32 g_cacheLineSize;
@@ -262,6 +279,7 @@ void DisableCPUExtendedFeatures ();
#define IsP4() g_isP4
#define HasRDRAND() g_hasRDRAND
#define HasRDSEED() g_hasRDSEED
+#define HasSHA256() g_hasSHA256
#define IsCpuIntel() g_isIntel
#define IsCpuAMD() g_isAMD
#define GetCacheLineSize() g_cacheLineSize
diff --git a/src/Driver/veracrypt_vs2019.vcxproj b/src/Driver/veracrypt_vs2019.vcxproj
index 8a360525..73c02822 100644
--- a/src/Driver/veracrypt_vs2019.vcxproj
+++ b/src/Driver/veracrypt_vs2019.vcxproj
@@ -89,6 +89,12 @@
<CallingConvention Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StdCall</CallingConvention>
<CallingConvention Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">StdCall</CallingConvention>
</ClCompile>
+ <ClCompile Include="..\Crypto\Sha2Intel.c">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="..\Crypto\Streebog.c" />
<ClCompile Include="..\Crypto\t1ha2.c" />
<ClCompile Include="..\Crypto\t1ha2_selfcheck.c" />
diff --git a/src/Driver/veracrypt_vs2019.vcxproj.filters b/src/Driver/veracrypt_vs2019.vcxproj.filters
index 43a1a222..3d20d21f 100644
--- a/src/Driver/veracrypt_vs2019.vcxproj.filters
+++ b/src/Driver/veracrypt_vs2019.vcxproj.filters
@@ -157,6 +157,9 @@
<ClCompile Include="..\Crypto\blake2s_SSSE3.c">
<Filter>Crypto\Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\Crypto\Sha2Intel.c">
+ <Filter>Crypto\Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DriveFilter.h">
diff --git a/src/Format/Format_vs2019.vcxproj b/src/Format/Format_vs2019.vcxproj
index dc8de14a..26e08d75 100644
--- a/src/Format/Format_vs2019.vcxproj
+++ b/src/Format/Format_vs2019.vcxproj
@@ -242,7 +242,7 @@ copy Debug\VeraCryptFormat.exe "..\Debug\Setup Files\VeraCrypt Format.exe" &gt;N
<DisableSpecificWarnings>4057;4100;4127;4201;4204;4701;4706;4131;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
- <AdditionalDependencies>..\Crypto\ARM64\Debug\crypto.lib;..\Common\ARM64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>..\Crypto\x64\Debug\crypto.lib;..\Common\x64\Debug\Zip.lib;mpr.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)VeraCryptFormat.exe</OutputFile>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
<DelayLoadDLLs>mpr.dll;bcrypt.dll;user32.dll;gdi32.dll;comdlg32.dll;advapi32.dll;shell32.dll;ole32.dll;oleaut32.dll;shlwapi.dll;setupapi.dll;wintrust.dll;comctl32.dll;%(DelayLoadDLLs)</DelayLoadDLLs>
diff --git a/src/Main/CommandLineInterface.cpp b/src/Main/CommandLineInterface.cpp
index 1b4a0c1b..735cbeef 100644
--- a/src/Main/CommandLineInterface.cpp
+++ b/src/Main/CommandLineInterface.cpp
@@ -29,6 +29,7 @@ namespace VeraCrypt
ArgPim (-1),
ArgSize (0),
ArgVolumeType (VolumeType::Unknown),
+ ArgAllowScreencapture (false),
ArgDisableFileSizeCheck (false),
ArgUseLegacyPassword (false),
#if defined(TC_LINUX ) || defined (TC_FREEBSD)
@@ -41,6 +42,9 @@ namespace VeraCrypt
parser.SetSwitchChars (L"-");
+#if defined(TC_WINDOWS) || defined(TC_MACOSX)
+ parser.AddSwitch (L"", L"allow-screencapture", _("Allow window to be included in screenshots and screen captures (Windows/MacOS)"));
+#endif
parser.AddOption (L"", L"auto-mount", _("Auto mount device-hosted/favorite volumes"));
parser.AddSwitch (L"", L"backup-headers", _("Backup volume headers"));
parser.AddSwitch (L"", L"background-task", _("Start Background Task"));
@@ -142,6 +146,11 @@ namespace VeraCrypt
ArgMountOptions = Preferences.DefaultMountOptions;
}
+#if defined(TC_WINDOWS) || defined(TC_MACOSX)
+ ArgAllowScreencapture = parser.Found (L"allow-screencapture");
+#else
+ ArgAllowScreencapture = true; // Protection against screenshots is supported only on Windows and MacOS
+#endif
// Commands
if (parser.Found (L"auto-mount", &str))
{
diff --git a/src/Main/CommandLineInterface.h b/src/Main/CommandLineInterface.h
index 4003dc05..f773ca6f 100644
--- a/src/Main/CommandLineInterface.h
+++ b/src/Main/CommandLineInterface.h
@@ -84,6 +84,7 @@ namespace VeraCrypt
VolumeInfoList ArgVolumes;
VolumeType::Enum ArgVolumeType;
shared_ptr<SecureBuffer> ArgTokenPin;
+ bool ArgAllowScreencapture;
bool ArgDisableFileSizeCheck;
bool ArgUseLegacyPassword;
#if defined(TC_LINUX ) || defined (TC_FREEBSD)
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp
index 6355f139..77f371d8 100644
--- a/src/Main/Forms/MainFrame.cpp
+++ b/src/Main/Forms/MainFrame.cpp
@@ -84,6 +84,7 @@ namespace VeraCrypt
InitTaskBarIcon();
InitEvents();
InitMessageFilter();
+ InitWindowPrivacy();
if (!GetPreferences().SecurityTokenModule.IsEmpty() && !SecurityToken::IsInitialized())
{
@@ -470,6 +471,12 @@ namespace VeraCrypt
#endif
}
+
+ void MainFrame::InitWindowPrivacy ()
+ {
+ Gui->SetContentProtection(!CmdLine->ArgAllowScreencapture);
+ }
+
void MainFrame::InitPreferences ()
{
try
diff --git a/src/Main/Forms/MainFrame.h b/src/Main/Forms/MainFrame.h
index ab70eae3..ed1c44f7 100644
--- a/src/Main/Forms/MainFrame.h
+++ b/src/Main/Forms/MainFrame.h
@@ -84,6 +84,7 @@ namespace VeraCrypt
void InitMessageFilter ();
void InitPreferences ();
void InitTaskBarIcon ();
+ void InitWindowPrivacy();
bool IsFreeSlotSelected () const { return SlotListCtrl->GetSelectedItemCount() == 1 && Gui->GetListCtrlSubItemText (SlotListCtrl, SelectedItemIndex, ColumnPath).empty(); }
bool IsMountedSlotSelected () const { return SlotListCtrl->GetSelectedItemCount() == 1 && !Gui->GetListCtrlSubItemText (SlotListCtrl, SelectedItemIndex, ColumnPath).empty(); }
void LoadFavoriteVolumes ();
diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp
index 41bfa100..1cb62671 100644
--- a/src/Main/GraphicUserInterface.cpp
+++ b/src/Main/GraphicUserInterface.cpp
@@ -1874,6 +1874,14 @@ namespace VeraCrypt
listCtrl->SetMinSize (wxSize (width, listCtrl->GetMinSize().GetHeight()));
}
+
+ void GraphicUserInterface::SetContentProtection (bool enable) const
+ {
+#if defined(TC_WINDOWS) || defined(TC_MACOSX)
+ GetActiveWindow()->SetContentProtection(enable ? wxCONTENT_PROTECTION_ENABLED : wxCONTENT_PROTECTION_NONE);
+#endif
+ }
+
void GraphicUserInterface::ShowErrorTopMost (const wxString &message) const
{
ShowMessage (message, wxOK | wxICON_ERROR, true);
diff --git a/src/Main/GraphicUserInterface.h b/src/Main/GraphicUserInterface.h
index d48b7973..d333551c 100644
--- a/src/Main/GraphicUserInterface.h
+++ b/src/Main/GraphicUserInterface.h
@@ -86,6 +86,7 @@ namespace VeraCrypt
virtual void SetListCtrlColumnWidths (wxListCtrl *listCtrl, list <int> columnWidthPermilles, bool hasVerticalScrollbar = true) const;
virtual void SetListCtrlHeight (wxListCtrl *listCtrl, size_t rowCount) const;
virtual void SetListCtrlWidth (wxListCtrl *listCtrl, size_t charCount, bool hasVerticalScrollbar = true) const;
+ virtual void SetContentProtection(bool enable) const;
virtual void ShowErrorTopMost (char *langStringId) const { ShowErrorTopMost (LangString[langStringId]); }
virtual void ShowErrorTopMost (const wxString &message) const;
virtual void ShowInfoTopMost (char *langStringId) const { ShowInfoTopMost (LangString[langStringId]); }
diff --git a/src/Main/UserInterface.cpp b/src/Main/UserInterface.cpp
index ad2f22b8..b216101a 100644
--- a/src/Main/UserInterface.cpp
+++ b/src/Main/UserInterface.cpp
@@ -873,6 +873,14 @@ namespace VeraCrypt
ShowWarning (e.mException);
}
+#if !defined(TC_WINDOWS) && !defined(TC_MACOSX)
+// Function to check if a given executable exists and is executable
+static bool IsExecutable(const string& exe) {
+ return wxFileName::IsFileExecutable("/usr/bin/" + exe) ||
+ wxFileName::IsFileExecutable("/usr/local/bin/" + exe);
+}
+#endif
+
void UserInterface::OpenExplorerWindow (const DirectoryPath &path)
{
if (path.IsEmpty())
@@ -897,60 +905,58 @@ namespace VeraCrypt
catch (exception &e) { ShowError (e); }
#else
- // MIME handler for directory seems to be unavailable through wxWidgets
- wxString desktop = GetTraits()->GetDesktopEnvironment();
- bool xdgOpenPresent = wxFileName::IsFileExecutable (wxT("/usr/bin/xdg-open")) || wxFileName::IsFileExecutable (wxT("/usr/local/bin/xdg-open"));
- bool nautilusPresent = wxFileName::IsFileExecutable (wxT("/usr/bin/nautilus")) || wxFileName::IsFileExecutable (wxT("/usr/local/bin/nautilus"));
-
- if (desktop == L"GNOME" || (desktop.empty() && !xdgOpenPresent && nautilusPresent))
- {
- // args.push_back ("--no-default-window"); // This option causes nautilus not to launch under FreeBSD 11
- args.push_back ("--no-desktop");
- args.push_back (string (path));
- try
- {
- Process::Execute ("nautilus", args, 2000);
+ string directoryPath = string(path);
+ // Primary attempt: Use xdg-open
+ if (IsExecutable("xdg-open")) {
+ try {
+ args.push_back(directoryPath);
+ Process::Execute("xdg-open", args, 2000);
+ return;
}
catch (TimeOut&) { }
- catch (exception &e) { ShowError (e); }
+ catch (exception&) {}
}
- else if (desktop == L"KDE")
- {
- try
- {
- args.push_back (string (path));
- Process::Execute ("dolphin", args, 2000);
- }
- catch (TimeOut&) { }
- catch (exception&)
- {
+
+ // Fallback attempts: Try known file managers
+ const char* fallbackFileManagers[] = { "gio", "kioclient5", "kfmclient", "exo-open", "nautilus", "dolphin", "caja", "thunar", "pcmanfm" };
+ const size_t numFileManagers = sizeof(fallbackFileManagers) / sizeof(fallbackFileManagers[0]);
+
+ for (size_t i = 0; i < numFileManagers; ++i) {
+ const char* fm = fallbackFileManagers[i];
+ if (IsExecutable(fm)) {
args.clear();
- args.push_back ("openURL");
- args.push_back (string (path));
- try
- {
- Process::Execute ("kfmclient", args, 2000);
+ if (strcmp(fm, "gio") == 0) {
+ args.push_back("open");
+ args.push_back(directoryPath);
+ }
+ else if (strcmp(fm, "kioclient5") == 0) {
+ args.push_back("exec");
+ args.push_back(directoryPath);
+ }
+ else if (strcmp(fm, "kfmclient") == 0) {
+ args.push_back("openURL");
+ args.push_back(directoryPath);
+ }
+ else if (strcmp(fm, "exo-open") == 0) {
+ args.push_back("--launch");
+ args.push_back("FileManager");
+ args.push_back(directoryPath);
+ }
+ else {
+ args.push_back(directoryPath);
+ }
+
+ try {
+ Process::Execute(fm, args, 2000);
+ return; // Success
}
catch (TimeOut&) { }
- catch (exception &e) { ShowError (e); }
- }
- }
- else if (xdgOpenPresent)
- {
- // Fallback on the standard xdg-open command
- // which is not always available by default
- args.push_back (string (path));
- try
- {
- Process::Execute ("xdg-open", args, 2000);
+ catch (exception &) {}
}
- catch (TimeOut&) { }
- catch (exception &e) { ShowError (e); }
- }
- else
- {
- ShowWarning (wxT("Unable to find a file manager to open the mounted volume"));
}
+
+ ShowWarning(wxT("Unable to find a file manager to open the mounted volume.\n"
+ "Please install xdg-utils or set a default file manager."));
#endif
}
diff --git a/src/Makefile b/src/Makefile
index 15af9c6c..849687bc 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -148,6 +148,7 @@ export ENABLE_WOLFCRYPT ?= 0
export GCC_GTEQ_440 := 0
export GCC_GTEQ_430 := 0
+export GCC_GTEQ_500 := 0
export GTK_VERSION := 0
ARCH ?= $(shell uname -m)
@@ -232,6 +233,7 @@ ifeq "$(shell uname -s)" "Linux"
GCC_GTEQ_440 := $(shell expr `$(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 40400)
GCC_GTEQ_430 := $(shell expr `$(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 40300)
+ GCC_GTEQ_500 := $(shell expr `$(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/' -e 's/^[0-9]\{1,2\}$$/&0000/'` \>= 50000)
ifeq "$(DISABLE_AESNI)" "1"
CFLAGS += -mno-aes -DCRYPTOPP_DISABLE_AESNI
@@ -315,6 +317,7 @@ $(error Specified SDK version was not found, ensure your active developer direct
CXX := g++
GCC_GTEQ_430 := 1
+ GCC_GTEQ_500 := 1
CXXFLAGS += -std=c++11
C_CXX_FLAGS += -DTC_UNIX -DTC_BSD -DTC_MACOSX -mmacosx-version-min=$(VC_OSX_TARGET) -isysroot $(VC_OSX_SDK_PATH)
@@ -419,6 +422,7 @@ ifeq "$(shell uname -s)" "FreeBSD"
CXX := c++
GCC_GTEQ_430 := 1
+ GCC_GTEQ_500 := 1
ifeq "$(TC_BUILD_CONFIG)" "Release"
C_CXX_FLAGS += -fdata-sections -ffunction-sections -fpie
@@ -480,6 +484,7 @@ ifeq "$(shell uname -s)" "OpenBSD"
CXX := c++
GCC_GTEQ_430 := 1
+ GCC_GTEQ_500 := 1
ifeq "$(TC_BUILD_CONFIG)" "Release"
C_CXX_FLAGS += -fdata-sections -ffunction-sections -fpie
diff --git a/src/VeraCrypt_vs2019.sln b/src/VeraCrypt_vs2019.sln
index e8d70246..73def793 100644
--- a/src/VeraCrypt_vs2019.sln
+++ b/src/VeraCrypt_vs2019.sln
@@ -57,6 +57,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "COMReg", "COMReg\COMReg_vs2019.vcxproj", "{C8914211-32AC-4F48-ACD9-8212E8DE53F3}"
ProjectSection(ProjectDependencies) = postProject
{B896FE1F-6BF3-4F75-9148-F841829073D9} = {B896FE1F-6BF3-4F75-9148-F841829073D9}
+ {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC} = {6316EE71-0210-4CA4-BCC7-CFB7A3C090FC}
EndProjectSection
EndProject
Global
diff --git a/src/Volume/Volume.make b/src/Volume/Volume.make
index 708f28c5..52d212eb 100644
--- a/src/Volume/Volume.make
+++ b/src/Volume/Volume.make
@@ -13,6 +13,9 @@
OBJS :=
OBJSEX :=
OBJSNOOPT :=
+OBJSSSE41 :=
+OBJSSSSE3 :=
+OBJSHANI :=
OBJS += Cipher.o
OBJS += EncryptionAlgorithm.o
OBJS += EncryptionMode.o
@@ -86,6 +89,11 @@ else
OBJS += ../Crypto/blake2s_SSE41.o
OBJS += ../Crypto/blake2s_SSSE3.o
endif
+ifeq "$(GCC_GTEQ_500)" "1"
+ OBJSHANI += ../Crypto/Sha2Intel.oshani
+else
+ OBJS += ../Crypto/Sha2Intel.o
+endif
else
OBJS += ../Crypto/wolfCrypt.o
endif