[ttssh2-commit] [9659] OpenSSL 3 用の調整

アーカイブの一覧に戻る
scmno****@osdn***** scmno****@osdn*****
2021年 12月 31日 (金) 23:43:32 JST


Revision: 9659
          https://osdn.net/projects/ttssh2/scm/svn/commits/9659
Author:   nmaya
Date:     2021-12-31 23:43:31 +0900 (Fri, 31 Dec 2021)
Log Message:
-----------
OpenSSL 3 用の調整

- OpenSSL の関数を使うと動作する暗号アルゴリズムは OpenSSL の関数を使うように変更
- 動作しない暗号アルゴリズム・MAC アルゴリズムを #ifdef で除外する
https://osdn.net/projects/ttssh2/ticket/43469#comment:1412:43469:1640961570

Modified Paths:
--------------
    branches/openssl_3_0_1/ttssh2/ttxssh/cipher.c
    branches/openssl_3_0_1/ttssh2/ttxssh/crypt.c
    branches/openssl_3_0_1/ttssh2/ttxssh/mac.c
    branches/openssl_3_0_1/ttssh2/ttxssh/ssh.c

-------------- next part --------------
Modified: branches/openssl_3_0_1/ttssh2/ttxssh/cipher.c
===================================================================
--- branches/openssl_3_0_1/ttssh2/ttxssh/cipher.c	2021-12-31 13:50:02 UTC (rev 9658)
+++ branches/openssl_3_0_1/ttssh2/ttxssh/cipher.c	2021-12-31 14:43:31 UTC (rev 9659)
@@ -46,9 +46,9 @@
 	{SSH2_CIPHER_AES192_CBC,      "aes192-cbc",      16, 24,    0, 0, 0, EVP_aes_192_cbc},      // RFC4253
 	{SSH2_CIPHER_AES256_CBC,      "aes256-cbc",      16, 32,    0, 0, 0, EVP_aes_256_cbc},      // RFC4253
 	{SSH2_CIPHER_BLOWFISH_CBC,    "blowfish-cbc",     8, 16,    0, 0, 0, EVP_bf_cbc},           // RFC4253
-	{SSH2_CIPHER_AES128_CTR,      "aes128-ctr",      16, 16,    0, 0, 0, evp_aes_128_ctr},      // RFC4344
-	{SSH2_CIPHER_AES192_CTR,      "aes192-ctr",      16, 24,    0, 0, 0, evp_aes_128_ctr},      // RFC4344
-	{SSH2_CIPHER_AES256_CTR,      "aes256-ctr",      16, 32,    0, 0, 0, evp_aes_128_ctr},      // RFC4344
+	{SSH2_CIPHER_AES128_CTR,      "aes128-ctr",      16, 16,    0, 0, 0, EVP_aes_128_ctr},      // RFC4344
+	{SSH2_CIPHER_AES192_CTR,      "aes192-ctr",      16, 24,    0, 0, 0, EVP_aes_192_ctr},      // RFC4344
+	{SSH2_CIPHER_AES256_CTR,      "aes256-ctr",      16, 32,    0, 0, 0, EVP_aes_256_ctr},      // RFC4344
 	{SSH2_CIPHER_ARCFOUR,         "arcfour",          8, 16,    0, 0, 0, EVP_rc4},              // RFC4253
 	{SSH2_CIPHER_ARCFOUR128,      "arcfour128",       8, 16, 1536, 0, 0, EVP_rc4},              // RFC4345
 	{SSH2_CIPHER_ARCFOUR256,      "arcfour256",       8, 32, 1536, 0, 0, EVP_rc4},              // RFC4345
@@ -59,9 +59,9 @@
 	{SSH2_CIPHER_CAMELLIA128_CBC, "camellia128-cbc", 16, 16,    0, 0, 0, EVP_camellia_128_cbc}, // draft-kanno-secsh-camellia-02
 	{SSH2_CIPHER_CAMELLIA192_CBC, "camellia192-cbc", 16, 24,    0, 0, 0, EVP_camellia_192_cbc}, // draft-kanno-secsh-camellia-02
 	{SSH2_CIPHER_CAMELLIA256_CBC, "camellia256-cbc", 16, 32,    0, 0, 0, EVP_camellia_256_cbc}, // draft-kanno-secsh-camellia-02
