[Ttssh2-commit] [5765] SSH 鍵生成ダイアログで秘密鍵を保存するとき、bcrypt KDF のラウンド数を指定できるようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2015年 1月 23日 (金) 17:47:42 JST


Revision: 5765
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5765
Author:   maya
Date:     2015-01-23 17:47:39 +0900 (Fri, 23 Jan 2015)
Log Message:
-----------
SSH 鍵生成ダイアログで秘密鍵を保存するとき、bcrypt KDF のラウンド数を指定できるようにした。

Modified Paths:
--------------
    trunk/installer/release/lang/English.lng
    trunk/installer/release/lang/French.lng
    trunk/installer/release/lang/German.lng
    trunk/installer/release/lang/Japanese.lng
    trunk/installer/release/lang/Korean.lng
    trunk/installer/release/lang/Russian.lng
    trunk/installer/release/lang/Simplified Chinese.lng
    trunk/installer/release/lang/Traditional Chinese.lng
    trunk/ttssh2/ttxssh/resource.h
    trunk/ttssh2/ttxssh/ssh.h
    trunk/ttssh2/ttxssh/ttxssh.c
    trunk/ttssh2/ttxssh/ttxssh.rc

-------------- next part --------------
Modified: trunk/installer/release/lang/English.lng
===================================================================
--- trunk/installer/release/lang/English.lng	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/installer/release/lang/English.lng	2015-01-23 08:47:39 UTC (rev 5765)
@@ -636,9 +636,12 @@
 DLG_KEYGEN_SAVEPRIVATE=Save &private key
 DLG_KEYGEN_GENERATE=&Generate
 DLG_KEYGEN_BITS=Key &Bits:
-DLG_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_ROUNDS=&Number of rounds:
 
 MSG_KEYBITS_MIN_ERROR=The key bits is too small.
+MSG_BCRYPT_ROUNDS_MIN_ERROR=The number of rounds is too small.
+MSG_BCRYPT_ROUNDS_MAX_ERROR=The number of rounds is too large.
 MSG_KEYGEN_GENERATING="generating key"
 MSG_KEYGEN_GENERATED="key generated"
 

Modified: trunk/installer/release/lang/French.lng
===================================================================
--- trunk/installer/release/lang/French.lng	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/installer/release/lang/French.lng	2015-01-23 08:47:39 UTC (rev 5765)
@@ -636,9 +636,12 @@
 DLG_KEYGEN_SAVEPRIVATE=Sauv. cl\xE9 priv\xE9e
 DLG_KEYGEN_GENERATE=&G\xE9n\xE9rer
 DLG_KEYGEN_BITS=Nbre &Bits:
-DLG_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_ROUNDS=&Number of rounds:
 
 MSG_KEYBITS_MIN_ERROR=Nbre de bits trop petit.
+MSG_BCRYPT_ROUNDS_MIN_ERROR=The number of rounds is too small.
+MSG_BCRYPT_ROUNDS_MAX_ERROR=The number of rounds is too large.
 MSG_KEYGEN_GENERATING="g\xE9n\xE9ration cl\xE9"
 MSG_KEYGEN_GENERATED="cl\xE9 g\xE9n\xE9r\xE9e"
 

Modified: trunk/installer/release/lang/German.lng
===================================================================
--- trunk/installer/release/lang/German.lng	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/installer/release/lang/German.lng	2015-01-23 08:47:39 UTC (rev 5765)
@@ -635,9 +635,12 @@
 DLG_KEYGEN_SAVEPRIVATE=Private Key
 DLG_KEYGEN_GENERATE=Generieren
 DLG_KEYGEN_BITS=Key &Bits:
-DLG_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_ROUNDS=&Number of rounds:
 
 MSG_KEYBITS_MIN_ERROR=The key bits is too small.
+MSG_BCRYPT_ROUNDS_MIN_ERROR=The number of rounds is too small.
+MSG_BCRYPT_ROUNDS_MAX_ERROR=The number of rounds is too large.
 MSG_KEYGEN_GENERATING="generating key"
 MSG_KEYGEN_GENERATED="key generated"
 

