[Ttssh2-commit] [4433] Camellia サポート

svnno****@sourc***** svnno****@sourc*****
2011年 4月 11日 (月) 09:29:12 JST


Revision: 4433
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4433
Author:   doda
Date:     2011-04-11 09:29:12 +0900 (Mon, 11 Apr 2011)

Log Message:
-----------
Camellia サポート

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/cipher-ctr.c
    trunk/ttssh2/ttxssh/crypt.c
    trunk/ttssh2/ttxssh/ssh.c
    trunk/ttssh2/ttxssh/ssh.h
    trunk/ttssh2/ttxssh/ttxssh.c
    trunk/ttssh2/ttxssh/ttxssh.rc

Added Paths:
-----------
    trunk/ttssh2/ttxssh/config.h


-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/cipher-ctr.c
===================================================================
--- trunk/ttssh2/ttxssh/cipher-ctr.c	2011-04-10 14:28:55 UTC (rev 4432)
+++ trunk/ttssh2/ttxssh/cipher-ctr.c	2011-04-11 00:29:12 UTC (rev 4433)
@@ -21,13 +21,21 @@
 #include <malloc.h>
 #include <string.h>
 
+#include "config.h"
+
 #include <openssl/evp.h>
 #include <openssl/aes.h>
 #include <openssl/des.h>
 #include <openssl/blowfish.h>
 #include <openssl/cast.h>
+#ifdef WITH_CAMELLIA_DRAFT
+#include <openssl/camellia.h>
+#endif // WITH_CAMELLIA_DRAFT
 
 extern const EVP_CIPHER *evp_aes_128_ctr(void);
+#ifdef WITH_CAMELLIA_DRAFT
+extern const EVP_CIPHER *evp_camellia_128_ctr(void);
+#endif // WITH_CAMELLIA_DRAFT
 
 struct ssh_aes_ctr_ctx
 {
@@ -54,6 +62,14 @@
 	unsigned char	cast5_counter[CAST_BLOCK];
 };
 
+#ifdef WITH_CAMELLIA_DRAFT
+struct ssh_camellia_ctr_ctx
+{
+	CAMELLIA_KEY	camellia_ctx;
+	unsigned char	camellia_counter[CAMELLIA_BLOCK_SIZE];
+};
+#endif // WITH_CAMELLIA_DRAFT
+
 static void
 ssh_ctr_inc(unsigned char *ctr, unsigned int len)
 {
@@ -404,3 +420,91 @@
 #endif
 	return (&cast5_ctr);
 }
+
+#ifdef WITH_CAMELLIA_DRAFT
+//============================================================================
+// Camellia
+//============================================================================
+static int
+ssh_camellia_ctr(EVP_CIPHER_CTX *ctx, unsigned char *dest, const unsigned char *src, unsigned int len)
+{
+	struct ssh_camellia_ctr_ctx *c;
+	unsigned int n = 0;
+	unsigned char buf[CAMELLIA_BLOCK_SIZE];
+
+	if (len == 0)
+		return (1);
+	if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL)
+		return (0);
+
+	while ((len--) > 0) {
+		if (n == 0) {
+			Camellia_encrypt(c->camellia_counter, buf, &c->camellia_ctx);
+			ssh_ctr_inc(c->camellia_counter, CAMELLIA_BLOCK_SIZE);
+		}
+		*(dest++) = *(src++) ^ buf[n];
+		n = (n + 1) % CAMELLIA_BLOCK_SIZE;
+	}
+	return (1);
+}
+
+static int
+ssh_camellia_ctr_init(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc)
+{
+	struct ssh_camellia_ctr_ctx *c;
+
+	if ((c = EVP_CIPHER_CTX_get_app_data(ctx)) == NULL) {
+		c = malloc(sizeof(*c));
+		EVP_CIPHER_CTX_set_app_data(ctx, c);
+	}
+	if (key != NULL)
+		Camellia_set_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &c->camellia_ctx);
+	if (iv != NULL)
+		memcpy(c->camellia_counter, iv, CAMELLIA_BLOCK_SIZE);
+	return (1);
+}
+
+static int
+ssh_camellia_ctr_cleanup(EVP_CIPHER_CTX *ctx)
+{
+	struct ssh_camellia_ctr_ctx *c;
+
+	if((c = EVP_CIPHER_CTX_get_app_data(ctx)) != NULL) {
+		memset(c, 0, sizeof(*c));
+		free(c);
+		EVP_CIPHER_CTX_set_app_data(ctx, NULL);
+	}
+	return (1);
+}
+
+void
+ssh_camellia_ctr_iv(EVP_CIPHER_CTX *evp, int doset, unsigned char * iv, unsigned int len)
+{
+	struct ssh_camellia_ctr_ctx *c;
+
+	if ((c = EVP_CIPHER_CTX_get_app_data(evp)) != NULL)
+		if(doset)
+			memcpy(c->camellia_counter, iv, len);
+		else
+			memcpy(iv, c->camellia_counter, len);
+}
+
+const EVP_CIPHER *
+evp_camellia_128_ctr(void)
+{
+	static EVP_CIPHER camellia_ctr;
+
+	memset(&camellia_ctr, 0, sizeof(EVP_CIPHER));
+	camellia_ctr.nid = NID_undef;
+	camellia_ctr.block_size = CAMELLIA_BLOCK_SIZE;
+	camellia_ctr.iv_len = CAMELLIA_BLOCK_SIZE;
+	camellia_ctr.key_len = 16;
+	camellia_ctr.init = ssh_camellia_ctr_init;
+	camellia_ctr.cleanup = ssh_camellia_ctr_cleanup;
+	camellia_ctr.do_cipher = ssh_camellia_ctr;
+#ifndef SSH_OLD_EVP
+	camellia_ctr.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CUSTOM_IV;
+#endif
+	return (&camellia_ctr);
+}
+#endif // WITH_CAMELLIA_DRAFT

