VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Main/Forms/Forms.cpp18
-rw-r--r--src/Main/Forms/Forms.h1
-rw-r--r--src/Main/Forms/KeyfileGeneratorDialog.cpp5
-rw-r--r--src/Main/Forms/KeyfileGeneratorDialog.h1
-rw-r--r--src/Main/Forms/RandomPoolEnrichmentDialog.cpp5
-rw-r--r--src/Main/Forms/RandomPoolEnrichmentDialog.h1
-rw-r--r--src/Main/Forms/TrueCrypt.fbp113
-rw-r--r--src/Main/Forms/VolumeCreationProgressWizardPage.cpp12
-rw-r--r--src/Main/Forms/VolumeCreationProgressWizardPage.h3
-rwxr-xr-xsrc/Main/Forms/VolumeCreationWizard.cpp8
10 files changed, 146 insertions, 21 deletions
diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp
index da2a30ba..5fa70e5f 100644
--- a/src/Main/Forms/Forms.cpp
+++ b/src/Main/Forms/Forms.cpp
@@ -1435,9 +1435,9 @@ KeyfileGeneratorDialogBase::KeyfileGeneratorDialogBase( wxWindow* parent, wxWind
bSizer162->Add( fgSizer8, 1, wxEXPAND, 5 );
- bSizer144->Add( bSizer162, 1, wxALL|wxEXPAND, 5 );
+ bSizer144->Add( bSizer162, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer146;
bSizer146 = new wxBoxSizer( wxHORIZONTAL );
@@ -2884,9 +2884,8 @@ VolumeCreationProgressWizardPageBase::VolumeCreationProgressWizardPageBase( wxWi
bSizer126->Add( RandomPoolSampleStaticText, 0, wxEXPAND|wxTOP|wxRIGHT|wxALIGN_BOTTOM, 7 );
DisplayKeysCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
- DisplayKeysCheckBox->SetValue(true);
bSizer126->Add( DisplayKeysCheckBox, 0, wxEXPAND|wxRIGHT, 5 );
fgSizer5->Add( bSizer126, 1, wxEXPAND|wxALIGN_BOTTOM, 5 );
@@ -2918,8 +2917,18 @@ VolumeCreationProgressWizardPageBase::VolumeCreationProgressWizardPageBase( wxWi
bSizer105->Add( sbSizer31, 0, wxALL|wxEXPAND, 5 );
+ wxStaticBoxSizer* sbSizer45;
+ sbSizer45 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Randomness Collected From Mouse Movements") ), wxVERTICAL );
+
+ CollectedEntropy = new wxGauge( this, wxID_ANY, 2560, wxDefaultPosition, wxDefaultSize, wxGA_HORIZONTAL|wxGA_SMOOTH );
+ CollectedEntropy->SetValue( 0 );
+ sbSizer45->Add( CollectedEntropy, 0, wxALL|wxEXPAND, 5 );
+
+
+ bSizer105->Add( sbSizer45, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
+
wxStaticBoxSizer* sbSizer32;
sbSizer32 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL );
wxBoxSizer* bSizer106;
@@ -3014,14 +3023,11 @@ VolumeCreationProgressWizardPageBase::VolumeCreationProgressWizardPageBase( wxWi
bSizer105->Add( sbSizer32, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
-
- bSizer105->Add( 0, 0, 0, wxTOP|wxBOTTOM, 5 );
-
InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
InfoStaticText->Wrap( -1 );
- bSizer105->Add( InfoStaticText, 0, wxALL, 5 );
+ bSizer105->Add( InfoStaticText, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
bSizer104->Add( bSizer105, 1, wxEXPAND, 5 );
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h
index fc3f62d3..5a3e8646 100644
--- a/src/Main/Forms/Forms.h
+++ b/src/Main/Forms/Forms.h
@@ -870,8 +870,9 @@ namespace VeraCrypt
wxStaticText* RandomPoolSampleStaticText;
wxCheckBox* DisplayKeysCheckBox;
wxStaticText* HeaderKeySampleStaticText;
wxStaticText* MasterKeySampleStaticText;
+ wxGauge* CollectedEntropy;
wxGauge* ProgressGauge;
wxButton* AbortButton;
wxStaticText* m_staticText31;
wxPanel* m_panel12;
diff --git a/src/Main/Forms/KeyfileGeneratorDialog.cpp b/src/Main/Forms/KeyfileGeneratorDialog.cpp
index 157f74e5..61f16287 100644
--- a/src/Main/Forms/KeyfileGeneratorDialog.cpp
+++ b/src/Main/Forms/KeyfileGeneratorDialog.cpp
@@ -32,8 +32,10 @@ namespace VeraCrypt
RandomNumberGenerator::SetHash (Gui->GetSelectedData <Hash> (HashChoice)->GetNew());
HideBytes (RandomPoolStaticText, 24);
MouseStaticText->Wrap (Gui->GetCharWidth (MouseStaticText) * 70);
+
+ CollectedEntropy->SetRange (RNG_POOL_SIZE * 8);
MainSizer->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 24));
Layout();
@@ -176,9 +178,10 @@ namespace VeraCrypt
/* conservative estimate: 1 mouse move event brings 1 bit of entropy
* https://security.stackexchange.com/questions/32844/for-how-much-time-should-i-randomly-move-the-mouse-for-generating-encryption-key/32848#32848
*/
- if (MouseEventsCounter < 2560)
+ ScopeLock lock (AccessMutex);
+ if (MouseEventsCounter < (RNG_POOL_SIZE * 8))
CollectedEntropy->SetValue (++MouseEventsCounter);
}
void KeyfileGeneratorDialog::OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event)
diff --git a/src/Main/Forms/KeyfileGeneratorDialog.h b/src/Main/Forms/KeyfileGeneratorDialog.h
index 23c66f08..e4fd3633 100644
--- a/src/Main/Forms/KeyfileGeneratorDialog.h
+++ b/src/Main/Forms/KeyfileGeneratorDialog.h
@@ -34,8 +34,9 @@ namespace VeraCrypt
void HideBytes (wxStaticText *textCtrl, size_t len);
HashList Hashes;
int MouseEventsCounter;
+ Mutex AccessMutex;
};
}
#endif // TC_HEADER_Main_Forms_KeyfileGeneratorDialog
diff --git a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
index f8b04d24..ecbfe7ac 100644
--- a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
+++ b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
@@ -34,8 +34,10 @@ namespace VeraCrypt
}
HideBytes (RandomPoolStaticText, 24);
MouseStaticText->Wrap (Gui->GetCharWidth (MouseStaticText) * 70);
+
+ CollectedEntropy->SetRange (RNG_POOL_SIZE * 8);
MainSizer->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 24));
Layout();
@@ -75,9 +77,10 @@ namespace VeraCrypt
/* conservative estimate: 1 mouse move event brings 1 bit of entropy
* https://security.stackexchange.com/questions/32844/for-how-much-time-should-i-randomly-move-the-mouse-for-generating-encryption-key/32848#32848
*/
- if (MouseEventsCounter < 2560)
+ ScopeLock lock (AccessMutex);
+ if (MouseEventsCounter < (RNG_POOL_SIZE * 8))
CollectedEntropy->SetValue (++MouseEventsCounter);
}
void RandomPoolEnrichmentDialog::OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event)
diff --git a/src/Main/Forms/RandomPoolEnrichmentDialog.h b/src/Main/Forms/RandomPoolEnrichmentDialog.h
index 6e113cbe..4135ff28 100644
--- a/src/Main/Forms/RandomPoolEnrichmentDialog.h
+++ b/src/Main/Forms/RandomPoolEnrichmentDialog.h
@@ -32,8 +32,9 @@ namespace VeraCrypt
void HideBytes (wxStaticText *textCtrl, size_t len);
HashList Hashes;
int MouseEventsCounter;
+ Mutex AccessMutex;
};
}
#endif // TC_HEADER_Main_Forms_RandomPoolEnrichmentDialog
diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp
index a993f39f..d9b1b1f1 100644
--- a/src/Main/Forms/TrueCrypt.fbp
+++ b/src/Main/Forms/TrueCrypt.fbp
@@ -23463,8 +23463,109 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
+ <property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
+ <property name="proportion">0</property>
+ <object class="wxStaticBoxSizer" expanded="0">
+ <property name="id">wxID_ANY</property>
+ <property name="label">Randomness Collected From Mouse Movements</property>
+ <property name="minimum_size"></property>
+ <property name="name">sbSizer45</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <event name="OnUpdateUI"></event>
+ <object class="sizeritem" expanded="1">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxGauge" expanded="1">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">CollectedEntropy</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="range">2560</property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style">wxGA_HORIZONTAL|wxGA_SMOOTH</property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NONE</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="value">0</property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="1">
+ <property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
@@ -24466,19 +24567,9 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
- <property name="flag">wxTOP|wxBOTTOM</property>
- <property name="proportion">0</property>
- <object class="spacer" expanded="1">
- <property name="height">0</property>
- <property name="permission">protected</property>
- <property name="width">0</property>
- </object>
- </object>
- <object class="sizeritem" expanded="1">
- <property name="border">5</property>
- <property name="flag">wxALL</property>
+ <property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
diff --git a/src/Main/Forms/VolumeCreationProgressWizardPage.cpp b/src/Main/Forms/VolumeCreationProgressWizardPage.cpp
index a1964958..08986f5e 100644
--- a/src/Main/Forms/VolumeCreationProgressWizardPage.cpp
+++ b/src/Main/Forms/VolumeCreationProgressWizardPage.cpp
@@ -20,9 +20,10 @@ namespace VeraCrypt
: VolumeCreationProgressWizardPageBase (parent),
PreviousGaugeValue (0),
ProgressBarRange (1),
RealProgressBarRange (1),
- VolumeCreatorRunning (false)
+ VolumeCreatorRunning (false),
+ MouseEventsCounter (0)
{
DisplayKeysCheckBox->SetValue (displayKeyInfo);
#ifdef TC_WINDOWS
DisplayKeysCheckBox->SetLabel (L"");
@@ -34,8 +35,10 @@ namespace VeraCrypt
#else
ProgressGauge->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 2));
#endif
+ CollectedEntropy->SetRange (RNG_POOL_SIZE * 8);
+
if (DisplayKeysCheckBox->IsChecked())
ShowBytes (RandomPoolSampleStaticText, RandomNumberGenerator::PeekPool(), true);
else
ShowAsterisks (RandomPoolSampleStaticText);
@@ -183,5 +186,12 @@ namespace VeraCrypt
ProgressBarRange = progressBarRange;
RealProgressBarRange = ProgressGauge->GetSize().GetWidth();
ProgressGauge->SetRange (RealProgressBarRange);
}
+
+ void VolumeCreationProgressWizardPage::IncrementEntropyProgress ()
+ {
+ ScopeLock lock (AccessMutex);
+ if (MouseEventsCounter < (RNG_POOL_SIZE * 8))
+ CollectedEntropy->SetValue (++MouseEventsCounter);
+ }
}
diff --git a/src/Main/Forms/VolumeCreationProgressWizardPage.h b/src/Main/Forms/VolumeCreationProgressWizardPage.h
index 63bd7fa8..417766e4 100644
--- a/src/Main/Forms/VolumeCreationProgressWizardPage.h
+++ b/src/Main/Forms/VolumeCreationProgressWizardPage.h
@@ -33,8 +33,9 @@ namespace VeraCrypt
void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); }
void SetProgressRange (uint64 progressBarRange);
void SetProgressValue (uint64 value);
void SetProgressState (bool volumeCreatorRunning);
+ void IncrementEntropyProgress ();
Event AbortEvent;
protected:
@@ -50,8 +51,10 @@ namespace VeraCrypt
auto_ptr <wxTimer> RandomPoolTimer;
int RealProgressBarRange;
wxLongLong StartTime;
bool VolumeCreatorRunning;
+ int MouseEventsCounter;
+ Mutex AccessMutex;
};
}
#endif // TC_HEADER_Main_Forms_VolumeCreationProgressWizardPage
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp
index 1e4c2513..e9ceb3a3 100755
--- a/src/Main/Forms/VolumeCreationWizard.cpp
+++ b/src/Main/Forms/VolumeCreationWizard.cpp
@@ -38,9 +38,9 @@ namespace VeraCrypt
{
VolumeCreationWizard::VolumeCreationWizard (wxWindow* parent)
: WizardFrame (parent),
CrossPlatformSupport (true),
- DisplayKeyInfo (true),
+ DisplayKeyInfo (false),
LargeFilesSupport (false),
QuickFormatEnabled (false),
SelectedFilesystemClusterSize (0),
SelectedFilesystemType (VolumeCreationOptions::FilesystemType::FAT),
@@ -377,8 +377,14 @@ namespace VeraCrypt
long coord = event.GetX();
RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
coord = event.GetY();
RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
+
+ VolumeCreationProgressWizardPage *page = dynamic_cast <VolumeCreationProgressWizardPage *> (GetCurrentPage());
+ if (page)
+ {
+ page->IncrementEntropyProgress ();
+ }
}
}
void VolumeCreationWizard::OnProgressTimer ()