Modified: trunk/installer/release/lang/Japanese.lng
===================================================================
--- trunk/installer/release/lang/Japanese.lng	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/installer/release/lang/Japanese.lng	2015-01-23 08:47:39 UTC (rev 5765)
@@ -635,9 +635,12 @@
 DLG_KEYGEN_SAVEPRIVATE=\x94閧\x8C\xAE\x82̕ۑ\xB6(&P)
 DLG_KEYGEN_GENERATE=\x90\xB6\x90\xAC(&G)
 DLG_KEYGEN_BITS=\x83r\x83b\x83g\x90\x94(&B):
-DLG_BCRYPT_KDF=bcrypt KDF\x8C`\x8E\xAE(&K)
+DLG_KEYGEN_BCRYPT_KDF=bcrypt KDF\x8C`\x8E\xAE(&K)
+DLG_KEYGEN_BCRYPT_ROUNDS=\x83\x89\x83E\x83\x93\x83h\x90\x94(&N):
 
 MSG_KEYBITS_MIN_ERROR=\x8C\xAE\x82̃r\x83b\x83g\x90\x94\x82\xAA\x8F\xAC\x82\xB3\x82\xB7\x82\xAC\x82܂\xB7.
+MSG_BCRYPT_ROUNDS_MIN_ERROR=\x83\x89\x83E\x83\x93\x83h\x90\x94\x82\xAA\x8F\xAC\x82\xB3\x82\xB7\x82\xAC\x82܂\xB7.
+MSG_BCRYPT_ROUNDS_MAX_ERROR=\x83\x89\x83E\x83\x93\x83h\x90\x94\x82\xAA\x91傫\x82\xB7\x82\xAC\x82܂\xB7.
 MSG_KEYGEN_GENERATING=\x8C\xAE\x82𐶐\xAC\x82\xB5\x82Ă\xA2\x82܂\xB7\x81B
 MSG_KEYGEN_GENERATED=\x8C\xAE\x82𐶐\xAC\x82\xB5\x82܂\xB5\x82\xBD\x81B
 

Modified: trunk/installer/release/lang/Korean.lng
===================================================================
--- trunk/installer/release/lang/Korean.lng	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/installer/release/lang/Korean.lng	2015-01-23 08:47:39 UTC (rev 5765)
@@ -637,9 +637,12 @@
 DLG_KEYGEN_SAVEPRIVATE=\xB0\xB3\xC0\xCEŰ \xC0\xFA\xC0\xE5(&P)
 DLG_KEYGEN_GENERATE=\xBB\xFD\xBC\xBA(&G)
 DLG_KEYGEN_BITS=Ű\xBA\xF1Ʈ(&B):
-DLG_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_ROUNDS=&Number of rounds:
 
 MSG_KEYBITS_MIN_ERROR=Ű \xBA\xF1Ʈ\xB0\xA1 \xB3ʹ\xAB \xC0۽\xC0\xB4ϴ\xD9.
+MSG_BCRYPT_ROUNDS_MIN_ERROR=The number of rounds is too small.
+MSG_BCRYPT_ROUNDS_MAX_ERROR=The number of rounds is too large.
 MSG_KEYGEN_GENERATING="Ű \xBB\xFD\xBC\xBA \xC1\xDF"
 MSG_KEYGEN_GENERATED="Ű \xBB\xFD\xBC\xBA\xB5\xCA"
 

Modified: trunk/installer/release/lang/Russian.lng
===================================================================
--- trunk/installer/release/lang/Russian.lng	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/installer/release/lang/Russian.lng	2015-01-23 08:47:39 UTC (rev 5765)
@@ -636,9 +636,12 @@
 DLG_KEYGEN_SAVEPRIVATE=&\xC7\xE0\xEA\xF0\xFB\xF2\xFB\xE9 \xEA\xEB\xFE\xF7
 DLG_KEYGEN_GENERATE=&\xC3\xE5\xED\xE5\xF0\xE0\xF6\xE8\xFF
 DLG_KEYGEN_BITS=&\xC1\xE8\xF2\xFB:
