VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms/MountOptionsDialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main/Forms/MountOptionsDialog.cpp')
-rw-r--r--src/Main/Forms/MountOptionsDialog.cpp53
1 files changed, 30 insertions, 23 deletions
diff --git a/src/Main/Forms/MountOptionsDialog.cpp b/src/Main/Forms/MountOptionsDialog.cpp
index 9a9f2691..85a06d1e 100644
--- a/src/Main/Forms/MountOptionsDialog.cpp
+++ b/src/Main/Forms/MountOptionsDialog.cpp
@@ -17,6 +17,17 @@
namespace VeraCrypt
{
+#ifdef TC_MACOSX
+
+ bool MountOptionsDialog::ProcessEvent(wxEvent& event)
+ {
+ if(GraphicUserInterface::HandlePasswordEntryCustomEvent (event))
+ return true;
+ else
+ return MountOptionsDialogBase::ProcessEvent(event);
+ }
+#endif
+
MountOptionsDialog::MountOptionsDialog (wxWindow *parent, MountOptions &options, const wxString &title, bool disableMountOptions)
: MountOptionsDialogBase (parent, wxID_ANY, wxString()
#ifdef __WXGTK__ // GTK apparently needs wxRESIZE_BORDER to support dynamic resizing
@@ -33,15 +44,14 @@ namespace VeraCrypt
if (disableMountOptions)
OptionsButton->Show (false);
+
+
+#ifdef TC_MACOSX
+ GraphicUserInterface::InstallPasswordEntryCustomKeyboardShortcuts (this);
+#endif
- PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, disableMountOptions, options.Keyfiles, !disableMountOptions, true, true, false, true, true);
+ PasswordPanel = new VolumePasswordPanel (this, &options, options.Password, options.Keyfiles, !disableMountOptions, true, true, false, true, true);
PasswordPanel->SetCacheCheckBoxValidator (wxGenericValidator (&Options.CachePassword));
-
- if (options.Path && options.Path->HasTrueCryptExtension() && !disableMountOptions
- && !options.TrueCryptMode && (options.Pim <= 0))
- {
- PasswordPanel->SetTrueCryptMode (true);
- }
PasswordSizer->Add (PasswordPanel, 1, wxALL | wxEXPAND);
@@ -65,13 +75,15 @@ namespace VeraCrypt
FilesystemOptionsTextCtrl->SetValue (Options.FilesystemOptions);
ReadOnlyCheckBox->SetValue (Options.Protection == VolumeProtection::ReadOnly);
+ BackupHeaderCheckBox->SetValidator (wxGenericValidator (&Options.UseBackupHeaders));
ProtectionCheckBox->SetValue (Options.Protection == VolumeProtection::HiddenVolumeReadOnly);
OptionsButtonLabel = OptionsButton->GetLabel();
OptionsButton->SetLabel (OptionsButtonLabel + L" >");
OptionsPanel->Show (false);
- ProtectionPasswordPanel = new VolumePasswordPanel (OptionsPanel, &options, options.ProtectionPassword, true, options.ProtectionKeyfiles, false, true, true, false, true, true, _("P&assword to hidden volume:"));
+ ProtectionPasswordPanel = new VolumePasswordPanel (ProtectionSizer->GetStaticBox(), &options, options.ProtectionPassword, options.ProtectionKeyfiles, false, true, true, false, true, true, LangString["IDT_HIDDEN_PROT_PASSWD"]);
+ ProtectionPasswordPanel->TopOwnerParent = this;
ProtectionPasswordSizer->Add (ProtectionPasswordPanel, 1, wxALL | wxEXPAND);
UpdateDialog();
@@ -92,8 +104,6 @@ namespace VeraCrypt
void MountOptionsDialog::OnOKButtonClick (wxCommandEvent& event)
{
- bool bUnsupportedKdf = false;
-
/* verify that PIM values are valid before continuing*/
int Pim = PasswordPanel->GetVolumePim();
int ProtectionPim = (!ReadOnlyCheckBox->IsChecked() && ProtectionCheckBox->IsChecked())?
@@ -116,21 +126,22 @@ namespace VeraCrypt
try
{
- Options.Password = PasswordPanel->GetPassword();
+ Options.Password = PasswordPanel->GetPassword(Options.PartitionInSystemEncryptionScope);
}
catch (PasswordException& e)
{
Gui->ShowWarning (e);
return;
}
- Options.Pim = Pim;
- Options.Kdf = PasswordPanel->GetPkcs5Kdf(bUnsupportedKdf);
- if (bUnsupportedKdf)
+
+ if (Options.PartitionInSystemEncryptionScope && Options.Password->Size() > VolumePassword::MaxLegacySize)
{
- Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
+ Gui->ShowWarning (StringFormatter (LangString["LINUX_SYSTEM_ENC_PW_LENGTH_NOTE"], (int) VolumePassword::MaxLegacySize));
return;
}
- Options.TrueCryptMode = PasswordPanel->GetTrueCryptMode();
+
+ Options.Pim = Pim;
+ Options.Kdf = PasswordPanel->GetPkcs5Kdf();
Options.Keyfiles = PasswordPanel->GetKeyfiles();
if (ReadOnlyCheckBox->IsChecked())
@@ -141,7 +152,7 @@ namespace VeraCrypt
{
try
{
- Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword();
+ Options.ProtectionPassword = ProtectionPasswordPanel->GetPassword(false);
}
catch (PasswordException& e)
{
@@ -150,12 +161,7 @@ namespace VeraCrypt
}
Options.Protection = VolumeProtection::HiddenVolumeReadOnly;
Options.ProtectionPim = ProtectionPim;
- Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf(Options.TrueCryptMode, bUnsupportedKdf);
- if (bUnsupportedKdf)
- {
- Gui->ShowWarning (LangString ["ALGO_NOT_SUPPORTED_FOR_TRUECRYPT_MODE"]);
- return;
- }
+ Options.ProtectionKdf = ProtectionPasswordPanel->GetPkcs5Kdf();
Options.ProtectionKeyfiles = ProtectionPasswordPanel->GetKeyfiles();
}
else
@@ -168,6 +174,7 @@ namespace VeraCrypt
Options.MountPoint = make_shared <DirectoryPath> (mountPoint);
Options.FilesystemOptions = FilesystemOptionsTextCtrl->GetValue();
+ Options.EMVSupportEnabled = Gui->GetPreferences().EMVSupportEnabled;
EndModal (wxID_OK);
}