[Ttssh2-commit] [6572] EVP_CIPHER_CTX 構造体のメンバーアクセスを関数化した。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2017年 1月 15日 (日) 15:36:34 JST


Revision: 6572
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6572
Author:   yutakapon
Date:     2017-01-15 15:36:34 +0900 (Sun, 15 Jan 2017)
Log Message:
-----------
EVP_CIPHER_CTX 構造体のメンバーアクセスを関数化した。
  encrypt -> EVP_CIPHER_CTX_encrypting
  iv -> EVP_CIPHER_CTX_iv_noconst, EVP_CIPHER_CTX_iv

Modified Paths:
--------------
    branches/openssl_1_1_0/ttssh2/ttxssh/ttxssh.c

-------------- next part --------------
Modified: branches/openssl_1_1_0/ttssh2/ttxssh/ttxssh.c
===================================================================
--- branches/openssl_1_1_0/ttssh2/ttxssh/ttxssh.c	2017-01-15 06:05:35 UTC (rev 6571)
+++ branches/openssl_1_1_0/ttssh2/ttxssh/ttxssh.c	2017-01-15 06:36:34 UTC (rev 6572)
@@ -3833,7 +3833,7 @@
 	if (key == NULL)
 		return (1);
 	if (enc == -1)
-		enc = ctx->encrypt;
+		enc = EVP_CIPHER_CTX_encrypting(ctx); 
 	k1 = k2 = k3 = (u_char *) key;
 	k2 += 8;
 	if (EVP_CIPHER_CTX_key_length(ctx) >= 16+8) {
@@ -3906,14 +3906,14 @@
 
 	if (doset) {
 		//debug3("%s: Installed 3DES IV", __func__);
-		memcpy(c->k1.iv, iv, 8);
-		memcpy(c->k2.iv, iv + 8, 8);
-		memcpy(c->k3.iv, iv + 16, 8);
+		memcpy(EVP_CIPHER_CTX_iv_noconst(c->k1), iv, 8);
+		memcpy(EVP_CIPHER_CTX_iv_noconst(c->k2), iv + 8, 8);
+		memcpy(EVP_CIPHER_CTX_iv_noconst(c->k3), iv + 16, 8);
 	} else {
 		//debug3("%s: Copying 3DES IV", __func__);
-		memcpy(iv, c->k1.iv, 8);
-		memcpy(iv + 8, c->k2.iv, 8);
-		memcpy(iv + 16, c->k3.iv, 8);
+		memcpy(iv, EVP_CIPHER_CTX_iv(c->k1), 8);
+		memcpy(iv + 8, EVP_CIPHER_CTX_iv(c->k2), 8);
+		memcpy(iv + 16, EVP_CIPHER_CTX_iv(c->k3), 8);
 	}
 }
 



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