-DLG_BCRYPT_KDF=\xF5\xE5\xF8 "bcrypt" &KDF
+DLG_KEYGEN_BCRYPT_KDF=\xF5\xE5\xF8 "bcrypt" &KDF
+DLG_KEYGEN_BCRYPT_ROUNDS=&Number of rounds:
 
 MSG_KEYBITS_MIN_ERROR=\xC1\xE8\xF2\xEE\xE2 \xEA\xEB\xFE\xF7\xE0 \xF1\xEB\xE8\xF8\xEA\xEE\xEC \xEC\xE0\xEB\xEE!
+MSG_BCRYPT_ROUNDS_MIN_ERROR=The number of rounds is too small.
+MSG_BCRYPT_ROUNDS_MAX_ERROR=The number of rounds is too large.
 MSG_KEYGEN_GENERATING="\xC3\xE5\xED\xE5\xF0\xE0\xF6\xE8\xFF \xEA\xEB\xFE\xF7\xE0..."
 MSG_KEYGEN_GENERATED="\xCA\xEB\xFE\xF7 \xF1\xE3\xE5\xED\xE5\xF0\xE8\xF0\xEE\xE2\xE0\xED \xF3\xF1\xEF\xE5\xF8\xED\xEE!"
 

Modified: trunk/installer/release/lang/Simplified Chinese.lng
===================================================================
--- trunk/installer/release/lang/Simplified Chinese.lng	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/installer/release/lang/Simplified Chinese.lng	2015-01-23 08:47:39 UTC (rev 5765)
@@ -637,9 +637,12 @@
 DLG_KEYGEN_SAVEPRIVATE=\xB1\xA3\xB4\xE6Ϊ˽\xD3\xD0\xC3\xDCԿ(&P)
 DLG_KEYGEN_GENERATE=\xC9\xFA\xB3\xC9(&G)
 DLG_KEYGEN_BITS=\xC3\xDCԿ\xD7ֽ\xDA\xCA\xFD(&B)\xA3\xBA
-DLG_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_ROUNDS=&Number of rounds:
 
 MSG_KEYBITS_MIN_ERROR=\xC3\xDCԿ\xD7ֽ\xDA\xCA\xFD̫С
+MSG_BCRYPT_ROUNDS_MIN_ERROR=The number of rounds is too small.
+MSG_BCRYPT_ROUNDS_MAX_ERROR=The number of rounds is too large.
 MSG_KEYGEN_GENERATING=\xD5\xFD\xD4\xDA\xC9\xFA\xB3\xC9\xC3\xDCԿ
 MSG_KEYGEN_GENERATED=\xD2\xD1\xC9\xFA\xB3\xC9\xC3\xDCԿ
 

Modified: trunk/installer/release/lang/Traditional Chinese.lng
===================================================================
--- trunk/installer/release/lang/Traditional Chinese.lng	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/installer/release/lang/Traditional Chinese.lng	2015-01-23 08:47:39 UTC (rev 5765)
@@ -637,9 +637,12 @@
 DLG_KEYGEN_SAVEPRIVATE=\xC0x\xA6s\xAC\xB0\xA8p\xA6\xB3\xB1K\xC6_(&P)
 DLG_KEYGEN_GENERATE=\xA5ͦ\xA8(&G)
 DLG_KEYGEN_BITS=\xB1K\xC6_\xA6r\xB8`\xBC\xC6(&B)\xA1G
-DLG_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_KDF=bcrypt &KDF format
+DLG_KEYGEN_BCRYPT_ROUNDS=&Number of rounds:
 
 MSG_KEYBITS_MIN_ERROR=\xB1K\xC6_\xA6r\xB8`\xBCƤӤp
+MSG_BCRYPT_ROUNDS_MIN_ERROR=The number of rounds is too small.
+MSG_BCRYPT_ROUNDS_MAX_ERROR=The number of rounds is too large.
 MSG_KEYGEN_GENERATING=\xA5\xBF\xA6b\xA5ͦ\xA8\xB1K\xC6_
 MSG_KEYGEN_GENERATED=\xA4w\xA5ͦ\xA8\xB1K\xC6_
 