-	{SSH2_CIPHER_CAMELLIA128_CTR, "camellia128-ctr", 16, 16,    0, 0, 0, evp_camellia_128_ctr}, // draft-kanno-secsh-camellia-02
-	{SSH2_CIPHER_CAMELLIA192_CTR, "camellia192-ctr", 16, 24,    0, 0, 0, evp_camellia_128_ctr}, // draft-kanno-secsh-camellia-02
-	{SSH2_CIPHER_CAMELLIA256_CTR, "camellia256-ctr", 16, 32,    0, 0, 0, evp_camellia_128_ctr}, // draft-kanno-secsh-camellia-02
+	{SSH2_CIPHER_CAMELLIA128_CTR, "camellia128-ctr", 16, 16,    0, 0, 0, EVP_camellia_128_ctr}, // draft-kanno-secsh-camellia-02
+	{SSH2_CIPHER_CAMELLIA192_CTR, "camellia192-ctr", 16, 24,    0, 0, 0, EVP_camellia_192_ctr}, // draft-kanno-secsh-camellia-02
+	{SSH2_CIPHER_CAMELLIA256_CTR, "camellia256-ctr", 16, 32,    0, 0, 0, EVP_camellia_256_ctr}, // draft-kanno-secsh-camellia-02
 #ifdef WITH_CAMELLIA_PRIVATE
 	{SSH2_CIPHER_CAMELLIA128_CBC, "camel****@opens*****", 16, 16, 0,  0,  0, EVP_camellia_128_cbc},
 	{SSH2_CIPHER_CAMELLIA192_CBC, "camel****@opens*****", 16, 24, 0,  0,  0, EVP_camellia_192_cbc},
@@ -328,19 +328,30 @@
 		SSH2_CIPHER_AES128_CTR,
 		SSH2_CIPHER_CAMELLIA128_CBC,
 		SSH2_CIPHER_AES128_CBC,
+#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x30000000UL
 		SSH2_CIPHER_3DES_CTR,
+#endif
 		SSH2_CIPHER_3DES_CBC,
+#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x30000000UL
 		SSH2_CIPHER_BLOWFISH_CTR,
 		SSH2_CIPHER_BLOWFISH_CBC,
 		SSH2_CIPHER_CAST128_CTR,
 		SSH2_CIPHER_CAST128_CBC,
+#endif
 		SSH_CIPHER_3DES,
 		SSH_CIPHER_NONE,
+#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x30000000UL
 		SSH2_CIPHER_ARCFOUR256,
 		SSH2_CIPHER_ARCFOUR128,
 		SSH2_CIPHER_ARCFOUR,
+#endif
 		SSH_CIPHER_BLOWFISH,
 		SSH_CIPHER_DES,
+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x30000000UL
+		0, 0, 0, // Dummy for SSH2_CIPHER_3DES_CTR, SSH2_CIPHER_BLOWFISH_CTR, SSH2_CIPHER_BLOWFISH_CBC,
+		0, 0,    // Dummy for SSH2_CIPHER_CAST128_CTR, SSH2_CIPHER_CAST128_CBC
+		0, 0, 0, // Dummy for SSH2_CIPHER_ARCFOUR256, SSH2_CIPHER_ARCFOUR128, SSH2_CIPHER_ARCFOUR
+#endif
 		0, 0, 0 // Dummy for SSH_CIPHER_IDEA, SSH_CIPHER_TSS, SSH_CIPHER_RC4
 	};
 

Modified: branches/openssl_3_0_1/ttssh2/ttxssh/crypt.c
===================================================================
--- branches/openssl_3_0_1/ttssh2/ttxssh/crypt.c	2021-12-31 13:50:02 UTC (rev 9658)
+++ branches/openssl_3_0_1/ttssh2/ttxssh/crypt.c	2021-12-31 14:43:31 UTC (rev 9659)
@@ -606,10 +606,13 @@
 		            | (1 << SSH2_CIPHER_AES128_CBC)
 		            | (1 << SSH2_CIPHER_AES192_CBC)
 		            | (1 << SSH2_CIPHER_AES256_CBC)
+#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x30000000UL
 		            | (1 << SSH2_CIPHER_BLOWFISH_CBC)
