Commit Graph

268 Commits

Author SHA1 Message Date
Jertzukka 114624b3a5
Prepare for changes in wxWidgets 3.3 (#1343)
* Move from deprecated wxScopedPtr to std::unique_ptr
wxScopedPtr was included previously through some header hierarchy which as of 3.3 is
no longer the case causing it to break. But instead of including a header for a deprecated
function explicitly, just move to std::unique_ptr as recommended by upstream.

* Convert to explicit conversions from wxString
As of 35c35c235e
wxWidgets defaults to STL classes, which has a side-effect that
some implicit conversions break. This patch converts those conversions
to explicit in anticipation of wxWidgets 3.3 release.
2024-05-18 03:46:39 +02:00
Jertzukka 55c3a8dc58
Fix incorrect max hidden volume size for file containers on CLI (#1338)
Currently the maximum hidden volume size for file containers is
limited by available free space on the device the file container
resides on, which we do not care about. This commit changes so
that only Normal volumes get their `maxVolumeSize` limited by
`AvailableDiskSpace`. Also the --size=max parameter is restricted
from hidden volume creation as there is no way to determine a good
size as we do not mount the outer volume through the CLI process
flow to determine available free space on the outer volume.
2024-05-08 19:00:09 +02:00
Jertzukka f846a808d1
Correct exceptions to match the correct language strings (#1299)
Fixes the order of the language strings to match the correct
exceptions.
2024-04-10 17:58:37 +02:00
Jertzukka dc8d8ce404
Unix CLI: Don't initially re-ask PIM if it was already specified (#1288)
We don't need to reset PIM in PasswordException as it is immediately
fell back to if PIM is specified in text mode, but password is not.
This causes an exception that resets the PIM when it shouldn't.
2024-04-10 10:44:01 +02:00
Jertzukka 801c3ab966
Linux: Allows GUI to launch in a Wayland-only environment (#1264)
Currently we check whether the system has DISPLAY environment variable
set, which is the case in a system that uses X11 natively or XWayland.
This variable is not set in a system with only Wayland, so we need to
also check whether WAYLAND_DISPLAY is set.

Fixes: #184
2023-12-11 09:11:07 +01:00
Jertzukka ff93a6021f
macOS: Fix near zero width PIM input box and simplify wxTextValidator logic (#1274)
* macOS: Fix issue where PIM box has no width in Wizard
VolumePimTextCtrl has a problem with width on macOS which
we can fix by adjusting the proportions of the elements
inside the PimSizer, which seems like a better solution than
using a forced minimum size in pixels.

Adjacent, simplifies the validator logic for digits in PIM field.

Fixes #1219
2023-12-11 09:06:33 +01:00
Jertzukka 6a1780864c
Linux/FreeBSD/macOS: Implement language selection settings (#1253)
* Implement Language selection into settings
Initial commit to create a new tab in PreferencesNotebook for
Language selection. By default, if nothing is chosen, it uses the
current behaviour of using the language from system environment
variables. If another language is chosen from the settings, it is
saved into the Configuration.xml and this is used instead.

* Fix SetStringSelection() assert issue on macOS

* Add header include to fix build

* Add current language pack, authors and way to use literal strings

* Translations also for FreeBSD

* Minimal GTK3 WX build on FreeBSD requires wxGraphicsContext

* Get Preferences properly instead of workaround function

* Use WrapSizer instead of BoxSizer for author line
This forces long author lists to be put on a new line, reducing
the need to increase window width.

* Update Finnish translation

* Borrow translation from IDM_LANGUAGE where it makes sense

* Remove colon and thus unneeded function

* Simplify Language tab layout

* Reintroduce macOS specific fixes to Forms.cpp

* cleanup
2023-11-19 00:31:40 +01:00
lealem47 9247ce1bb9
wolfCrypt as crypto backend for VeraCrypt (#1227)
* wolfCrypt as crypto backend for VeraCrypt

* Refactor to use EncryptionModeWolfCryptXTS class
2023-11-13 00:51:31 +01:00
Jertzukka 91b47deb0e
Linux: Focus PIM field when selected (#1239)
Sets focus to VolumePimTextCtrl initially when the checkbox is clicked.
2023-10-31 00:08:41 +01:00
kovalev0 847abb23f0
Fix warnings and throwing an exception instead of ignoring the error (#1229)
* EMVCard.cpp: ArrayToHexWideString: prohibit conversion of a string constant

../Common/EMVCard.cpp: In function 'std::wstring VeraCrypt::ArrayToHexWideString(con
st unsigned char*, size_t)':
../Common/EMVCard.cpp:28:43: warning: ISO C++ forbids converting a string constant
to 'wchar_t*' [-Wwrite-strings]
   28 |                 static wchar_t* hexChar = L"0123456789ABCDEF";
      |                                           ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>

* EMVCard.cpp: ArrayToHexWideString: fix of the comparison of different types

../Common/EMVCard.cpp: In function 'std::wstring VeraCrypt::ArrayToHexWideString(con
st unsigned char*, size_t)':
../Common/EMVCard.cpp:32:43: warning: comparison of integer expressions of different
 signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
   32 |                         for (int i = 0; i < cbData; i++)
      |                                         ~~^~~~~~~~

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>

* SecurityTokenKeyfilesDialog.cpp: removed initialization of an unused variable

Forms/SecurityTokenKeyfilesDialog.cpp:58:24: warning: unused variable 'i' [-Wunused-
variable]
   58 |                 size_t i = 0;
      |                        ^

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>

* Core/Unix: throwing an exception instead of ignoring the error

Fixes: 5a6b445f ("fix warnings and UB (#1164)")
Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>

---------

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
Co-authored-by: Vasiliy Kovalev <kovalev@altlinux.org>
2023-10-08 15:36:15 +02:00
Mounir IDRASSI 42857b4930
Update various copyright dates 2023-10-05 09:07:35 +02:00
sardanap 01b49a2017
fix for corrupted icons (#1226) 2023-10-05 00:08:07 +02:00
Mounir IDRASSI 8eb232a4a3
MacOS: set minimum target to OSX 12. Fix About menu not working.
The modification to Forms.cpp is temporary until we find a better
approach
2023-10-01 18:51:20 +02:00
Mounir IDRASSI 14fee0da1a
Linux/macOS: preserve unknown entries in configuration file
This helps to preserve unknown entries that may be used by future
versions of VeraCrypt (forward compatibility) or entries used by old
versions that were removed from current version (backward compatibility)
2023-09-02 01:37:52 +02:00
Unit 193 d49c75370a
Allow cross compilation. (#1182) 2023-08-21 11:24:25 +02:00
Mounir IDRASSI 9d8afdad93
Linux: Fix wrong max size for hidden volume in CLI direct mode creation
There was a logical bug that made the code check the filesystem size of
the device path "/dev" instead of using the actual size of the device

Fix #1180
2023-08-19 20:44:32 +02:00
Jertzukka eb2f5f33c9
Linux: Flush stdout explicitly when reading stdin (#1172)
Rules of automatic flushing of stdout buffer is implementation-defined
behaviour. In glibc this is automatically flushed, but we can't rely
on it for other implementations such as musl.
2023-08-12 09:18:57 +02:00
Jertzukka 5c9e135c9e
Linux: Typo fix and consistency in help command (#1169) 2023-08-12 09:17:18 +02:00
Deniz Türkoglu 8f3082c3ef
Call EnsureVisible() for OSX in OnActivate (#1167)
When using multiple monitors, the resolution can change in OSX,
during plug-in/off off the display(s). To avoid window becoming
non-usable, there is EnsureVisible, that is called in several
places.

However, if you minimize VeraCrypt on the bigger screen, and
restore it in the main screen of a MacBook, after unplugging, the
window will become unusable (unless you know that clicking 'About'
calls EnsureVisible :-)).

Call EnsureVisible OnActivate so MainFrame is always functional
across screens, even when minimized.
2023-08-07 22:53:19 +02:00
kovalev0 5a6b445f0e
fix warnings and UB (#1164)
* Crypto: fix warning mismatched bound

../Crypto/cpu.c:67:32: warning: argument 2 of type 'uint32[4]'
{aka 'unsigned int[4]'} with mismatched bound [-Warray-parameter=]
   67 | int CpuId(uint32 input, uint32 output[4])
      |                         ~~~~~~~^~~~~~~~~
In file included from ../Crypto/cpu.c:3:
../Crypto/cpu.h:236:33: note: previously declared as 'uint32 *'
{aka 'unsigned int *'}
  236 | int CpuId(uint32 input, uint32 *output);

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>

* Core/Unix: fix warning ignoring return value

Unix/CoreUnix.cpp: In member function 'virtual std::shared_ptr<VeraCrypt:\
:VolumeInfo> VeraCrypt::CoreUnix::MountVolume(VeraCrypt::MountOptions&)':
Unix/CoreUnix.cpp:682:55: warning: ignoring return value of
'int chown(const char*, __uid_t, __gid_t)' declared with attribute
'warn_unused_result' [-Wunused-result]
  682 |     chown (mountPoint.c_str(), GetRealUserId(), GetRealGroupId());
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>

* Main/Forms: fix warning cast to pointer from integer of different size

Forms/MainFrame.cpp: In member function 'void VeraCrypt::MainFrame:\
:UpdateVolumeList()':

Forms/MainFrame.cpp:1718:106: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
 1718 |       Gui->InsertToListCtrl (SlotListCtrl, ++prevItemIndex,
        fields, 0, (void *) volume->SlotNumber);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~

Forms/MainFrame.cpp:1753:114: warning: cast to pointer from integer of
different size [-Wint-to-pointer-cast]
 1753 |       Gui->InsertToListCtrl (SlotListCtrl, ++prevItemIndex,
        fields, 0, (void *) slotNumber);
      |            ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>

* Crypto: fix undefined behavior signed integer overflow

In function 'twofish_set_key':
cc1: warning: iteration 4 invokes undefined behavior
[-Waggressive-loop-optimizations]
../Crypto/Twofish.c:626:23: note: within this loop
  626 |         for (i = 0; i != 40; i += 2)
      |                     ~~^~~~~

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>

---------

Signed-off-by: Vasiliy Kovalev <kovalev@altlinux.org>
Co-authored-by: Vasiliy Kovalev <kovalev@altlinux.org>
2023-08-04 23:49:11 +02:00
Mounir IDRASSI 3f976c24d2
Linux/macOS: Remove TrueCrypt support 2023-07-24 08:48:52 +02:00
Mounir IDRASSI ba74b9d5b8
Linux/macOS:Add EMV option checkbox to the fbp file. Remove TrueCrypt checkboxes.
We also update to wxFormBuilder 3.10.1
2023-07-23 21:45:16 +02:00
Springfield Data Recovery f037dae413
Update UserInterface.cpp (#1155)
Docs specify cascading encryption should be specified as "AES(Twofish)" but on Linux it requires "AES-Twofish".
2023-07-23 09:13:03 +02:00
Jertzukka 232d3290b0
Linux: Overwriting file container allows you to use its space (#1147)
When replacing a file container, we increase the `diskSpace`
by the file container's size. This doesn't affect the hidden volume
space logic, as in that case we use `MaxVolumeSize` when
`MaxVolumeSizeValid` is true instead of `AvailableDiskSpace`.
2023-07-05 19:00:37 +09:00
Mounir IDRASSI df62c0227c
Linux: Fix wrong size for hidden volume when selecting the option to use all free space (fix by @Jertzukka) 2023-06-29 23:24:47 +02:00
Mounir IDRASSI 417ff5564e
Linux/FreeBSD: Make pcsclite a dependency of the packages and the generic installer 2023-06-29 23:15:03 +02:00
Mounir IDRASSI 034b64f415
EMV keyfile support: Overall code improvements and bug fixes 2023-06-29 00:06:20 +02:00
mmauv 502ab9112a
Add EMV functionality (#1080)
* Add basic strcture needed for EMV implementation

* Add demo EMV functionality with C code pasted in a very dirty and unsafe way. NOT FINAL

* Refactor IccExtractor Structure

* Fix Makefile

* fix include file

* move global variables from h to c

* revert to memcpy

* fix icc data recovery functions

* Add EMV functionalities on windows

* Make EMVToken structures like SecurityToken

* Define constants instead of hard coded values

* Token structures created with inheritance

* refactor TokenKeyfile to use inherit. + polymor.

* add Token.h + Token.cpp in modules in VS2010

* Add a comment at each use of SecurityToken class or objects

* SecurityTokenKeyfilesDialog preparation

* Implemennt GetAvailableTokens in Token class on windows

* merge

* up (patching for Windows)

* foreach Token.cpp corrected

* Display EMV keyfiles on first window in graphic interface

* Add token to Windows UI

* EMVToken selection on OKButton on Linux

* Keyfile.cpp optimization

* Move getKeyfileData in the token class

* EMV::Token GetAvailableKeyfiles() base

* Move getKeyfileData in the token class on unix

* Remove test comments

* Warnings resolved

* RemoveeSecurityTokenLibraryNotInitialized exception if at least one emv token is detected

* Adding new files

* Remove old files and add the new version to the windows project

* Change make_shared to shared_ptr constructor

* IccExtractor integration working on linux

* Throwing card not EMV execption

* catch error when not EMV type in EMVToken::GetAvailableKeyfiles

* Change types to compile on windows

* list all keyfiles, security keyfiles and emv keyfiles in command line

* Change type to be coherent and remove old todo comments

* Remove todo comments

* Change indentation and resolve a bug from previous commit

* Use polymorphism for GetKeyfileData and add export option for EMVTokens on Linux

* Linux : Allow to export EMV Tokens in command lines, Windows : Disable the delete button when EMV Keyfiles are selected

* Remove SlotId from TokenInfo as it is already in Token

* Correct errors on Linux

* Disable delete option if one EMV Token is selected on Linux

* Fix bug enabling delete button if nothing is selected

* emv data used as reference then burnt

* use of normal files in linux corrected

* help updated

* help updated for export functionnality

* option EMV added to graphic interface but not yet working

* Bug fix : Allow to use multiple EMV on windows

* EMV Option added to UserPreferences

* EMV Option working for Linux

* EMV option added to Windows (not working yet)

* [NOT TESTED] EMV option for Windows

* Working EMV option on Windows

* EMV Option for data extraction working for volume creation

* EMV Option for data extraction working for Mount

* EMV Option for data extraction working for mounting favorites volumes

* EMV Option for extraction working for Changing volume password, Set Derivation Key Algorithm and Add or remove keyfile from volume

* Windows : re-checking EMV Option when getting data

* Removing error catches in the IccDataExtractor classe (It only throws error now). Changing GetPan signature to resemble the other functions signatures more

* Changing EMV errors

- Only throwing ICCExtractionException from outside of the ICC module.
- Catching all TLVExceptions and PCSCExceptions to throw the right ICCExtractionException

- Deleting APDU exceptions.

* First version of the documentation

* Adding function pointers for winscard library (but it crashes VeraCrypt)

* Debugging function pointers

* The import of the library on windows work as expected now

* Reverting EMVToken.cpp changes used to test to library import

* Searching for the System32 path instead of hard codding it

* Fixing the bug were VeraCrypt crashes if there is no readers when  "add Token files" is clicked

* Winscard library not initialized in object constructor anymore to delay it after EMVOption check

* Remove winscard lib from windows dependencies

* Properly displaying errors

* Adding a dot in Language.xml

* Catching TLVException

* Removing unused code

* Remove unusefull comments

* Trying to fix 0x1f error

* Update IccDataExtractor.cpp

* Delete History.xml

* Fix get data without get pan

* Cleanup code

* changes for linux compilation but linking not working

* error handling for linux

* erasing emv data

* Burn PAN

* Burn PAN from memory

* Uncomment selfcheck before merging master

* burn corrected

* EMV errors handling for Linux

* EMV working for Linux CLI

* Doc : Winscard Linux package and VeraCrypt versions

---------

Co-authored-by: doriandu45 <d45.poubelle@gmail.com>
Co-authored-by: red4game <redemgaiming@gmail.com>
Co-authored-by: Brice.Namy <brice.namy@insa-rennes.fr>
Co-authored-by: vocthor <pieceo108@gmail.com>
Co-authored-by: vocthor <67202139+vocthor@users.noreply.github.com>
Co-authored-by: Andrei COCAN <andrei.cocan@insa-rennes.fr>
Co-authored-by: AndreiCocan <95496161+AndreiCocan@users.noreply.github.com>
Co-authored-by: francoisLEROUX <francois3443@gmail.com>
2023-06-28 22:51:43 +02:00
Mounir IDRASSI 36a055f669
Linux/macOS: only wipe password/PIM text controls if they are not empty
This fixes a crash on macOS with latest wxWidgets 3.2.2.1 where
GetLineLength returns -1
2023-06-14 00:31:46 +02:00
Mounir IDRASSI 440df02355
Linux: Fix compatibility of generic installers with old Linux distros
In old Linux distributions, tar command doesn't support
"--keep-directory-symlink" so we now dynamically detect if this switch
is support and then we use it if it is available
2023-06-13 23:34:04 +02:00
Mounir IDRASSI b25ebeb7b4
Linux/macOS: Fix error during creation of installation package
"-R" switch was missing from the "cp" command
2023-06-05 22:46:20 +02:00
Jertzukka 6ced991d98
Fix issues launching fsck via terminal on Linux (#1086)
Currently on a system without xterm or konsole (like fresh
Ubuntu install) the fsck check will not launch. Added
gnome-terminal as an alternative and fixed an issue where
konsole will always error out as --title and --caption are
no longer valid arguments.

Previously the error message was simply "xterm not found", so
new LangString LINUX_EX2MSG_TERMINALNOTFOUND was added to let the
user knows which programs they need to get the feature working.
2023-06-01 09:01:53 +02:00
Jertzukka 4e5529bee0
Prevent failing fs options being shown in --text --create (#1078)
Removes the options exFAT and Btrfs being shown when creating a
volume in text mode when the system does not support them and will
end up erroring out at the end. Hide Btrfs option when the volume
is too small, as we will anyways fail right after.

Hardcoded numbering changed to dynamic as the available options
are not necessarily consecutive.
2023-05-27 18:08:51 +02:00
Mounir IDRASSI b872702309
Linux: Fix printing error when checking freespace during volume creation
No parent directory specified in the path, we assume current directory
We first check if parent directory exists before checking its free space
using wxgetDiskSpace

Based on idea proposed by @bogdro in PR#1025
2023-05-22 01:05:17 +02:00
Mounir IDRASSI eb61010ce2
Linux/macOS: Better handling of wrong PIM value in text mode (enhances PR#1026) 2023-05-21 17:27:33 +02:00
Bogdan Drozdowski b05b18928f
Keep PIM secret and re-ask when user entered a wrong value (#1026)
Co-authored-by: Bogdan Drozdowski <>
2023-05-21 17:21:21 +02:00
Es e59581918f
wxWidget assert failure bug (#999)
* Removal of any of the any of `wxALIGN_RIGHT`/`wxALIGN_CENTRE_HORIZONTAL`/`wxALIGN_BOTTOM`/`wxALIGN_CENTRE_VERTICAL` when used in conjunction with `wxEXPAND`

wxWidget has an "assert" that gets triggered anytime `wxEXPAND` gets used with an alignment property (useless override). This leads to a popup backtrace everytime a non-compliant widget is opened.

* Removal of missed `wxALIGN_RIGHT`/`wxALIGN_CENTRE_HORIZONTAL`/`wxALIGN_BOTTOM`/`wxALIGN_CENTRE_VERTICAL` when used in conjunction with `wxEXPAND`

* Removed property 'label' for wxMenuBar as no longer used (wxFormBuilder)

* Removed redundant 'wxALIGN_RIGHT' for the "OK" button in the preference panel (there is a spacer already in-place that pushes the buttons to the right)

* Removed redundant 'wxALIGN_RIGHT' for items in the wizard panel's (`WizardFrameBase`) button bar and added width spacing for the 2 spacers between the buttons to make up for the change.

* Changed constructor signature for the `WizardPage` and all subclasses

 The addition of the wxString 'name' arg brings it inline with the new wxFromBuilder v3.10.1 output so that editing+generating the forms from it won't brake the build now.

* Removed remaining redundant 'wxALIGN_*' that were paired with 'wxEXPAND'.

* Added missing default flags to wxFileName::Normalize(..) method

The old empty initialization which was fine up to v2.8.12 of wxWidget gives off a compile warning. Since the default `wxPATH_NORM_ALL` is now depreciated (v3.x) the equivalent individual flags must be explicitly given.

* Changed spaces to tabs to bring last commit inline with the rest of the src code
2023-05-19 00:44:13 +02:00
Jertzukka 8072207eb6
Add a new LangString 'LINUX_VOL_MOUNTED' to show when volume mounted. Fixes (#1029)
the issue of 'LINUX_VOL_DISMOUNTED' being shown even when not dismounting.
2023-05-18 22:59:36 +02:00
Mounir IDRASSI 8e443c25cc
Linux/macOS: Suppress asserts displayed by wxWidgets 3.1.6+ for sizer flags until we fix all sizer flags in our UI. 2023-05-18 21:25:07 +02:00
Kenneth Chew a23d4392fb
Fix incorrect text color in dark mode (#920) 2022-08-21 17:58:08 +02:00
Mounir IDRASSI c145b337cb
Linux/MacOSX: Fix hidden volume settings not correctly displayed when enabling hidden volume protection in mount options window 2022-02-19 22:35:34 +01:00
Mounir IDRASSI b1ae5f4740
Update copyrights following integration of LZMA SDK 2022-02-11 00:37:25 +01:00
Mounir IDRASSI abfef8821d
MacOSX: remove write permission also from group on application bundle 2022-01-08 11:08:47 +01:00
Mounir IDRASSI ce733d547e
Update copyright year to 2022 2022-01-02 21:52:23 +01:00
Mounir IDRASSI 68131ac91b
MacOSX: correct permission of VeraCrypt application bundle during packaging 2021-12-24 23:57:27 +01:00
Mounir IDRASSI 43cf5d7b53
Linux/macOS/FreeBSD: return error if unknown filesystem value specified in --filesystem switch 2021-11-21 21:45:09 +01:00
Mounir IDRASSI 491fed3494
Linux/FreeBSD: Fix calling "make install" without specifying DESTDIR, which should work by installing into /usr 2021-11-21 21:45:01 +01:00
Mounir IDRASSI 5e547b127f
Linux/macOS: Add CLI switch (--size=max) and UI option to give a file container all available free space.
This commit also makes --size switch accept KiB/MiB/GiB/TiB prefixes and adds TiB choice in UI.
2021-09-21 01:41:25 +02:00
a1346054 32052f214b
Minor cleanup of the repo (#822)
* *: source files should not be executable

* *: make sure files have final newline

* *: remove BOM from text files

* translations: unify headers

* *: fix typos

* *: trim excess whitespace
2021-09-04 21:59:25 +02:00
Mounir IDRASSI 2216f739c4
Update copyright year to 2021 2021-08-30 00:26:11 +02:00