From d7d4c98775e34c7cb723ca813e8a76fe83610013 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Thu, 11 Feb 2016 23:54:35 +0100 Subject: Windows: Add colors (Red, Yellow, Green) to the collected randomness indicator depending on how much entropy was gathered. Code re-factoring. --- src/ExpandVolume/DlgExpandVolume.cpp | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'src/ExpandVolume/DlgExpandVolume.cpp') diff --git a/src/ExpandVolume/DlgExpandVolume.cpp b/src/ExpandVolume/DlgExpandVolume.cpp index 73a38b59..0a24c2c2 100644 --- a/src/ExpandVolume/DlgExpandVolume.cpp +++ b/src/ExpandVolume/DlgExpandVolume.cpp @@ -346,27 +346,7 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L RandpeekBytes (hwndDlg, randPool, sizeof (randPool),&mouseEventsCounter); - /* 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 (mouseEntropyGathered == 0xFFFFFFFF) - { - mouseEventsInitialCount = mouseEventsCounter; - mouseEntropyGathered = 0; - } - else - { - if ( mouseEntropyGathered < maxEntropyLevel - && (mouseEventsCounter >= mouseEventsInitialCount) - && (mouseEventsCounter - mouseEventsInitialCount) <= maxEntropyLevel) - mouseEntropyGathered = mouseEventsCounter - mouseEventsInitialCount; - else - mouseEntropyGathered = maxEntropyLevel; - - SendMessage (hEntropyBar, PBM_SETPOS, - (WPARAM) (mouseEntropyGathered), - 0); - } + ProcessEntropyEstimate (hEntropyBar, &mouseEventsInitialCount, mouseEventsCounter, maxEntropyLevel, &mouseEntropyGathered); if (showRandPool) StringCbPrintfW (szRndPool, sizeof(szRndPool), L"%08X%08X%08X%08X", -- cgit v1.2.3