[Ttssh2-commit] [5900] DH-GEXで要求するgroupサイズの最小値を指定できるようにした。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2015年 6月 2日 (火) 18:07:36 JST


Revision: 5900
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5900
Author:   doda
Date:     2015-06-02 18:07:33 +0900 (Tue, 02 Jun 2015)
Log Message:
-----------
DH-GEXで要求するgroupサイズの最小値を指定できるようにした。

Modified Paths:
--------------
    trunk/installer/release/TERATERM.INI
    trunk/ttssh2/ttxssh/kex.h
    trunk/ttssh2/ttxssh/ssh.c
    trunk/ttssh2/ttxssh/ttxssh.c
    trunk/ttssh2/ttxssh/ttxssh.h

-------------- next part --------------
Modified: trunk/installer/release/TERATERM.INI
===================================================================
--- trunk/installer/release/TERATERM.INI	2015-05-31 11:47:12 UTC (rev 5899)
+++ trunk/installer/release/TERATERM.INI	2015-06-02 09:07:33 UTC (rev 5900)
@@ -747,6 +747,8 @@
 ;  6...ecdh-sha2-nistp521
 ;  7...KEXs below this line are disabled.
 KexOrder=56743210
+; minimal size in bits of an acceptable group in SSH_MSG_KEY_DH_GEX_REQUEST packet
+GexMinimalGroupSize=0
 
 ; Host Key algorithm order(SSH2)
 ;  2...RSA

Modified: trunk/ttssh2/ttxssh/kex.h
===================================================================
--- trunk/ttssh2/ttxssh/kex.h	2015-05-31 11:47:12 UTC (rev 5899)
+++ trunk/ttssh2/ttxssh/kex.h	2015-06-02 09:07:33 UTC (rev 5900)
@@ -28,6 +28,9 @@
 
 #include "ttxssh.h"
 
+#define GEX_GRP_MINSIZE 1024
+#define GEX_GRP_MAXSIZE 8192
+
 DH *dh_new_group1(void);
 DH *dh_new_group14(void);
 void dh_gen_key(PTInstVar pvar, DH *dh, int we_need /* bytes */ );

Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2015-05-31 11:47:12 UTC (rev 5899)
+++ trunk/ttssh2/ttxssh/ssh.c	2015-06-02 09:07:33 UTC (rev 5900)
@@ -5200,9 +5200,23 @@
 	}
 
 	// \x83T\x81[\x83o\x82\xAA\x95ۏ؂\xB7\x82ׂ\xAB\x8DŒ\xE1\x8C\xC0\x82̃r\x83b\x83g\x90\x94\x82\xF0\x8B\x81\x82߂\xE9\x81iwe_need\x82̓o\x83C\x83g\x81j\x81B
+	if (pvar->settings.GexMinimalGroupSize < GEX_GRP_MINSIZE) {
+		min = GEX_GRP_MINSIZE;
+	}
+	else if (pvar->settings.GexMinimalGroupSize > GEX_GRP_MAXSIZE) {
+		min = GEX_GRP_MAXSIZE;
+	}
+	else {
+		min = pvar->settings.GexMinimalGroupSize;
+	}
+	max = GEX_GRP_MAXSIZE;
 	bits = dh_estimate(pvar->we_need * 8);
-	min = 1024;
-	max = 8192;
+	if (bits < min) {
+		bits = min;
+	}
+	else if (bits > max) {
+		bits = max;
+	}
 
 	// \x83T\x81[\x83o\x82\xD6group size\x82𑗂\xC1\x82āAp \x82\xC6 g \x82\xF0\x8D\xEC\x82\xC1\x82Ă\xE0\x82炤\x81B
 	buffer_put_int(msg, min);

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2015-05-31 11:47:12 UTC (rev 5899)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2015-06-02 09:07:33 UTC (rev 5900)
@@ -477,6 +477,8 @@
 
 	settings->UpdateHostkeys = GetPrivateProfileInt("TTSSH", "UpdateHostkeys", 0, fileName);
 
+	settings->GexMinimalGroupSize = GetPrivateProfileInt("TTSSH", "GexMinimalGroupSize", 0, fileName);
+
 	clear_local_settings(pvar);
 }
 
@@ -586,6 +588,9 @@
 	_snprintf_s(buf, sizeof(buf), _TRUNCATE,
 		"%d", settings->UpdateHostkeys);
 	WritePrivateProfileString("TTSSH", "UpdateHostkeys", buf, fileName);
+
+	_itoa_s(settings->GexMinimalGroupSize, buf, sizeof(buf), 10);
+	WritePrivateProfileString("TTSSH", "GexMinimalGroupSize", buf, fileName);
 }
 
 

Modified: trunk/ttssh2/ttxssh/ttxssh.h
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.h	2015-05-31 11:47:12 UTC (rev 5899)
+++ trunk/ttssh2/ttxssh/ttxssh.h	2015-06-02 09:07:33 UTC (rev 5900)
@@ -170,6 +170,8 @@
 	char X11Display[128];
 
 	BOOL UpdateHostkeys;
+
+	int GexMinimalGroupSize;
 } TS_SSH;
 
 typedef struct _TInstVar {



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