Modified: trunk/ttssh2/ttxssh/resource.h
===================================================================
--- trunk/ttssh2/ttxssh/resource.h	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/ttssh2/ttxssh/resource.h	2015-01-23 08:47:39 UTC (rev 5765)
@@ -181,7 +181,9 @@
 #define IDC_KEYBITS                     1106
 #define IDC_KEYGEN_PROGRESS_LABEL       1107
 #define IDC_PROGBAR                     1108
+#define IDC_BCRYPT_KDF_ROUNDS_LABEL     1108
 #define IDC_PROGTIME                    1109
+#define IDC_BCRYPT_KDF_ROUNDS           1109
 #define IDC_HOSTSSHFPCHECK              1110
 #define IDC_HOSTSSHFPDNSSEC             1111
 #define IDC_VERIFYHOSTKEYDNS            1112

Modified: trunk/ttssh2/ttxssh/ssh.h
===================================================================
--- trunk/ttssh2/ttxssh/ssh.h	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/ttssh2/ttxssh/ssh.h	2015-01-23 08:47:39 UTC (rev 5765)
@@ -334,7 +334,10 @@
 #define SSH_RSA_MINIMUM_KEY_SIZE   768
 #define SSH_DSA_MINIMUM_KEY_SIZE  1024
 
+#define SSH_KEYGEN_MINIMUM_ROUNDS       1
+#define SSH_KEYGEN_MAXIMUM_ROUNDS INT_MAX
 
+
 typedef struct ssh2_cipher {
 	SSHCipher cipher;
 	char *name;

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2015-01-23 08:47:39 UTC (rev 5765)
@@ -4182,11 +4182,10 @@
 
 // bcrypt KDF\x8C`\x8E\xAE\x82Ŕ閧\x8C\xAE\x82\xF0\x95ۑ\xB6\x82\xB7\x82\xE9
 // based on OpenSSH 6.5:key_save_private(), key_private_to_blob2()
-static void save_bcrypt_private_key(char *passphrase, char *filename, char *comment, HWND dlg, PTInstVar pvar)
+static void save_bcrypt_private_key(char *passphrase, char *filename, char *comment, HWND dlg, PTInstVar pvar, int rounds)
 {
 	SSHCipher ciphernameval = SSH_CIPHER_NONE;
 	char *ciphername = DEFAULT_CIPHERNAME;
-	int rounds = DEFAULT_ROUNDS;
 	buffer_t *b = NULL;
 	buffer_t *kdf = NULL;
 	buffer_t *encoded = NULL;
@@ -4371,8 +4370,11 @@
 		UTIL_get_lang_msg("BTN_CLOSE", pvar, uimsg);
 		SetDlgItemText(dlg, IDCANCEL, pvar->ts->UIMsg);
 		GetDlgItemText(dlg, IDC_BCRYPT_KDF_CHECK, uimsg, sizeof(uimsg));
-		UTIL_get_lang_msg("DLG_BCRYPT_KDF", pvar, uimsg);
+		UTIL_get_lang_msg("DLG_KEYGEN_BCRYPT_KDF", pvar, uimsg);
 		SetDlgItemText(dlg, IDC_BCRYPT_KDF_CHECK, pvar->ts->UIMsg);
+		GetDlgItemText(dlg, IDC_BCRYPT_KDF_ROUNDS_LABEL, uimsg, sizeof(uimsg));
+		UTIL_get_lang_msg("DLG_KEYGEN_BCRYPT_ROUNDS", pvar, uimsg);
+		SetDlgItemText(dlg, IDC_BCRYPT_KDF_ROUNDS_LABEL, pvar->ts->UIMsg);
 
 		font = (HFONT)SendMessage(dlg, WM_GETFONT, 0, 0);
 		GetObject(font, sizeof(LOGFONT), &logfont);
@@ -4399,6 +4401,8 @@
 			SendDlgItemMessage(dlg, IDOK, WM_SETFONT, (WPARAM)DlgKeygenFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDCANCEL, WM_SETFONT, (WPARAM)DlgKeygenFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_BCRYPT_KDF_CHECK, WM_SETFONT, (WPARAM)DlgKeygenFont, MAKELPARAM(TRUE,0));
+			SendDlgItemMessage(dlg, IDC_BCRYPT_KDF_ROUNDS_LABEL, WM_SETFONT, (WPARAM)DlgKeygenFont, MAKELPARAM(TRUE,0));
+			SendDlgItemMessage(dlg, IDC_BCRYPT_KDF_ROUNDS, WM_SETFONT, (WPARAM)DlgKeygenFont, MAKELPARAM(TRUE,0));
 		}
 		else {
 			DlgHostFont = NULL;
@@ -4429,6 +4433,9 @@
 
 		// default bcrypt KDF
 		EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), TRUE);