Added: trunk/ttssh2/ttxssh/config.h
===================================================================
--- trunk/ttssh2/ttxssh/config.h	                        (rev 0)
+++ trunk/ttssh2/ttxssh/config.h	2011-04-11 00:29:12 UTC (rev 4433)
@@ -0,0 +1,12 @@
+// HMAC-SHA2 draft
+// http://tools.ietf.org/html/draft-dbider-sha2-mac-for-ssh-02
+#undef HMAC_SHA2_DRAFT
+
+// Camellia support draft
+// http://tools.ietf.org/html/draft-kanno-secsh-camellia-02
+#undef WITH_CAMELLIA_DRAFT
+#undef WITH_CAMELLIA_PRIVATE
+
+#if defined(WITH_CAMELLIA_PRIVATE) && !defined(WITH_CAMELLIA_DRAFT)
+#define WITH_CAMELLIA_DRAFT
+#endif

Modified: trunk/ttssh2/ttxssh/crypt.c
===================================================================
--- trunk/ttssh2/ttxssh/crypt.c	2011-04-10 14:28:55 UTC (rev 4432)
+++ trunk/ttssh2/ttxssh/crypt.c	2011-04-11 00:29:12 UTC (rev 4433)
@@ -647,7 +647,86 @@
 	free(newbuf);
 }
 
