#include "putty.h"
#include "ssh.h"
#include "licence.h"
+#include "winsecur.h"
#include <commctrl.h>
}
}
-extern char ver[];
+extern const char ver[];
struct PassphraseProcStruct {
char **passphrase;
}
{
+ char *buildinfo_text = buildinfo("\r\n");
char *text = dupprintf
- ("Pageant\r\n\r\n%s\r\n\r\n%s",
- ver,
+ ("PuTTYgen\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s",
+ ver, buildinfo_text,
"\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved.");
+ sfree(buildinfo_text);
SetDlgItemText(hwnd, 1000, text);
sfree(text);
}
} else if (IsDlgButtonChecked(hwnd, IDC_KEYSSH2ED25519)) {
state->keytype = ED25519;
}
+
if ((state->keytype == RSA || state->keytype == DSA) &&
state->key_bits < 256) {
char *message = dupprintf
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;
int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
{
- int argc;
+ int argc, i;
char **argv;
int ret;
+ dll_hijacking_protection();
+
InitCommonControls();
hinst = inst;
hwnd = NULL;
split_into_argv(cmdline, &argc, &argv, NULL);
- if (argc > 0) {
- if (!strcmp(argv[0], "-pgpfp")) {
+ for (i = 0; i < argc; i++) {
+ if (!strcmp(argv[i], "-pgpfp")) {
pgp_fingerprints();
- exit(1);
+ return 1;
+ } else if (!strcmp(argv[i], "-restrict-acl") ||
+ !strcmp(argv[i], "-restrict_acl") ||
+ !strcmp(argv[i], "-restrictacl")) {
+ restrict_process_acl();
} else {
/*
* Assume the first argument to be a private key file, and
* attempt to load it.
*/
- cmdline_keyfile = argv[0];
+ cmdline_keyfile = argv[i];
+ break;
}
}