+		EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), FALSE);
+		SetDlgItemInt(dlg, IDC_BCRYPT_KDF_ROUNDS, DEFAULT_ROUNDS, FALSE);
+		SendDlgItemMessage(dlg, IDC_BCRYPT_KDF_ROUNDS, EM_LIMITTEXT, 4, 0);
 
 		}
 		return TRUE;
@@ -4555,6 +4562,7 @@
 			}
 			SendMessage(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), BM_SETCHECK, BST_UNCHECKED, 0);
 			EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), FALSE);
+			EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), FALSE);
 			key_type = KEY_RSA1;
 			break;
 
@@ -4564,6 +4572,12 @@
 				SetDlgItemInt(dlg, IDC_KEYBITS, saved_key_bits, FALSE);
 			}
 			EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), TRUE);
+			if (SendMessage(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), BM_GETCHECK, 0, 0) == BST_CHECKED) {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), TRUE);
+			}
+			else {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), FALSE);
+			}
 			key_type = KEY_RSA;
 			break;
 
@@ -4573,6 +4587,12 @@
 				saved_key_bits = GetDlgItemInt(dlg, IDC_KEYBITS, NULL, FALSE);
 			}
 			EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), TRUE);
+			if (SendMessage(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), BM_GETCHECK, 0, 0) == BST_CHECKED) {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), TRUE);
+			}
+			else {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), FALSE);
+			}
 			key_type = KEY_DSA;
 			SetDlgItemInt(dlg, IDC_KEYBITS, 1024, FALSE);
 			break;
@@ -4583,6 +4603,12 @@
 				saved_key_bits = GetDlgItemInt(dlg, IDC_KEYBITS, NULL, FALSE);
 			}
 			EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), TRUE);
+			if (SendMessage(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), BM_GETCHECK, 0, 0) == BST_CHECKED) {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), TRUE);
+			}
+			else {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), FALSE);
+			}
 			key_type = KEY_ECDSA256;
 			SetDlgItemInt(dlg, IDC_KEYBITS, 256, FALSE);
 			break;
@@ -4593,6 +4619,12 @@
 				saved_key_bits = GetDlgItemInt(dlg, IDC_KEYBITS, NULL, FALSE);
 			}
 			EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), TRUE);
+			if (SendMessage(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), BM_GETCHECK, 0, 0) == BST_CHECKED) {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), TRUE);
+			}
+			else {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), FALSE);
+			}
 			key_type = KEY_ECDSA384;
 			SetDlgItemInt(dlg, IDC_KEYBITS, 384, FALSE);
 			break;
@@ -4603,6 +4635,12 @@
 				saved_key_bits = GetDlgItemInt(dlg, IDC_KEYBITS, NULL, FALSE);
 			}
 			EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), TRUE);
+			if (SendMessage(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), BM_GETCHECK, 0, 0) == BST_CHECKED) {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), TRUE);
+			}
+			else {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), FALSE);
+			}
 			key_type = KEY_ECDSA521;
 			SetDlgItemInt(dlg, IDC_KEYBITS, 521, FALSE);
 			break;
@@ -4615,10 +4653,20 @@
 			}
 			SendMessage(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), BM_SETCHECK, BST_CHECKED, 0);
 			EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), FALSE);
