VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms
AgeCommit message (Collapse)AuthorFilesLines
2016-06-02Crypto: Add support for Japanese encryption standard Camellia, including for ↵Mounir IDRASSI1-0/+2
system encryption.
2016-05-13Linux: Fix gcc-6 compilation errors.Mounir IDRASSI1-2/+2
2016-05-10Remove trailing whitespaceDavid Foerster66-1732/+1732
2016-05-10Normalize all line terminatorsDavid Foerster3-33360/+33360
2016-05-04Windows/Linux/MacOSX: Set maximum PIM value to 2147468 in order to avoid ↵Mounir IDRASSI5-9/+11
having negative values for iterations count using the formula 15000 + (PIM x 1000). Add specific error message to XML language files.
2016-05-01Reset bogus executable permissionsDavid Foerster5-0/+0
2016-02-09Linux/MacOSX: add progress bar for mouse collected entropy in GUI of volume ↵Mounir IDRASSI10-21/+146
creation wizard. Add mutex protection in ev
/*
 Derived from source code of TrueCrypt 7.1a, which is
 Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
 by the TrueCrypt License 3.0.

 Modifications and additions to the original source code (contained in this file)
 and all other portions of this file are Copyright (c) 2013-2017 IDRIX
 and are governed by the Apache License 2.0 the full text of which is
 contained in the file License.txt included in VeraCrypt binary and source
 code distribution packages.
*/

#ifndef TC_HEADER_Platform_Exception
#define TC_HEADER_Platform_Exception

#include <exception>
#include "PlatformBase.h"
#include "Serializable.h"

namespace VeraCrypt
{
#define TC_SERIALIZABLE_EXCEPTION(TYPE) TC_SERIALIZABLE (TYPE); \
	virtual Exception *CloneNew () { return new TYPE (*this); } \
	virtual void Throw () const { throw *this; }

	struct Exception : public exception, public Serializable
	{
	public:
		Exception () { }
		Exception (const string &message) : Message (message) { }
		Exception (const string &message, const wstring &subject) : Message (message), Subject (subject) { }
		virtual ~Exception () throw () { }

		TC_SERIALIZABLE_EXCEPTION (Exception);

		virtual const char *what () const throw () { return Message.c_str(); }
		virtual const wstring &GetSubject() const { return Subject; }

	protected:
		string Message;
		wstring Subject;
	};

	struct ExecutedProcessFailed : public Exception
	{
		ExecutedProcessFailed () { }
		ExecutedProcessFailed (const string &message, const string &command, int exitCode, const string &errorOutput)
			: Exception (message), Command (command), ExitCode (exitCode), ErrorOutput (errorOutput) { }
		virtual ~ExecutedProcessFailed () throw () { }

		TC_SERIALIZABLE_EXCEPTION (ExecutedProcessFailed);

		string GetCommand () const { return Command; }
		int64 GetExitCode () const { return ExitCode; }
		string GetErrorOutput () const { return ErrorOutput; }

	protected:
		string Command;
		int64 ExitCode;
		string ErrorOutput;
	};

#define TC_EXCEPTION_DECL(NAME,BASE) \
	struct NAME  : public BASE \
	{ \
		NAME () { } \
		NAME (const string &message) : BASE (message) { } \
		NAME (const string &message, const wstring &subject) : BASE (message, subject) { } \
		virtual Exception *CloneNew () { return new NAME (*this); } \
		static Serializable *GetNewSerializable () { return new NAME (); } \
		virtual void Throw () const { throw *this; } \
	}

#define TC_EXCEPTION_NODECL(dummy) //
#define TC_EXCEPTION(NAME) TC_EXCEPTION_DECL(NAME,Exception)

#ifdef TC_EXCEPTION_SET
#undef TC_EXCEPTION_SET
#endif
#define TC_EXCEPTION_SET \
	TC_EXCEPTION_NODECL (Exception); \
	TC_EXCEPTION_NODECL (ExecutedProcessFailed); \
	TC_EXCEPTION (AlreadyInitialized); \
	TC_EXCEPTION (AssertionFailed); \
	TC_EXCEPTION (DeviceSectorSizeMismatch); \
	TC_EXCEPTION (ExternalException); \
	TC_EXCEPTION (InsufficientData); \
	TC_EXCEPTION (NotApplicable); \
	TC_EXCEPTION (NotImplemented); \
	TC_EXCEPTION (NotInitialized); \
	TC_EXCEPTION (ParameterIncorrect); \
	TC_EXCEPTION (ParameterTooLarge); \
	TC_EXCEPTION (PartitionDeviceRequired); \
	TC_EXCEPTION (StringConversionFailed); \
	TC_EXCEPTION (TestFailed); \
	TC_EXCEPTION (TimeOut); \
	TC_EXCEPTION (UnknownException); \
	TC_EXCEPTION (UnsupportedAlgoInTrueCryptMode); \
	TC_EXCEPTION (UnsupportedTrueCryptFormat); \
	TC_EXCEPTION (UserAbort)

