From cb6dad6bd21d66cd28b3ef47e3540316ee9913c3 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 27 Jul 2014 03:29:45 +0200 Subject: Linux/MacOSX port of manual selection of number of passes for volume header over-write operation. --- src/Main/Forms/ChangePasswordDialog.cpp | 2 +- src/Main/Forms/Forms.cpp | 12 ++- src/Main/Forms/Forms.h | 2 + src/Main/Forms/TrueCrypt.fbp | 179 +++++++++++++++++++++++++++++++- src/Main/Forms/VolumePasswordPanel.cpp | 17 +++ src/Main/Forms/VolumePasswordPanel.h | 1 + 6 files changed, 210 insertions(+), 3 deletions(-) (limited to 'src/Main') diff --git a/src/Main/Forms/ChangePasswordDialog.cpp b/src/Main/Forms/ChangePasswordDialog.cpp index 2a46f1ab..f52e169d 100644 --- a/src/Main/Forms/ChangePasswordDialog.cpp +++ b/src/Main/Forms/ChangePasswordDialog.cpp @@ -124,7 +124,7 @@ namespace VeraCrypt wxBusyCursor busy; Core->ChangePassword (Path, Gui->GetPreferences().DefaultMountOptions.PreserveTimestamps, CurrentPasswordPanel->GetPassword(), CurrentPasswordPanel->GetKeyfiles(), - newPassword, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf()); + newPassword, newKeyfiles, NewPasswordPanel->GetPkcs5Kdf(), NewPasswordPanel->GetHeaderWipeCount()); } switch (DialogMode) diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp index e804889b..76080605 100644 --- a/src/Main/Forms/Forms.cpp +++ b/src/Main/Forms/Forms.cpp @@ -3150,10 +3150,20 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i Pkcs5PrfChoice->SetSelection( 0 ); GridBagSizer->Add( Pkcs5PrfChoice, wxGBPosition( 7, 1 ), wxGBSpan( 1, 2 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); + HeaderWipeCountText = new wxStaticText( this, wxID_ANY, _("Header Wipe:"), wxDefaultPosition, wxDefaultSize, 0 ); + HeaderWipeCountText->Wrap( -1 ); + GridBagSizer->Add( HeaderWipeCountText, wxGBPosition( 8, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT, 5 ); + + wxString HeaderWipeCountChoices[] = { _("3-pass"), _("7-pass"), _("35-pass"), _("256-pass"), _("3") }; + int HeaderWipeCountNChoices = sizeof( HeaderWipeCountChoices ) / sizeof( wxString ); + HeaderWipeCount = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, HeaderWipeCountNChoices, HeaderWipeCountChoices, 0 ); + HeaderWipeCount->SetSelection( 0 ); + GridBagSizer->Add( HeaderWipeCount, wxGBPosition( 8, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 ); + PasswordPlaceholderSizer = new wxBoxSizer( wxVERTICAL ); - GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 8, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 ); + GridBagSizer->Add( PasswordPlaceholderSizer, wxGBPosition( 9, 1 ), wxGBSpan( 1, 2 ), wxTOP|wxEXPAND, 5 ); GridBagSizer->AddGrowableCol( 1 ); diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h index 2ced284c..f20a7628 100644 --- a/src/Main/Forms/Forms.h +++ b/src/Main/Forms/Forms.h @@ -950,6 +950,8 @@ namespace VeraCrypt wxBoxSizer* Pkcs5PrfSizer; wxStaticText* Pkcs5PrfStaticText; wxChoice* Pkcs5PrfChoice; + wxStaticText* HeaderWipeCountText; + wxChoice* HeaderWipeCount; wxBoxSizer* PasswordPlaceholderSizer; // Virtual event handlers, overide them in your derived class diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp index 53dd452f..bc11db47 100644 --- a/src/Main/Forms/TrueCrypt.fbp +++ b/src/Main/Forms/TrueCrypt.fbp @@ -25295,12 +25295,189 @@ + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT + 8 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Header Wipe: + + 0 + + + 0 + + 1 + HeaderWipeCountText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + 1 + 1 + wxALL + 8 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "3-pass" "7-pass" "35-pass" "256-pass" "3" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + HeaderWipeCount + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 2 1 wxTOP|wxEXPAND - 8 + 9 1 diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp index 54bef90f..10e56f7a 100644 --- a/src/Main/Forms/VolumePasswordPanel.cpp +++ b/src/Main/Forms/VolumePasswordPanel.cpp @@ -189,6 +189,23 @@ namespace VeraCrypt return shared_ptr (); } } + + int VolumePasswordPanel::GetHeaderWipeCount () const + { + try + { + long wipeCount; + wxString wipeCountStrDesc = HeaderWipeCount->GetStringSelection(); + wxString wipeCountStr = wipeCountStrDesc.BeforeFirst(wxT("-")); + if (!wipeCountStr.ToLong(&wipeCount)) + wipeCount = PRAND_HEADER_WIPE_PASSES; + return (int) wipeCount; + } + catch (ParameterIncorrect&) + { + return PRAND_HEADER_WIPE_PASSES; + } + } void VolumePasswordPanel::OnAddKeyfileDirMenuItemSelected (wxCommandEvent& event) { diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h index 3ab7f95a..f7f6e7cb 100644 --- a/src/Main/Forms/VolumePasswordPanel.h +++ b/src/Main/Forms/VolumePasswordPanel.h @@ -25,6 +25,7 @@ namespace VeraCrypt shared_ptr GetKeyfiles () const { return UseKeyfilesCheckBox->IsChecked() ? Keyfiles : shared_ptr (); } shared_ptr GetPassword () const; shared_ptr GetPkcs5Kdf () const; + int GetHeaderWipeCount () const; void SetCacheCheckBoxValidator (const wxGenericValidator &validator) { CacheCheckBox->SetValidator (validator); } void SetFocusToPasswordTextCtrl () { PasswordTextCtrl->SetSelection (-1, -1); PasswordTextCtrl->SetFocus(); } bool PasswordsMatch () const; -- cgit v1.2.3