+#ifdef WITH_CAMELLIA_DRAFT
+static void cCamellia_encrypt(PTInstVar pvar, unsigned char FAR * buf,
+                             int bytes)
+{
+	unsigned char *newbuf = malloc(bytes);
+	int block_size = pvar->ssh2_keys[MODE_OUT].enc.block_size;
+	char tmp[80];
 
+	// Ž–‘O•œ†‰»‚É‚æ‚èA‘SƒyƒCƒ[ƒh‚ª•œ†‰»‚³‚ê‚Ä‚¢‚éê‡‚́A0ƒoƒCƒg‚É‚È‚éB(2004.11.7 yutaka)
+	if (bytes == 0)
+		goto error;
+
+	if (newbuf == NULL)
+		return;
+
+	if (bytes % block_size) {
+		UTIL_get_lang_msg("MSG_ENCRYPT_ERROR1", pvar,
+		                  "%s encrypt error(1): bytes %d (%d)");
+		_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, pvar->ts->UIMsg,
+		            "Camellia128/192/256", bytes, block_size);
+		notify_fatal_error(pvar, tmp);
+		goto error;
+	}
+
+	if (EVP_Cipher(&pvar->evpcip[MODE_OUT], newbuf, buf, bytes) == 0) {
+		UTIL_get_lang_msg("MSG_ENCRYPT_ERROR2", pvar, "%s encrypt error(2)");
+		_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, pvar->ts->UIMsg,
+		            "Camellia128/192/256");
+		notify_fatal_error(pvar, tmp);
+		goto error;
+
+	} else {
+		memcpy(buf, newbuf, bytes);
+
+	}
+
+error:
+	free(newbuf);
+}
+
+static void cCamellia_decrypt(PTInstVar pvar, unsigned char FAR * buf,
+                             int bytes)
+{
+	unsigned char *newbuf = malloc(bytes);
+	int block_size = pvar->ssh2_keys[MODE_IN].enc.block_size;
+	char tmp[80];
+
+	// Ž–‘O•œ†‰»‚É‚æ‚èA‘SƒyƒCƒ[ƒh‚ª•œ†‰»‚³‚ê‚Ä‚¢‚éê‡‚́A0ƒoƒCƒg‚É‚È‚éB(2004.11.7 yutaka)
+	if (bytes == 0)
+		goto error;
+
+	if (newbuf == NULL)
+		return;
+
+	if (bytes % block_size) {
+		UTIL_get_lang_msg("MSG_DECRYPT_ERROR1", pvar,
+		                  "%s decrypt error(1): bytes %d (%d)");
+		_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, pvar->ts->UIMsg,
+		            "Camellia128/192/256", bytes, block_size);
+		notify_fatal_error(pvar, tmp);
+		goto error;
+	}
+
+	if (EVP_Cipher(&pvar->evpcip[MODE_IN], newbuf, buf, bytes) == 0) {
+		UTIL_get_lang_msg("MSG_DECRYPT_ERROR2", pvar, "%s decrypt error(2)");
+		_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, pvar->ts->UIMsg,
+		            "Camellia128/192/256");
+		notify_fatal_error(pvar, tmp);
+		goto error;
+
+	} else {
+		memcpy(buf, newbuf, bytes);
+
+	}
+
+error:
+	free(newbuf);
+}
+#endif // WITH_CAMELLIA_DRAFT
+
 static void c3DES_encrypt(PTInstVar pvar, unsigned char FAR * buf,
                           int bytes)
 {
@@ -868,7 +947,7 @@
 
 	} else { // for SSH2(yutaka)
 		// SSH2‚ªƒTƒ|[ƒg‚·‚éƒf[ƒ^’ʐM—pƒAƒ‹ƒSƒŠƒYƒ€iŒöŠJŒ®ŒðŠ·—p‚Ƃ͕ʁj
-		cipher_mask = (1 << SSH2_CIPHER_3DES_CBC)
+		cipher_mask =((1 << SSH2_CIPHER_3DES_CBC)
 		            | (1 << SSH2_CIPHER_AES128_CBC)
 		            | (1 << SSH2_CIPHER_AES192_CBC)
 		            | (1 << SSH2_CIPHER_AES256_CBC)
@@ -882,7 +961,16 @@
 		            | (1 << SSH2_CIPHER_CAST128_CBC)
 		            | (1 << SSH2_CIPHER_3DES_CTR)
 		            | (1 << SSH2_CIPHER_BLOWFISH_CTR)
-		            | (1 << SSH2_CIPHER_CAST128_CTR);
+		            | (1 << SSH2_CIPHER_CAST128_CTR)
+#ifdef WITH_CAMELLIA_DRAFT
+		            | (1 << SSH2_CIPHER_CAMELLIA128_CBC)
+		            | (1 << SSH2_CIPHER_CAMELLIA192_CBC)
+		            | (1 << SSH2_CIPHER_CAMELLIA256_CBC)
+		            | (1 << SSH2_CIPHER_CAMELLIA128_CTR)
+		            | (1 << SSH2_CIPHER_CAMELLIA192_CTR)
+		            | (1 << SSH2_CIPHER_CAMELLIA256_CTR)
+#endif // WITH_CAMELLIA_DRAFT
+		);
 	}
 
 	sender_ciphers &= cipher_mask;
@@ -1455,6 +1543,33 @@
 				break;
 			}
 
+#ifdef WITH_CAMELLIA_DRAFT
+		case SSH2_CIPHER_CAMELLIA128_CBC:
+		case SSH2_CIPHER_CAMELLIA192_CBC:
+		case SSH2_CIPHER_CAMELLIA256_CBC:
+		case SSH2_CIPHER_CAMELLIA128_CTR:
+		case SSH2_CIPHER_CAMELLIA192_CTR:
+		case SSH2_CIPHER_CAMELLIA256_CTR:
+			{
+				struct Enc *enc;
+
+				enc = &pvar->ssh2_keys[MODE_OUT].enc;
+				cipher_init_SSH2(&pvar->evpcip[MODE_OUT],
+				                 enc->key, get_cipher_key_len(pvar->crypt_state.sender_cipher),
+				                 enc->iv, get_cipher_block_size(pvar->crypt_state.sender_cipher),
+				                 CIPHER_ENCRYPT,
+				                 get_cipher_EVP_CIPHER(pvar->crypt_state.sender_cipher),
+				                 get_cipher_discard_len(pvar->crypt_state.sender_cipher),
+				                 pvar);
+
+				//debug_print(10, enc->key, get_cipher_key_len(pvar->crypt_state.sender_cipher));
+				//debug_print(11, enc->iv, get_cipher_block_size(pvar->crypt_state.sender_cipher));
+
+				pvar->crypt_state.encrypt = cCamellia_encrypt;
+				break;
+			}
+#endif // WITH_CAMELLIA_DRAFT
+
 		case SSH_CIPHER_3DES:{
 				c3DES_init(encryption_key, &pvar->crypt_state.enc.c3DES);
 				pvar->crypt_state.encrypt = c3DES_encrypt;
@@ -1602,6 +1717,33 @@
 				break;
 			}
 