+			EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), TRUE);
 			key_type = KEY_ED25519;
 			SetDlgItemInt(dlg, IDC_KEYBITS, 256, FALSE);
 			break;
 
+		case IDC_BCRYPT_KDF_CHECK | (BN_CLICKED << 16):
+			if (SendMessage(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), BM_GETCHECK, 0, 0) == BST_CHECKED) {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), TRUE);
+			}
+			else {
+				EnableWindow(GetDlgItem(dlg, IDC_BCRYPT_KDF_ROUNDS), FALSE);
+			}
+			break;
+
 		// saving public key file
 		case IDC_SAVE_PUBLIC_KEY:
 			{
@@ -4795,7 +4843,7 @@
 		case IDC_SAVE_PRIVATE_KEY:
 			{
 			char buf[1024], buf_conf[1024];  // passphrase
-			int ret;
+			int ret, rounds;
 			OPENFILENAME ofn;
 			char filename[MAX_PATH];
 			char comment[1024]; // comment string in private key
@@ -4825,6 +4873,25 @@
 					break;
 			}
 
+			// number of rounds
+			if (SendMessage(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), BM_GETCHECK, 0, 0) == BST_CHECKED) {
+				rounds = GetDlgItemInt(dlg, IDC_BCRYPT_KDF_ROUNDS, NULL, FALSE);
+				if (rounds < SSH_KEYGEN_MINIMUM_ROUNDS) {
+					UTIL_get_lang_msg("MSG_BCRYPT_ROUNDS_MIN_ERROR", pvar,
+					                  "The number of rounds is too small.");
+					MessageBox(dlg, pvar->ts->UIMsg,
+					           "Tera Term", MB_OK | MB_ICONEXCLAMATION);
+					break;
+				}
+				if (rounds > SSH_KEYGEN_MAXIMUM_ROUNDS) {
+					UTIL_get_lang_msg("MSG_BCRYPT_ROUNDS_MAX_ERROR", pvar,
+					                  "The number of rounds is too large.");
+					MessageBox(dlg, pvar->ts->UIMsg,
+					           "Tera Term", MB_OK | MB_ICONEXCLAMATION);
+					break;
+				}
+			}
+
 			ssh_make_comment(comment, sizeof(comment));
 
 			// saving file dialog
