X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwinpgen.c;h=98319608c3ca1f562b57c95fa83b9e276e9c754d;hb=1de7240eb88fa24a8532ded116b4ec72dd213008;hp=c4f3d57f9ca7e82bf016774944bf936e32774468;hpb=b0b5d5fbe63e982d6a230269a2e2a823e2586512;p=PuTTY.git diff --git a/windows/winpgen.c b/windows/winpgen.c index c4f3d57f..98319608 100644 --- a/windows/winpgen.c +++ b/windows/winpgen.c @@ -134,7 +134,7 @@ static void progress_update(void *param, int action, int phase, int iprogress) } } -extern char ver[]; +extern const char ver[]; struct PassphraseProcStruct { char **passphrase; @@ -298,7 +298,7 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg, { char *text = dupprintf - ("Pageant\r\n\r\n%s\r\n\r\n%s", + ("PuTTYgen\r\n\r\n%s\r\n\r\n%s", ver, "\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved."); SetDlgItemText(hwnd, 1000, text); @@ -1115,6 +1115,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, } else if (IsDlgButtonChecked(hwnd, IDC_KEYSSH2ED25519)) { state->keytype = ED25519; } + if ((state->keytype == RSA || state->keytype == DSA) && state->key_bits < 256) { char *message = dupprintf @@ -1128,7 +1129,18 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwnd, UINT msg, break; state->key_bits = DEFAULT_KEY_BITS; SetDlgItemInt(hwnd, IDC_BITS, DEFAULT_KEY_BITS, FALSE); - } + } else if ((state->keytype == RSA || state->keytype == DSA) && + state->key_bits < DEFAULT_KEY_BITS) { + char *message = dupprintf + ("Keys shorter than %d bits are not recommended. " + "Really generate this key?", DEFAULT_KEY_BITS); + int ret = MessageBox(hwnd, message, "PuTTYgen Warning", + MB_ICONWARNING | MB_OKCANCEL); + sfree(message); + if (ret != IDOK) + break; + } + ui_set_state(hwnd, state, 1); SetDlgItemText(hwnd, IDC_GENERATING, entropy_msg); state->key_exists = FALSE; @@ -1531,7 +1543,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } } -#ifndef UNPROTECT +#if !defined UNPROTECT && !defined NO_SECURITY /* * Protect our process. */