VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms/KeyfileGeneratorDialog.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-02-08 23:49:04 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-02-08 23:52:28 (GMT)
commit39fb2edc25f2703744932f25d956bf7af604fc5f (patch)
treea25f2ab7bd6ee5d55b5e89093b86f6b7f802fa7e /src/Main/Forms/KeyfileGeneratorDialog.cpp
parent0863924483c09d05948f63d1b1740f107e3e80fe (diff)
downloadVeraCrypt-39fb2edc25f2703744932f25d956bf7af604fc5f.zip
VeraCrypt-39fb2edc25f2703744932f25d956bf7af604fc5f.tar.gz
Linux/MacOSX: add progress bar for mouse collected entropy in GUI of volume creation wizard. Add mutex protection in event handler for shared counter variable
Diffstat (limited to 'src/Main/Forms/KeyfileGeneratorDialog.cpp')
-rw-r--r--src/Main/Forms/KeyfileGeneratorDialog.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Main/Forms/KeyfileGeneratorDialog.cpp b/src/Main/Forms/KeyfileGeneratorDialog.cpp
index 157f74e..61f1628 100644
--- a/src/Main/Forms/KeyfileGeneratorDialog.cpp
+++ b/src/Main/Forms/KeyfileGeneratorDialog.cpp
@@ -33,6 +33,8 @@ 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));
@@ -177,7 +179,8 @@ 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);
}