[Ttssh2-commit] [6570] ECDSA_SIG構造体のメンバーアクセスを関数アクセスに変更した。

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2017年 1月 15日 (日) 14:28:14 JST


Revision: 6570
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6570
Author:   yutakapon
Date:     2017-01-15 14:28:14 +0900 (Sun, 15 Jan 2017)
Log Message:
-----------
ECDSA_SIG構造体のメンバーアクセスを関数アクセスに変更した。

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

-------------- next part --------------
Modified: branches/openssl_1_1_0/ttssh2/ttxssh/key.c
===================================================================
--- branches/openssl_1_1_0/ttssh2/ttxssh/key.c	2017-01-12 14:44:35 UTC (rev 6569)
+++ branches/openssl_1_1_0/ttssh2/ttxssh/key.c	2017-01-15 05:28:14 UTC (rev 6570)
@@ -347,6 +347,7 @@
 	unsigned int len, dlen;
 	int ret, nid = NID_undef;
 	char *ptr;
+	BIGNUM *r, *s;
 
 	OpenSSL_add_all_digests();
 
@@ -375,13 +376,14 @@
 	/* parse signature */
 	if ((sig = ECDSA_SIG_new()) == NULL)
 		return -4;
-	if ((sig->r = BN_new()) == NULL)
+	if ((r = BN_new()) == NULL)
 		return -5;
-	if ((sig->s = BN_new()) == NULL)
+	if ((s = BN_new()) == NULL)
 		return -6;
+	ECDSA_SIG_set0(sig, r, s);
 
-	buffer_get_bignum2(&sigblob, sig->r);
-	buffer_get_bignum2(&sigblob, sig->s);
+	buffer_get_bignum2(&sigblob, r);
+	buffer_get_bignum2(&sigblob, s);
 	if (sigblob != ptr) {
 		return -7;
 	}
@@ -1649,6 +1651,7 @@
 		u_char digest[EVP_MAX_MD_SIZE];
 		u_int len, dlen, nid;
 		buffer_t *buf2 = NULL;
+		BIGNUM *br, *bs;
 
 		nid = keytype_to_hash_nid(keypair->type);
 		if ((evp_md = EVP_get_digestbynid(nid)) == NULL) {
@@ -1670,8 +1673,9 @@
 			// TODO: error check
 			goto error;
 		}
-		buffer_put_bignum2(buf2, sig->r);
-		buffer_put_bignum2(buf2, sig->s);
+		ECDSA_SIG_get0(sig, &br, &bs);
+		buffer_put_bignum2(buf2, br);
+		buffer_put_bignum2(buf2, bs);
 		ECDSA_SIG_free(sig);
 
 		s = get_sshname_from_key(keypair);



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