+#ifdef WITH_CAMELLIA_DRAFT
+		case SSH2_CIPHER_CAMELLIA128_CBC:
+		case SSH2_CIPHER_CAMELLIA192_CBC:
+		case SSH2_CIPHER_CAMELLIA256_CBC:
+		case SSH2_CIPHER_CAMELLIA128_CTR:
+		case SSH2_CIPHER_CAMELLIA192_CTR:
+		case SSH2_CIPHER_CAMELLIA256_CTR:
+			{
+				struct Enc *enc;
+
+				enc = &pvar->ssh2_keys[MODE_IN].enc;
+				cipher_init_SSH2(&pvar->evpcip[MODE_IN],
+				                 enc->key, get_cipher_key_len(pvar->crypt_state.receiver_cipher),
+				                 enc->iv, get_cipher_block_size(pvar->crypt_state.receiver_cipher),
+				                 CIPHER_DECRYPT,
+				                 get_cipher_EVP_CIPHER(pvar->crypt_state.receiver_cipher),
+				                 get_cipher_discard_len(pvar->crypt_state.receiver_cipher),
+				                 pvar);
+
+				//debug_print(12, enc->key, get_cipher_key_len(pvar->crypt_state.receiver_cipher));
+				//debug_print(13, enc->iv, get_cipher_block_size(pvar->crypt_state.receiver_cipher));
+
+				pvar->crypt_state.decrypt = cCamellia_decrypt;
+				break;
+			}
+#endif // WITH_CAMELLIA_DRAFT
+
 		case SSH_CIPHER_3DES:{
 				c3DES_init(decryption_key, &pvar->crypt_state.dec.c3DES);
 				pvar->crypt_state.decrypt = c3DES_decrypt;
@@ -1707,6 +1849,20 @@
 		return "Blowfish-CTR";
 	case SSH2_CIPHER_CAST128_CTR:
 		return "CAST-128-CTR";
+#ifdef WITH_CAMELLIA_DRAFT
+	case SSH2_CIPHER_CAMELLIA128_CBC:
+		return "Camellia128-CBC";
+	case SSH2_CIPHER_CAMELLIA192_CBC:
+		return "Camellia192-CBC";
+	case SSH2_CIPHER_CAMELLIA256_CBC:
+		return "Camellia256-CBC";
+	case SSH2_CIPHER_CAMELLIA128_CTR:
+		return "Camellia128-CTR";
+	case SSH2_CIPHER_CAMELLIA192_CTR:
+		return "Camellia192-CTR";
+	case SSH2_CIPHER_CAMELLIA256_CTR:
+		return "Camellia256-CTR";
+#endif // WITH_CAMELLIA_DRAFT
 
 	default:
 		return "Unknown";

Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2011-04-10 14:28:55 UTC (rev 4432)
+++ trunk/ttssh2/ttxssh/ssh.c	2011-04-11 00:29:12 UTC (rev 4433)
@@ -4168,7 +4168,7 @@
 // the caller is normalize_cipher_order()
 void SSH2_update_cipher_myproposal(PTInstVar pvar)
 {
-	static char buf[192]; // TODO: malloc()‚É‚·‚ׂ«
+	static char buf[512]; // TODO: malloc()‚É‚·‚ׂ«
 	int cipher;
 	int len, i;
 	char *c_str;
@@ -4230,6 +4230,47 @@
 			case SSH2_CIPHER_CAST128_CTR:
 				c_str = "cast128-ctr,";
 				break;
+#ifdef WITH_CAMELLIA_DRAFT
+#ifdef WITH_CAMELLIA_PRIVATE
+			case SSH2_CIPHER_CAMELLIA128_CBC:
+				c_str = "camellia128-cbc,camel****@opens*****,";
+				break;
+			case SSH2_CIPHER_CAMELLIA192_CBC:
+				c_str = "camellia192-cbc,camel****@opens*****,";
+				break;
+			case SSH2_CIPHER_CAMELLIA256_CBC:
+				c_str = "camellia256-cbc,camel****@opens*****,";
+				break;
+			case SSH2_CIPHER_CAMELLIA128_CTR:
+				c_str = "camellia128-ctr,camel****@opens*****,";
+				break;
+			case SSH2_CIPHER_CAMELLIA192_CTR:
+				c_str = "camellia192-ctr,camel****@opens*****,";
+				break;
+			case SSH2_CIPHER_CAMELLIA256_CTR:
+				c_str = "camellia256-ctr,camel****@opens*****,";
+				break;
+#else // WITH_CAMELLIA_PRIVATE
+			case SSH2_CIPHER_CAMELLIA128_CBC:
+				c_str = "camellia128-cbc,";
+				break;
+			case SSH2_CIPHER_CAMELLIA192_CBC:
+				c_str = "camellia192-cbc,";
+				break;
+			case SSH2_CIPHER_CAMELLIA256_CBC:
+				c_str = "camellia256-cbc,";
+				break;
+			case SSH2_CIPHER_CAMELLIA128_CTR:
+				c_str = "camellia128-ctr,";
+				break;
+			case SSH2_CIPHER_CAMELLIA192_CTR:
+				c_str = "camellia192-ctr,";
+				break;
+			case SSH2_CIPHER_CAMELLIA256_CTR:
+				c_str = "camellia256-ctr,";
+				break;
+#endif // WITH_CAMELLIA_PRIVATE
+#endif // WITH_CAMELLIA_DRAFT
 			default:
 				continue;
 		}
@@ -4457,7 +4498,7 @@
 static SSHCipher choose_SSH2_cipher_algorithm(char *server_proposal, char *my_proposal)
 {
 	SSHCipher cipher = SSH_CIPHER_NONE;
-	char str_cipher[16];
+	char str_cipher[32];
 	ssh2_cipher_t *ptr = ssh2_ciphers;
 
 	choose_SSH2_proposal(server_proposal, my_proposal, str_cipher, sizeof(str_cipher));
@@ -5902,6 +5943,14 @@
 	                       | 1 << SSH2_CIPHER_3DES_CTR
 	                       | 1 << SSH2_CIPHER_BLOWFISH_CTR
 	                       | 1 << SSH2_CIPHER_CAST128_CTR
+#ifdef WITH_CAMELLIA_DRAFT
+	                       | 1 << SSH2_CIPHER_CAMELLIA128_CBC
+	                       | 1 << SSH2_CIPHER_CAMELLIA192_CBC
+	                       | 1 << SSH2_CIPHER_CAMELLIA256_CBC
+	                       | 1 << SSH2_CIPHER_CAMELLIA128_CTR
+	                       | 1 << SSH2_CIPHER_CAMELLIA192_CTR
+	                       | 1 << SSH2_CIPHER_CAMELLIA256_CTR
+#endif // WITH_CAMELLIA_DRAFT
 	);
 	int type = (1 << SSH_AUTH_PASSWORD) | (1 << SSH_AUTH_RSA) |
 	           (1 << SSH_AUTH_TIS) | (1 << SSH_AUTH_PAGEANT);

Modified: trunk/ttssh2/ttxssh/ssh.h
===================================================================
--- trunk/ttssh2/ttxssh/ssh.h	2011-04-10 14:28:55 UTC (rev 4432)
+++ trunk/ttssh2/ttxssh/ssh.h	2011-04-11 00:29:12 UTC (rev 4433)
@@ -38,6 +38,7 @@
 #include <openssl/evp.h>
 
 #include "buffer.h"
+#include "config.h"
 
 #define DEBUG_PRINT_TO_FILE(base, msg, len) { \
 	static int count = 0; \
@@ -50,15 +51,10 @@
 extern const EVP_CIPHER *evp_des3_ctr(void);
 extern const EVP_CIPHER *evp_bf_ctr(void);
 extern const EVP_CIPHER *evp_cast5_ctr(void);
+#ifdef WITH_CAMELLIA_DRAFT
+extern const EVP_CIPHER *evp_camellia_128_ctr(void);
+#endif // WITH_CAMELLIA_DRAFT
 
-// yutaka
-#define SSH2_USE
-
-// HMAC-SHA2 draft
-// http://www.ietf.org/id/draft-dbider-sha2-mac-for-ssh-00.txt
-#undef HMAC_SHA2_DRAFT
-
-
 /* Some of this code has been adapted from Ian Goldberg's Pilot SSH */
 
 typedef enum {
@@ -95,7 +91,13 @@
 	SSH2_CIPHER_ARCFOUR, SSH2_CIPHER_ARCFOUR128, SSH2_CIPHER_ARCFOUR256,
 	SSH2_CIPHER_CAST128_CBC,
 	SSH2_CIPHER_3DES_CTR, SSH2_CIPHER_BLOWFISH_CTR, SSH2_CIPHER_CAST128_CTR,
+#ifdef WITH_CAMELLIA_DRAFT
+	SSH2_CIPHER_CAMELLIA128_CBC, SSH2_CIPHER_CAMELLIA192_CBC, SSH2_CIPHER_CAMELLIA256_CBC,
+	SSH2_CIPHER_CAMELLIA128_CTR, SSH2_CIPHER_CAMELLIA192_CTR, SSH2_CIPHER_CAMELLIA256_CTR,
+	SSH_CIPHER_MAX = SSH2_CIPHER_CAMELLIA256_CTR,
+#else // WITH_CAMELLIA_DRAFT
 	SSH_CIPHER_MAX = SSH2_CIPHER_CAST128_CTR,
+#endif // WITH_CAMELLIA_DRAFT
 } SSHCipher;
 
 typedef enum {
@@ -283,21 +285,37 @@
 } ssh2_cipher_t;
 
 static ssh2_cipher_t ssh2_ciphers[] = {
-	{SSH2_CIPHER_3DES_CBC,     "3des-cbc",      8, 24, 0,    EVP_des_ede3_cbc},
-	{SSH2_CIPHER_AES128_CBC,   "aes128-cbc",   16, 16, 0,    EVP_aes_128_cbc},
-	{SSH2_CIPHER_AES192_CBC,   "aes192-cbc",   16, 24, 0,    EVP_aes_192_cbc},
-	{SSH2_CIPHER_AES256_CBC,   "aes256-cbc",   16, 32, 0,    EVP_aes_256_cbc},
-	{SSH2_CIPHER_BLOWFISH_CBC, "blowfish-cbc",  8, 16, 0,    EVP_bf_cbc},
-	{SSH2_CIPHER_AES128_CTR,   "aes128-ctr",   16, 16, 0,    evp_aes_128_ctr},
-	{SSH2_CIPHER_AES192_CTR,   "aes192-ctr",   16, 24, 0,    evp_aes_128_ctr},
-	{SSH2_CIPHER_AES256_CTR,   "aes256-ctr",   16, 32, 0,    evp_aes_128_ctr},
-	{SSH2_CIPHER_ARCFOUR,      "arcfour",       8, 16, 0,    EVP_rc4},
-	{SSH2_CIPHER_ARCFOUR128,   "arcfour128",    8, 16, 1536, EVP_rc4},
-	{SSH2_CIPHER_ARCFOUR256,   "arcfour256",    8, 32, 1536, EVP_rc4},
-	{SSH2_CIPHER_CAST128_CBC,  "cast128-cbc",   8, 16, 0,    EVP_cast5_cbc},
-	{SSH2_CIPHER_3DES_CTR,     "3des-ctr",      8, 24, 0,    evp_des3_ctr},
-	{SSH2_CIPHER_BLOWFISH_CTR, "blowfish-ctr",  8, 16, 0,    evp_bf_ctr},
-	{SSH2_CIPHER_CAST128_CTR,  "cast128-ctr",   8, 16, 0,    evp_cast5_ctr},
+	{SSH2_CIPHER_3DES_CBC,        "3des-cbc",         8, 24,    0, EVP_des_ede3_cbc},
+	{SSH2_CIPHER_AES128_CBC,      "aes128-cbc",      16, 16,    0, EVP_aes_128_cbc},
+	{SSH2_CIPHER_AES192_CBC,      "aes192-cbc",      16, 24,    0, EVP_aes_192_cbc},
+	{SSH2_CIPHER_AES256_CBC,      "aes256-cbc",      16, 32,    0, EVP_aes_256_cbc},
+	{SSH2_CIPHER_BLOWFISH_CBC,    "blowfish-cbc",     8, 16,    0, EVP_bf_cbc},
+	{SSH2_CIPHER_AES128_CTR,      "aes128-ctr",      16, 16,    0, evp_aes_128_ctr},
+	{SSH2_CIPHER_AES192_CTR,      "aes192-ctr",      16, 24,    0, evp_aes_128_ctr},
+	{SSH2_CIPHER_AES256_CTR,      "aes256-ctr",      16, 32,    0, evp_aes_128_ctr},
+	{SSH2_CIPHER_ARCFOUR,         "arcfour",          8, 16,    0, EVP_rc4},
+	{SSH2_CIPHER_ARCFOUR128,      "arcfour128",       8, 16, 1536, EVP_rc4},
+	{SSH2_CIPHER_ARCFOUR256,      "arcfour256",       8, 32, 1536, EVP_rc4},
+	{SSH2_CIPHER_CAST128_CBC,     "cast128-cbc",      8, 16,    0, EVP_cast5_cbc},
+	{SSH2_CIPHER_3DES_CTR,        "3des-ctr",         8, 24,    0, evp_des3_ctr},
+	{SSH2_CIPHER_BLOWFISH_CTR,    "blowfish-ctr",     8, 16,    0, evp_bf_ctr},
+	{SSH2_CIPHER_CAST128_CTR,     "cast128-ctr",      8, 16,    0, evp_cast5_ctr},
+#ifdef WITH_CAMELLIA_DRAFT
+	{SSH2_CIPHER_CAMELLIA128_CBC, "camellia128-cbc", 16, 16,    0, EVP_camellia_128_cbc},
+	{SSH2_CIPHER_CAMELLIA192_CBC, "camellia192-cbc", 16, 24,    0, EVP_camellia_192_cbc},
+	{SSH2_CIPHER_CAMELLIA256_CBC, "camellia256-cbc", 16, 32,    0, EVP_camellia_256_cbc},
+	{SSH2_CIPHER_CAMELLIA128_CTR, "camellia128-ctr", 16, 16,    0, evp_camellia_128_ctr},
+	{SSH2_CIPHER_CAMELLIA192_CTR, "camellia192-ctr", 16, 24,    0, evp_camellia_128_ctr},
+	{SSH2_CIPHER_CAMELLIA256_CTR, "camellia256-ctr", 16, 32,    0, evp_camellia_128_ctr},
+#ifdef WITH_CAMELLIA_PRIVATE
+	{SSH2_CIPHER_CAMELLIA128_CBC, "camel****@opens*****", 16, 16, 0, EVP_camellia_128_cbc},
+	{SSH2_CIPHER_CAMELLIA192_CBC, "camel****@opens*****", 16, 24, 0, EVP_camellia_192_cbc},
+	{SSH2_CIPHER_CAMELLIA256_CBC, "camel****@opens*****", 16, 32, 0, EVP_camellia_256_cbc},
+	{SSH2_CIPHER_CAMELLIA128_CTR, "camel****@opens*****", 16, 16, 0, evp_camellia_128_ctr},
+	{SSH2_CIPHER_CAMELLIA192_CTR, "camel****@opens*****", 16, 24, 0, evp_camellia_128_ctr},
+	{SSH2_CIPHER_CAMELLIA256_CTR, "camel****@opens*****", 16, 32, 0, evp_camellia_128_ctr},
+#endif // WITH_CAMELLIA_PRIVATE
+#endif // WITH_CAMELLIA_DRAFT
 	{SSH_CIPHER_NONE,          NULL,            0,  0, 0,    NULL},
 };
 
@@ -363,7 +381,7 @@
 	{HMAC_SHA1_96,     "hmac-sha1-96",               EVP_sha1,      96},
 	{HMAC_MD5_96,      "hmac-md5-96",                EVP_md5,       96},
 	{HMAC_RIPEMD160,   "hmac-****@opens*****", EVP_ripemd160, 0},
-#if HMAC_SHA2_DRAFT	// HMAC-SHA2 support
+#ifdef HMAC_SHA2_DRAFT	// HMAC-SHA2 support
 	{HMAC_SHA2_256,    "hmac-sha2-256",              EVP_sha256,    0},
 	{HMAC_SHA2_256_96, "hmac-sha2-256-96",           EVP_sha256,    96},
 	{HMAC_SHA2_512,    "hmac-sha2-512",              EVP_sha512,    0},

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2011-04-10 14:28:55 UTC (rev 4432)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2011-04-11 00:29:12 UTC (rev 4433)
@@ -232,12 +232,27 @@
 #else
 	// for SSH2(yutaka)
 	static char default_strings[] = {
+#ifdef WITH_CAMELLIA_DRAFT
+		SSH2_CIPHER_CAMELLIA256_CTR,
 		SSH2_CIPHER_AES256_CTR,
+		SSH2_CIPHER_CAMELLIA256_CBC,
 		SSH2_CIPHER_AES256_CBC,
+		SSH2_CIPHER_CAMELLIA192_CTR,
 		SSH2_CIPHER_AES192_CTR,
+		SSH2_CIPHER_CAMELLIA192_CBC,
 		SSH2_CIPHER_AES192_CBC,
+		SSH2_CIPHER_CAMELLIA128_CTR,
 		SSH2_CIPHER_AES128_CTR,
+		SSH2_CIPHER_CAMELLIA128_CBC,
 		SSH2_CIPHER_AES128_CBC,
+#else // WITH_CAMELLIA_DRAFT
+		SSH2_CIPHER_AES256_CTR,
+		SSH2_CIPHER_AES256_CBC,
+		SSH2_CIPHER_AES192_CTR,
+		SSH2_CIPHER_AES192_CBC,
+		SSH2_CIPHER_AES128_CTR,
+		SSH2_CIPHER_AES128_CBC,
+#endif // WITH_CAMELLIA_DRAFT
 		SSH2_CIPHER_3DES_CTR,
 		SSH2_CIPHER_3DES_CBC,
 		SSH2_CIPHER_BLOWFISH_CTR,
@@ -2280,7 +2295,11 @@
 	// TTSSH‚̃o[ƒWƒ‡ƒ“‚ðÝ’è‚·‚é (2005.2.28 yutaka)
 	get_file_version("ttxssh.dll", &a, &b, &c, &d);
 	_snprintf_s(buf, sizeof(buf), _TRUNCATE,
+#ifdef WITH_CAMELLIA_DRAFT
+		"TTSSH\r\nTera Term Secure Shell extension, %d.%d with Camellia support", a, b);
+#else
 		"TTSSH\r\nTera Term Secure Shell extension, %d.%d", a, b);
+#endif
 	SendMessage(GetDlgItem(dlg, IDC_TTSSH_VERSION), WM_SETTEXT, 0, (LPARAM)buf);
 
 	// OpenSSL‚̃o[ƒWƒ‡ƒ“‚ðÝ’è‚·‚é (2005.1.24 yutaka)
@@ -2487,6 +2506,20 @@
 		return "Blowfish-CTR(SSH2)";
 	case SSH2_CIPHER_CAST128_CTR:
 		return "CAST128-CTR(SSH2)";
+#ifdef WITH_CAMELLIA_DRAFT
+	case SSH2_CIPHER_CAMELLIA128_CBC:
+		return "Camellia128-CBC(SSH2)";
+	case SSH2_CIPHER_CAMELLIA192_CBC:
+		return "Camellia192-CBC(SSH2)";
+	case SSH2_CIPHER_CAMELLIA256_CBC:
+		return "Camellia256-CBC(SSH2)";
+	case SSH2_CIPHER_CAMELLIA128_CTR:
+		return "Camellia128-CTR(SSH2)";
+	case SSH2_CIPHER_CAMELLIA192_CTR:
+		return "Camellia192-CTR(SSH2)";
+	case SSH2_CIPHER_CAMELLIA256_CTR:
+		return "Camellia256-CTR(SSH2)";
+#endif // WITH_CAMELLIA_DRAFT
 
 	default:
 		return NULL;

Modified: trunk/ttssh2/ttxssh/ttxssh.rc
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.rc	2011-04-10 14:28:55 UTC (rev 4432)
+++ trunk/ttssh2/ttxssh/ttxssh.rc	2011-04-11 00:29:12 UTC (rev 4433)
@@ -66,7 +66,7 @@
     LTEXT           "Tera Term Project:     http://ttssh2.sourceforge.jp/",IDC_WEBSITES,6,88,248,13,SS_SUNKEN
     LTEXT           "OpenSSL:",IDC_OPENSSL_VERSION,6,69,175,8
     LTEXT           "Compatible with SSH protocol version 1.5 and 2.0",IDC_SSHVERSIONS,6,23,206,11
-    LTEXT           "Tera Term Secure Shell extension, ",IDC_TTSSH_VERSION,6,7,145,15
+    LTEXT           "Tera Term Secure Shell extension, ",IDC_TTSSH_VERSION,6,7,220,15
     LTEXT           "zlib:",IDC_ZLIB_VERSION,6,78,181,8
 END
 



Ttssh2-commit メーリングリストの案内