Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2022-01-08 14:23:46 +0300
committerSimon Tatham <anakin@pobox.com>2022-01-08 15:58:01 +0300
commite7a695103fd51ae765ccf0460f15795adb74485e (patch)
treec7e5b32cfd27bb336c007aa0a720116752c98c05 /windows/puttygen.c
parent9529769b6002eaaa44d293762a3cec159d628206 (diff)
Windows PuTTYgen: remove state->collecting_entropy.
There's no point having a separate boolean flag. All we have to do is remember to NULL out the strbuf point state->entropy when we free the strbuf (which is a good idea in any case!), and then we can use the non-NULL-ness of that pointer as the indicator that we're currently collecting entropy.
Diffstat (limited to 'windows/puttygen.c')
-rw-r--r--windows/puttygen.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/windows/puttygen.c b/windows/puttygen.c
index 30e85c58..d9b2eb29 100644
--- a/windows/puttygen.c
+++ b/windows/puttygen.c
@@ -630,7 +630,6 @@ static DWORD WINAPI generate_key_thread(void *param)
}
struct MainDlgState {
- bool collecting_entropy;
bool generation_thread_exists;
bool key_exists;
int entropy_got, entropy_required;
@@ -1200,7 +1199,6 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
state = snew(struct MainDlgState);
state->generation_thread_exists = false;
- state->collecting_entropy = false;
state->entropy = NULL;
state->key_exists = false;
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) state);
@@ -1407,8 +1405,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
return 1;
case WM_MOUSEMOVE:
state = (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
- if (state->collecting_entropy &&
- state->entropy && state->entropy_got < state->entropy_required) {
+ if (state->entropy && state->entropy_got < state->entropy_required) {
put_uint32(state->entropy, lParam);
put_uint32(state->entropy, GetMessageTime());
state->entropy_got += 2;
@@ -1420,7 +1417,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
*/
random_reseed(ptrlen_from_strbuf(state->entropy));
strbuf_free(state->entropy);
- state->collecting_entropy = false;
+ state->entropy = NULL;
start_generating_key(hwnd, state);
}
@@ -1634,7 +1631,6 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg,
ui_set_state(hwnd, state, 1);
SetDlgItemText(hwnd, IDC_GENERATING, entropy_msg);
state->key_exists = false;
- state->collecting_entropy = true;
state->entropy_got = 0;
state->entropy = strbuf_new_nm();