+#endif
 		            | (1 << SSH2_CIPHER_AES128_CTR)
 		            | (1 << SSH2_CIPHER_AES192_CTR)
 		            | (1 << SSH2_CIPHER_AES256_CTR)
+#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x30000000UL
 		            | (1 << SSH2_CIPHER_ARCFOUR)
 		            | (1 << SSH2_CIPHER_ARCFOUR128)
 		            | (1 << SSH2_CIPHER_ARCFOUR256)
@@ -617,6 +620,7 @@
 		            | (1 << SSH2_CIPHER_3DES_CTR)
 		            | (1 << SSH2_CIPHER_BLOWFISH_CTR)
 		            | (1 << SSH2_CIPHER_CAST128_CTR)
+#endif
 		            | (1 << SSH2_CIPHER_CAMELLIA128_CBC)
 		            | (1 << SSH2_CIPHER_CAMELLIA192_CBC)
 		            | (1 << SSH2_CIPHER_CAMELLIA256_CBC)

Modified: branches/openssl_3_0_1/ttssh2/ttxssh/mac.c
===================================================================
--- branches/openssl_3_0_1/ttssh2/ttxssh/mac.c	2021-12-31 13:50:02 UTC (rev 9658)
+++ branches/openssl_3_0_1/ttssh2/ttxssh/mac.c	2021-12-31 14:43:31 UTC (rev 9659)
@@ -129,8 +129,10 @@
 		HMAC_SHA2_512,
 		HMAC_SHA2_256,
 		HMAC_SHA1,
+#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x30000000UL
 		HMAC_RIPEMD160_EtM,
 		HMAC_RIPEMD160,
+#endif
 		HMAC_MD5_EtM,
 		HMAC_MD5,
 		HMAC_NONE,
@@ -137,7 +139,10 @@
 		HMAC_SHA1_96_EtM,
 		HMAC_MD5_96_EtM,
 		HMAC_SHA1_96,
-		HMAC_MD5_96,
+		HMAC_MD5_96,
+#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x30000000UL
+		0, 0, // Dummy for HMAC_RIPEMD160_EtM, HMAC_RIPEMD160
+#endif
 		0, // Dummy for HMAC_SHA2_512_96,
 		0, // Dummy for HMAC_SHA2_256_96,
 	};

Modified: branches/openssl_3_0_1/ttssh2/ttxssh/ssh.c
===================================================================
--- branches/openssl_3_0_1/ttssh2/ttxssh/ssh.c	2021-12-31 13:50:02 UTC (rev 9658)
+++ branches/openssl_3_0_1/ttssh2/ttxssh/ssh.c	2021-12-31 14:43:31 UTC (rev 9659)
@@ -6413,10 +6413,13 @@
 	                       | 1 << SSH2_CIPHER_AES128_CBC
 	                       | 1 << SSH2_CIPHER_AES192_CBC
 	                       | 1 << SSH2_CIPHER_AES256_CBC
+#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x30000000UL
 	                       | 1 << SSH2_CIPHER_BLOWFISH_CBC
+#endif
 	                       | 1 << SSH2_CIPHER_AES128_CTR
 	                       | 1 << SSH2_CIPHER_AES192_CTR
 	                       | 1 << SSH2_CIPHER_AES256_CTR
+#if defined(LIBRESSL_VERSION_NUMBER) || OPENSSL_VERSION_NUMBER < 0x30000000UL
 	                       | 1 << SSH2_CIPHER_ARCFOUR
 	                       | 1 << SSH2_CIPHER_ARCFOUR128
 	                       | 1 << SSH2_CIPHER_ARCFOUR256
@@ -6424,6 +6427,7 @@
 	                       | 1 << SSH2_CIPHER_3DES_CTR
 	                       | 1 << SSH2_CIPHER_BLOWFISH_CTR
 	                       | 1 << SSH2_CIPHER_CAST128_CTR
+#endif
 	                       | 1 << SSH2_CIPHER_CAMELLIA128_CBC
 	                       | 1 << SSH2_CIPHER_CAMELLIA192_CBC
 	                       | 1 << SSH2_CIPHER_CAMELLIA256_CBC


ttssh2-commit メーリングリストの案内
アーカイブの一覧に戻る