svnno****@sourc*****
svnno****@sourc*****
2017年 1月 12日 (木) 23:44:35 JST
Revision: 6569 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6569 Author: yutakapon Date: 2017-01-12 23:44:35 +0900 (Thu, 12 Jan 2017) Log Message: ----------- DSA_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-11 14:18:17 UTC (rev 6568) +++ branches/openssl_1_1_0/ttssh2/ttxssh/key.c 2017-01-12 14:44:35 UTC (rev 6569) @@ -85,6 +85,7 @@ unsigned int len, dlen; int ret = -1; char *ptr; + BIGNUM *r, *s; OpenSSL_add_all_digests(); @@ -125,12 +126,13 @@ /* parse signature */ if ((sig = DSA_SIG_new()) == NULL) return -5; - if ((sig->r = BN_new()) == NULL) + if ((r = BN_new()) == NULL) return -6; - if ((sig->s = BN_new()) == NULL) + if ((s = BN_new()) == NULL) return -7; - BN_bin2bn(sigblob, INTBLOB_LEN, sig->r); - BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, sig->s); + DSA_SIG_set0(sig, r, s); + BN_bin2bn(sigblob, INTBLOB_LEN, r); + BN_bin2bn(sigblob+ INTBLOB_LEN, INTBLOB_LEN, s); /* sha1 the data */ EVP_DigestInit(md, evp_md); @@ -1595,6 +1597,7 @@ const EVP_MD *evp_md = EVP_sha1(); u_char digest[EVP_MAX_MD_SIZE], sigblob[SIGBLOB_LEN]; u_int rlen, slen, len, dlen; + BIGNUM *bignum_r, *bignum_s; // \x83_\x83C\x83W\x83F\x83X\x83g\x82̌v\x8EZ EVP_DigestInit(md, evp_md); @@ -1609,15 +1612,16 @@ } // BIGNUM\x82\xA9\x82\xE7\x83o\x83C\x83i\x83\x8A\x92l\x82ւ̕ϊ\xB7 - rlen = BN_num_bytes(sig->r); - slen = BN_num_bytes(sig->s); + DSA_SIG_get0(sig, &bignum_r, &bignum_s); + rlen = BN_num_bytes(bignum_r); + slen = BN_num_bytes(bignum_s); if (rlen > INTBLOB_LEN || slen > INTBLOB_LEN) { DSA_SIG_free(sig); goto error; } memset(sigblob, 0, SIGBLOB_LEN); - BN_bn2bin(sig->r, sigblob+ SIGBLOB_LEN - INTBLOB_LEN - rlen); - BN_bn2bin(sig->s, sigblob+ SIGBLOB_LEN - slen); + BN_bn2bin(bignum_r, sigblob+ SIGBLOB_LEN - INTBLOB_LEN - rlen); + BN_bn2bin(bignum_s, sigblob+ SIGBLOB_LEN - slen); DSA_SIG_free(sig); // setting