	TC_EXCEPTION_SET;

#undef TC_EXCEPTION
}

#ifdef assert
#	undef assert
#endif

#ifdef DEBUG
#	define assert(condition) do { if (!(condition)) throw AssertionFailed (SRC_POS); } while (false)
#else
#	define assert(condition) ((void) 0)
#endif

#endif // TC_HEADER_Platform_Exception
s?h=SysEncWizardPR957&id=86529dadde9af8407711d55d0096330429f79742'>Linux/MacOSX: solve the 'X' icon not closing some dialog. This was caused by ↵Mounir IDRASSI8-14/+14 a bug of wxFormBuilder that calls SetExtraStyle without taking care of the previous value. 2015-02-13Linux: Perform a quick NTFS formatting by adding the "-f" switch to ↵Mounir IDRASSI1-0/+4 mkfs.ntfs. Without this, the creation of big NTFS volumes takes ages. The code already takes care of the empty sectors by encrypting them with different key to randomize plaintext. 2015-02-08Linux/MacOSX: use command line values of TrueCryptMode and PRF as defaults ↵Mounir IDRASSI6-9/+33 for the password dialog 2015-01-04Linux/MacOSX: Add wait dialog to the benchmark computation. Correct handling ↵Mounir IDRASSI4-22/+42 of wait dialog call when changing password and creating volumes. 2015-01-04Linux/MacOSX: make the cancel button work on the preferences dialog.Mounir IDRASSI1-1/+1 2015-01-04Linux/MacOSX: change cascade encryption naming format in the UI as it was ↵Mounir IDRASSI3-4/+4 done on Windows. 2015-01-03Linux/MacOSX: workaround for wxWidgets bug in the method ↵Mounir IDRASSI1-1/+1 wxTextEntry::IsEmpty that made it impossible to enter a one digit size for the volume. 2014-12-30Linux/MacOSX: Implement TrueCrypt conversion and loading support. Correct ↵Mounir IDRASSI13-21/+264 many GTK issues linked to multi-threaded origine of events by implementing an automatic mechanism for handling such requests in the main thread. 2014-12-28Linux/MacOSX: Add possibility to choose 1-pass wipe mode without changing ↵Mounir IDRASSI2-4/+4 the default wipe mode (3-pass). 2014-12-26Linux/MacOSX: Implement waiting dialog for lengthy operations in order to ↵Mounir IDRASSI10-9/+530 have a better user experience. 2014-12-20Linux/MacOSX: Add a donation menu entryMounir IDRASSI4-0/+23 2014-12-19Linux/MacOSX: Enhance performance by implementing the possibility to choose ↵Mounir IDRASSI8-11/+22 the correct hash algorithm of volumes during various operations (mount, change password...), both using the GUI and the command line. 2014-12-11Linux/macOSX: always display random gathering dialog/interface before ↵Mounir IDRASSI1-0/+2 performing sensitive operations that needs good quality random. 2014-12-11Linux/MacOSX: Implement generating more than one keyfile, specifying the ↵Mounir IDRASSI