svnno****@sourc*****
svnno****@sourc*****
2011年 3月 30日 (水) 21:24:00 JST
Revision: 4407 http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4407 Author: maya Date: 2011-03-30 21:24:00 +0900 (Wed, 30 Mar 2011) Log Message: ----------- SSH1 ã§èªè¨¼æ å ±ãéãé \0 ãè©°ãã¦æåæ°ã 32 ã®åæ°ã«åãä¸ãã¦ãããã ãµã¼ãã OpenSSH 5.8 以éã ã¨æ¥ç¶ã§ããªãã®ã§åãä¸ããªãããã«ããã http://www.openssh.com/cgi-bin/cvsweb/src/usr.bin/ssh/bufaux.c#rev1.50 Revision Links: -------------- http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=1 Modified Paths: -------------- trunk/ttssh2/ttxssh/ssh.c -------------- next part -------------- Modified: trunk/ttssh2/ttxssh/ssh.c =================================================================== --- trunk/ttssh2/ttxssh/ssh.c 2011-03-30 12:10:17 UTC (rev 4406) +++ trunk/ttssh2/ttxssh/ssh.c 2011-03-30 12:24:00 UTC (rev 4407) @@ -2407,13 +2407,6 @@ return FALSE; } -#define OBFUSCATING_ROUND_TO 32 - -static int obfuscating_round_up(PTInstVar pvar, int size) -{ - return (size + OBFUSCATING_ROUND_TO - 1) & ~(OBFUSCATING_ROUND_TO - 1); -} - static void try_send_credentials(PTInstVar pvar) { if ((pvar->ssh_state.status_flags & STATUS_DONT_SEND_CREDENTIALS) == 0) { @@ -2436,19 +2429,16 @@ return; case SSH_AUTH_PASSWORD:{ int len = strlen(cred->password); - // Round up password length to discourage traffic analysis - int obfuscated_len = obfuscating_round_up(pvar, len); unsigned char FAR *outmsg = begin_send_packet(pvar, SSH_CMSG_AUTH_PASSWORD, - 4 + obfuscated_len); + 4 + len); notify_verbose_message(pvar, "Trying PASSWORD authentication...", LOG_LEVEL_VERBOSE); - set_uint32(outmsg, obfuscated_len); + set_uint32(outmsg, len); memcpy(outmsg + 4, cred->password, len); - memset(outmsg + 4 + len, 0, obfuscated_len - len); // ZbV¡»ÉpX[hðg¢ñµ½¢ÌÅA±±ÅÌ\[XðúÍâßéB // socket closeÉà±ÌÖÍÄÎêÄ¢éÌÅA½ÔñâèÈ¢B(2005.4.8 yutaka) @@ -2564,22 +2554,21 @@ begin_send_packet(pvar, SSH_CMSG_AUTH_TIS, 0); notify_verbose_message(pvar, - "Trying TIS authentication...", - LOG_LEVEL_VERBOSE); + "Trying TIS authentication...", + LOG_LEVEL_VERBOSE); enque_handlers(pvar, 2, TIS_msgs, TIS_handlers); } else { int len = strlen(cred->password); - int obfuscated_len = obfuscating_round_up(pvar, len); unsigned char FAR *outmsg = begin_send_packet(pvar, SSH_CMSG_AUTH_TIS_RESPONSE, - 4 + obfuscated_len); + 4 + len); - notify_verbose_message(pvar, "Sending TIS response", - LOG_LEVEL_VERBOSE); + notify_verbose_message(pvar, + "Sending TIS response", + LOG_LEVEL_VERBOSE); - set_uint32(outmsg, obfuscated_len); + set_uint32(outmsg, len); memcpy(outmsg + 4, cred->password, len); - memset(outmsg + 4 + len, 0, obfuscated_len - len); enque_simple_auth_handlers(pvar); } @@ -2609,18 +2598,16 @@ if (username != NULL) { int len = strlen(username); - int obfuscated_len = obfuscating_round_up(pvar, len); unsigned char FAR *outmsg = - begin_send_packet(pvar, SSH_CMSG_USER, 4 + obfuscated_len); + begin_send_packet(pvar, SSH_CMSG_USER, 4 + len); char buf[1024] = "Sending user name: "; static const int msgs[] = { SSH_SMSG_SUCCESS, SSH_SMSG_FAILURE }; static const SSHPacketHandler handlers[] = { handle_noauth_success, handle_auth_required }; - set_uint32(outmsg, obfuscated_len); + set_uint32(outmsg, len); memcpy(outmsg + 4, username, len); - memset(outmsg + 4 + len, 0, obfuscated_len - len); finish_send_packet(pvar); pvar->ssh_state.status_flags |= STATUS_DONT_SEND_USER_NAME;