@@ -5001,7 +5068,7 @@
 				buffer_free(enc);
 
 			} else if (private_key.type == KEY_ED25519) { // SSH2 ED25519 
-				save_bcrypt_private_key(buf, filename, comment, dlg, pvar);
+				save_bcrypt_private_key(buf, filename, comment, dlg, pvar, rounds);
 
 			} else { // SSH2 RSA, DSA, ECDSA			
 				int len;
@@ -5009,7 +5076,7 @@
 				const EVP_CIPHER *cipher;
 
 				if (SendMessage(GetDlgItem(dlg, IDC_BCRYPT_KDF_CHECK), BM_GETCHECK, 0, 0) == BST_CHECKED) {
-					save_bcrypt_private_key(buf, filename, comment, dlg, pvar);
+					save_bcrypt_private_key(buf, filename, comment, dlg, pvar, rounds);
 					break;
 				}
 

Modified: trunk/ttssh2/ttxssh/ttxssh.rc
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.rc	2015-01-23 06:02:15 UTC (rev 5764)
+++ trunk/ttssh2/ttxssh/ttxssh.rc	2015-01-23 08:47:39 UTC (rev 5765)
@@ -13,11 +13,13 @@
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-// \x93\xFA\x96{\x8C\xEA (\x93\xFA\x96{) resources
+// \x93\xFA\x96{\x8C\xEA resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
+#ifdef _WIN32
 LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
 #pragma code_page(932)
+#endif //_WIN32
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -40,7 +42,7 @@
 //
 
 #ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
+GUIDELINES DESIGNINFO 
 BEGIN
     IDD_SFTP_DIALOG, DIALOG
     BEGIN
@@ -52,7 +54,7 @@
 END
 #endif    // APSTUDIO_INVOKED
 
-#endif    // \x93\xFA\x96{\x8C\xEA (\x93\xFA\x96{) resources
+#endif    // \x93\xFA\x96{\x8C\xEA resources
 /////////////////////////////////////////////////////////////////////////////
 
 
@@ -60,8 +62,10 @@
 // \x89p\x8C\xEA (\x95č\x91) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 #pragma code_page(1252)
+#endif //_WIN32
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -345,18 +349,20 @@
     CONTROL         "ECDSA-&384",IDC_ECDSA384_TYPE,"Button",BS_AUTORADIOBUTTON,80,29,55,10
     CONTROL         "ECDSA-&521",IDC_ECDSA521_TYPE,"Button",BS_AUTORADIOBUTTON,17,41,55,10
     CONTROL         "&ED25519",IDC_ED25519_TYPE,"Button",BS_AUTORADIOBUTTON,80,42,45,10
-    CONTROL         "bcrypt KDF format",IDC_BCRYPT_KDF_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,58,93,10
     RTEXT           "Key &Bits:",IDC_KEYBITS_LABEL,143,14,40,10,NOT WS_GROUP
     EDITTEXT        IDC_KEYBITS,155,26,25,12,ES_AUTOHSCROLL | ES_NUMBER | WS_GROUP
-    LTEXT           "",IDC_KEYGEN_PROGRESS_LABEL,40,74,172,8
-    RTEXT           "Key passphrase:",IDC_KEY_LABEL,14,89,80,8
-    EDITTEXT        IDC_KEY_EDIT,100,87,108,12,ES_PASSWORD | ES_AUTOHSCROLL
-    RTEXT           "Confirm passphrase:",IDC_CONFIRM_LABEL,14,104,80,8
-    EDITTEXT        IDC_CONFIRM_EDIT,100,103,108,12,ES_PASSWORD | ES_AUTOHSCROLL
-    RTEXT           "C&omment:",IDC_COMMENT_LABEL,14,119,80,8
-    EDITTEXT        IDC_COMMENT_EDIT,100,118,108,12,ES_AUTOHSCROLL
-    PUSHBUTTON      "Save publi&c key",IDC_SAVE_PUBLIC_KEY,49,136,68,14
-    PUSHBUTTON      "Save &private key",IDC_SAVE_PRIVATE_KEY,133,136,68,14
+    LTEXT           "",IDC_KEYGEN_PROGRESS_LABEL,40,58,172,8
+    RTEXT           "Key passphrase:",IDC_KEY_LABEL,14,73,80,8
+    EDITTEXT        IDC_KEY_EDIT,100,72,108,12,ES_PASSWORD | ES_AUTOHSCROLL
+    RTEXT           "Confirm passphrase:",IDC_CONFIRM_LABEL,14,88,80,8
+    EDITTEXT        IDC_CONFIRM_EDIT,100,87,108,12,ES_PASSWORD | ES_AUTOHSCROLL
+    RTEXT           "C&omment:",IDC_COMMENT_LABEL,14,103,80,8
+    EDITTEXT        IDC_COMMENT_EDIT,100,102,108,12,ES_AUTOHSCROLL
+    CONTROL         "bcrypt &KDF format",IDC_BCRYPT_KDF_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,118,80,10
+    RTEXT           "&Number of rounds:",IDC_BCRYPT_KDF_ROUNDS_LABEL,100,118,77,10,NOT WS_GROUP
+    EDITTEXT        IDC_BCRYPT_KDF_ROUNDS,182,117,25,12,ES_AUTOHSCROLL | ES_NUMBER | WS_GROUP
+    PUSHBUTTON      "Save publi&c key",IDC_SAVE_PUBLIC_KEY,49,135,68,14
+    PUSHBUTTON      "Save &private key",IDC_SAVE_PRIVATE_KEY,133,135,68,14
 END
 
 IDD_SSHSCP DIALOGEX 0, 0, 279, 125
@@ -437,7 +443,7 @@
 //
 
 #ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
+GUIDELINES DESIGNINFO 
 BEGIN
     IDD_ABOUTDIALOG, DIALOG
     BEGIN



Ttssh2-commit メーリングリストの案内
Back to archive index