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

This commit is contained in:
Mounir IDRASSI
2016-02-09 00:49:04 +01:00
parent 0863924483
commit 39fb2edc25
10 changed files with 146 additions and 21 deletions

View File

@@ -21,7 +21,8 @@ namespace VeraCrypt
PreviousGaugeValue (0),
ProgressBarRange (1),
RealProgressBarRange (1),
VolumeCreatorRunning (false)
VolumeCreatorRunning (false),
MouseEventsCounter (0)
{
DisplayKeysCheckBox->SetValue (displayKeyInfo);
#ifdef TC_WINDOWS
@@ -35,6 +36,8 @@ namespace VeraCrypt
ProgressGauge->SetMinSize (wxSize (-1, Gui->GetCharHeight (this) * 2));
#endif
CollectedEntropy->SetRange (RNG_POOL_SIZE * 8);
if (DisplayKeysCheckBox->IsChecked())
ShowBytes (RandomPoolSampleStaticText, RandomNumberGenerator::PeekPool(), true);
else
@@ -184,4 +187,11 @@ namespace VeraCrypt
RealProgressBarRange = ProgressGauge->GetSize().GetWidth();
ProgressGauge->SetRange (RealProgressBarRange);
}
void VolumeCreationProgressWizardPage::IncrementEntropyProgress ()
{
ScopeLock lock (AccessMutex);
if (MouseEventsCounter < (RNG_POOL_SIZE * 8))
CollectedEntropy->SetValue (++MouseEventsCounter);
}
}