VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/ExpandVolume/DlgExpandVolume.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-02-11 23:54:35 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-02-12 00:04:31 +0100
commitd7d4c98775e34c7cb723ca813e8a76fe83610013 (patch)
tree262b84c9543995c64a2c93296f3dfebd4e27d3f3 /src/ExpandVolume/DlgExpandVolume.cpp
parent89d238bb3241fe8c285e9b748c0d99fa10b6a590 (diff)
downloadVeraCrypt-d7d4c98775e34c7cb723ca813e8a76fe83610013.tar.gz
VeraCrypt-d7d4c98775e34c7cb723ca813e8a76fe83610013.zip
Windows: Add colors (Red, Yellow, Green) to the collected randomness indicator depending on how much entropy was gathered. Code re-factoring.
Diffstat (limited to 'src/ExpandVolume/DlgExpandVolume.cpp')
-rw-r--r--src/ExpandVolume/DlgExpandVolume.cpp22
1 files changed, 1 insertions, 21 deletions
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
@@ -345,29 +345,9 @@ BOOL CALLBACK ExpandVolProgressDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, L
DWORD mouseEventsCounter;
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",
*((DWORD*) (randPool + 12)), *((DWORD*) (randPool + 8)), *((DWORD*) (randPool + 4)), *((DWORD*) (randPool)));