VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Main/Forms/Forms.cpp28
-rw-r--r--src/Main/Forms/Forms.h4
-rw-r--r--src/Main/Forms/KeyfileGeneratorDialog.cpp26
-rw-r--r--src/Main/Forms/KeyfileGeneratorDialog.h2
-rw-r--r--src/Main/Forms/RandomPoolEnrichmentDialog.cpp26
-rw-r--r--src/Main/Forms/RandomPoolEnrichmentDialog.h2
-rw-r--r--src/Main/Forms/TrueCrypt.fbp228
7 files changed, 306 insertions, 10 deletions
diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp
index 3c0db6a7..da2a30ba 100644
--- a/src/Main/Forms/Forms.cpp
+++ b/src/Main/Forms/Forms.cpp
@@ -1362,7 +1362,6 @@ KeyfileGeneratorDialogBase::KeyfileGeneratorDialogBase( wxWindow* parent, wxWind
bSizer147->Add( RandomPoolStaticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
ShowRandomPoolCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
- ShowRandomPoolCheckBox->SetValue(true);
bSizer147->Add( ShowRandomPoolCheckBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
@@ -1371,6 +1370,19 @@ KeyfileGeneratorDialogBase::KeyfileGeneratorDialogBase( wxWindow* parent, wxWind
sbSizer43->Add( 0, 0, 1, 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, 1, wxALL|wxEXPAND, 5 );
+
+
+ sbSizer43->Add( sbSizer45, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
+
+
+ sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 );
+
MouseStaticText = new wxStaticText( this, wxID_ANY, _("IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases the cryptographic strength of the keyfile."), wxDefaultPosition, wxDefaultSize, 0 );
MouseStaticText->Wrap( -1 );
sbSizer43->Add( MouseStaticText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
@@ -2315,7 +2327,6 @@ RandomPoolEnrichmentDialogBase::RandomPoolEnrichmentDialogBase( wxWindow* parent
bSizer147->Add( RandomPoolStaticText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
ShowRandomPoolCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 );
- ShowRandomPoolCheckBox->SetValue(true);
bSizer147->Add( ShowRandomPoolCheckBox, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
@@ -2324,6 +2335,19 @@ RandomPoolEnrichmentDialogBase::RandomPoolEnrichmentDialogBase( wxWindow* parent
sbSizer43->Add( 0, 0, 1, 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 );
+
+
+ sbSizer43->Add( sbSizer45, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
+
+
+ sbSizer43->Add( 0, 0, 1, wxEXPAND, 5 );
+
MouseStaticText = new wxStaticText( this, wxID_ANY, _("IMPORTANT: Move your mouse as randomly as possible within this window. The longer you move it, the better. This significantly increases security. When done, click 'Continue'."), wxDefaultPosition, wxDefaultSize, 0 );
MouseStaticText->Wrap( -1 );
sbSizer43->Add( MouseStaticText, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h
index 629519ae..fc3f62d3 100644
--- a/src/Main/Forms/Forms.h
+++ b/src/Main/Forms/Forms.h
@@ -39,9 +39,9 @@ class WizardPage;
#include <wx/textctrl.h>
#include <wx/dialog.h>
#include <wx/choice.h>
+#include <wx/gauge.h>
#include <wx/spinctrl.h>
#include <wx/notebook.h>
-#include <wx/gauge.h>
///////////////////////////////////////////////////////////////////////////
@@ -411,6 +411,7 @@ namespace VeraCrypt
wxChoice* HashChoice;
wxStaticText* RandomPoolStaticText;
wxCheckBox* ShowRandomPoolCheckBox;
+ wxGauge* CollectedEntropy;
wxStaticText* MouseStaticText;
wxStaticText* m_staticText60;
wxSpinCtrl* NumberOfKeyfiles;
@@ -639,6 +640,7 @@ namespace VeraCrypt
wxChoice* HashChoice;
wxStaticText* RandomPoolStaticText;
wxCheckBox* ShowRandomPoolCheckBox;
+ wxGauge* CollectedEntropy;
wxStaticText* MouseStaticText;
wxButton* ContinueButton;
diff --git a/src/Main/Forms/KeyfileGeneratorDialog.cpp b/src/Main/Forms/KeyfileGeneratorDialog.cpp
index bc4fb9fd..157f74e5 100644
--- a/src/Main/Forms/KeyfileGeneratorDialog.cpp
+++ b/src/Main/Forms/KeyfileGeneratorDialog.cpp
@@ -31,7 +31,7 @@ namespace VeraCrypt
HashChoice->Select (0);
RandomNumberGenerator::SetHash (Gui->GetSelectedData <Hash> (HashChoice)->GetNew());
- ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
+ HideBytes (RandomPoolStaticText, 24);
MouseStaticText->Wrap (Gui->GetCharWidth (MouseStaticText) * 70);
MainSizer->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 24));
@@ -39,6 +39,8 @@ namespace VeraCrypt
Layout();
Fit();
Center();
+
+ MouseEventsCounter = 0;
foreach (wxWindow *c, this->GetChildren())
c->Connect (wxEVT_MOTION, wxMouseEventHandler (KeyfileGeneratorDialog::OnMouseMotion), nullptr, this);
@@ -169,12 +171,20 @@ namespace VeraCrypt
if (ShowRandomPoolCheckBox->IsChecked())
ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
+ else
+ HideBytes (RandomPoolStaticText, 24);
+
+ /* 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)
+ CollectedEntropy->SetValue (++MouseEventsCounter);
}
void KeyfileGeneratorDialog::OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event)
{
if (!event.IsChecked())
- RandomPoolStaticText->SetLabel (L"");
+ HideBytes (RandomPoolStaticText, 24);
}
void KeyfileGeneratorDialog::OnRandomSizeCheckBoxClicked (wxCommandEvent& event)
@@ -204,4 +214,16 @@ namespace VeraCrypt
str[i] = L'X';
}
}
+
+ void KeyfileGeneratorDialog::HideBytes (wxStaticText *textCtrl, size_t len)
+ {
+ wxString str;
+
+ for (size_t i = 0; i < len + 1; ++i)
+ {
+ str += L"**";
+ }
+
+ textCtrl->SetLabel (str.c_str());
+ }
}
diff --git a/src/Main/Forms/KeyfileGeneratorDialog.h b/src/Main/Forms/KeyfileGeneratorDialog.h
index 60caf6c7..23c66f08 100644
--- a/src/Main/Forms/KeyfileGeneratorDialog.h
+++ b/src/Main/Forms/KeyfileGeneratorDialog.h
@@ -31,8 +31,10 @@ namespace VeraCrypt
void OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event);
void OnRandomSizeCheckBoxClicked( wxCommandEvent& event );
void ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer, bool appendDots = true);
+ void HideBytes (wxStaticText *textCtrl, size_t len);
HashList Hashes;
+ int MouseEventsCounter;
};
}
diff --git a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
index fcfd0767..f8b04d24 100644
--- a/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
+++ b/src/Main/Forms/RandomPoolEnrichmentDialog.cpp
@@ -33,7 +33,7 @@ namespace VeraCrypt
}
}
- ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
+ HideBytes (RandomPoolStaticText, 24);
MouseStaticText->Wrap (Gui->GetCharWidth (MouseStaticText) * 70);
MainSizer->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 24));
@@ -41,6 +41,8 @@ namespace VeraCrypt
Layout();
Fit();
Center();
+
+ MouseEventsCounter = 0;
foreach (wxWindow *c, this->GetChildren())
c->Connect (wxEVT_MOTION, wxMouseEventHandler (RandomPoolEnrichmentDialog::OnMouseMotion), nullptr, this);
@@ -68,12 +70,20 @@ namespace VeraCrypt
if (ShowRandomPoolCheckBox->IsChecked())
ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
+ else
+ HideBytes (RandomPoolStaticText, 24);
+
+ /* 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)
+ CollectedEntropy->SetValue (++MouseEventsCounter);
}
void RandomPoolEnrichmentDialog::OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event)
{
if (!event.IsChecked())
- RandomPoolStaticText->SetLabel (L"");
+ HideBytes (RandomPoolStaticText, 24);
}
void RandomPoolEnrichmentDialog::ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer)
@@ -94,4 +104,16 @@ namespace VeraCrypt
str[i] = L'X';
}
}
+
+ void RandomPoolEnrichmentDialog::HideBytes (wxStaticText *textCtrl, size_t len)
+ {
+ wxString str;
+
+ for (size_t i = 0; i < len + 1; ++i)
+ {
+ str += L"**";
+ }
+
+ textCtrl->SetLabel (str.c_str());
+ }
}
diff --git a/src/Main/Forms/RandomPoolEnrichmentDialog.h b/src/Main/Forms/RandomPoolEnrichmentDialog.h
index 2d55391c..6e113cbe 100644
--- a/src/Main/Forms/RandomPoolEnrichmentDialog.h
+++ b/src/Main/Forms/RandomPoolEnrichmentDialog.h
@@ -29,8 +29,10 @@ namespace VeraCrypt
void OnMouseMotion (wxMouseEvent& event);
void OnShowRandomPoolCheckBoxClicked (wxCommandEvent& event);
void ShowBytes (wxStaticText *textCtrl, const ConstBufferPtr &buffer);
+ void HideBytes (wxStaticText *textCtrl, size_t len);
HashList Hashes;
+ int MouseEventsCounter;
};
}
diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp
index 5f5735ab..a993f39f 100644
--- a/src/Main/Forms/TrueCrypt.fbp
+++ b/src/Main/Forms/TrueCrypt.fbp
@@ -9413,7 +9413,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
- <property name="checked">1</property>
+ <property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@@ -9497,6 +9497,117 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
+ <property name="flag">wxBOTTOM|wxEXPAND|wxTOP</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="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxGauge" expanded="0">
+ <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="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="spacer" expanded="0">
+ <property name="height">0</property>
+ <property name="permission">protected</property>
+ <property name="width">0</property>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
@@ -18937,7 +19048,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
- <property name="checked">1</property>
+ <property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@@ -19021,6 +19132,117 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
+ <property name="flag">wxBOTTOM|wxEXPAND|wxTOP</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="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxGauge" expanded="0">
+ <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="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="spacer" expanded="0">
+ <property name="height">0</property>
+ <property name="permission">protected</property>
+ <property name="width">0</property>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
@@ -22832,7 +23054,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
- <property name="checked">1</property>
+ <property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>