VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main')
-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
@@ -1361,17 +1361,29 @@ 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 );
sbSizer43->Add( bSizer147, 0, wxEXPAND|wxTOP, 5 );
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 );
@@ -2314,17 +2326,29 @@ 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 );
sbSizer43->Add( bSizer147, 0, wxEXPAND|wxTOP, 5 );
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
@@ -38,11 +38,11 @@ class WizardPage;
#include <wx/statline.h>
#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>
///////////////////////////////////////////////////////////////////////////
namespace VeraCrypt
@@ -410,8 +410,9 @@ namespace VeraCrypt
wxBoxSizer* MainSizer;
wxChoice* HashChoice;
wxStaticText* RandomPoolStaticText;
wxCheckBox* ShowRandomPoolCheckBox;
+ wxGauge* CollectedEntropy;
wxStaticText* MouseStaticText;
wxStaticText* m_staticText60;
wxSpinCtrl* NumberOfKeyfiles;
wxPanel* m_panel18;
@@ -638,8 +639,9 @@ namespace VeraCrypt
wxBoxSizer* MainSizer;
wxChoice* HashChoice;
wxStaticText* RandomPoolStaticText;
wxCheckBox* ShowRandomPoolCheckBox;
+ wxGauge* CollectedEntropy;
wxStaticText* MouseStaticText;
wxButton* ContinueButton;
// Virtual event handlers, overide them in your derived class
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
@@ -30,16 +30,18 @@ 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));
Layout();
Fit();
Center();
+
+ MouseEventsCounter = 0;
foreach (wxWindow *c, this->GetChildren())
c->Connect (wxEVT_MOTION, wxMouseEventHandler (KeyfileGeneratorDialog::OnMouseMotion), nullptr, this);
}
@@ -168,14 +170,22 @@ namespace VeraCrypt
RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
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)
{
@@ -203,5 +213,17 @@ 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
@@ -30,10 +30,12 @@ namespace VeraCrypt
void OnMouseMotion (wxMouseEvent& event);
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;
};
}
#endif // TC_HEADER_Main_Forms_KeyfileGeneratorDialog
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
@@ -32,16 +32,18 @@ namespace VeraCrypt
HashChoice->Select (HashChoice->GetCount() - 1);
}
}
- ShowBytes (RandomPoolStaticText, RandomNumberGenerator::PeekPool().GetRange (0, 24));
+ HideBytes (RandomPoolStaticText, 24);
MouseStaticText->Wrap (Gui->GetCharWidth (MouseStaticText) * 70);
MainSizer->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 24));
Layout();
Fit();
Center();
+
+ MouseEventsCounter = 0;
foreach (wxWindow *c, this->GetChildren())
c->Connect (wxEVT_MOTION, wxMouseEventHandler (RandomPoolEnrichmentDialog::OnMouseMotion), nullptr, this);
}
@@ -67,14 +69,22 @@ namespace VeraCrypt
RandomNumberGenerator::AddToPool (ConstBufferPtr (reinterpret_cast <byte *> (&coord), sizeof (coord)));
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)
{
@@ -93,5 +103,17 @@ 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
@@ -28,10 +28,12 @@ namespace VeraCrypt
void OnHashSelected (wxCommandEvent& event);
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;
};
}
#endif // TC_HEADER_Main_Forms_RandomPoolEnrichmentDialog
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
@@ -9412,9 +9412,9 @@
<property name="bg"></property>
<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>
<property name="default_pane">0</property>
@@ -9496,8 +9496,119 @@
</object>
</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">
<property name="BottomDockable">1</property>
@@ -18936,9 +19047,9 @@
<property name="bg"></property>
<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>
<property name="default_pane">0</property>
@@ -19020,8 +19131,119 @@
</object>
</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">
<property name="BottomDockable">1</property>
@@ -22831,9 +23053,9 @@
<property name="bg"></property>
<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>
<property name="default_pane">0</property>