ruby-changes:40475
From: zzak <ko1@a...>
Date: Fri, 13 Nov 2015 14:01:24 +0900 (JST)
Subject: [ruby-changes:40475] zzak:r52556 (trunk): * ext/openssl/ossl_pkey.c: Merge ruby/openssl@b9ea8ef [Bug #10735]
zzak 2015-11-13 14:01:15 +0900 (Fri, 13 Nov 2015) New Revision: 52556 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=52556 Log: * ext/openssl/ossl_pkey.c: Merge ruby/openssl@b9ea8ef [Bug #10735] Modified files: trunk/ChangeLog trunk/ext/openssl/ossl_pkey.c Index: ChangeLog =================================================================== --- ChangeLog (revision 52555) +++ ChangeLog (revision 52556) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Fri Nov 13 14:00:43 2015 Zachary Scott <zzak@r...> + + * ext/openssl/ossl_pkey.c: Merge ruby/openssl@b9ea8ef [Bug #10735] + Fri Nov 13 13:09:16 2015 Zachary Scott <zzak@r...> * ext/openssl/ossl_ssl.c: Merge ruby/openssl@81e1a30 Index: ext/openssl/ossl_pkey.c =================================================================== --- ext/openssl/ossl_pkey.c (revision 52555) +++ ext/openssl/ossl_pkey.c (revision 52556) @@ -289,6 +289,7 @@ ossl_pkey_sign(VALUE self, VALUE digest, https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkey.c#L289 EVP_MD_CTX ctx; unsigned int buf_len; VALUE str; + int result; if (rb_funcallv(self, id_private_q, 0, NULL) != Qtrue) { ossl_raise(rb_eArgError, "Private key is needed."); @@ -298,7 +299,9 @@ ossl_pkey_sign(VALUE self, VALUE digest, https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkey.c#L299 StringValue(data); EVP_SignUpdate(&ctx, RSTRING_PTR(data), RSTRING_LEN(data)); str = rb_str_new(0, EVP_PKEY_size(pkey)+16); - if (!EVP_SignFinal(&ctx, (unsigned char *)RSTRING_PTR(str), &buf_len, pkey)) + result = EVP_SignFinal(&ctx, (unsigned char *)RSTRING_PTR(str), &buf_len, pkey) + EVP_MD_CTX_cleanup(&ctx); + if (!result) ossl_raise(ePKeyError, NULL); assert((long)buf_len <= RSTRING_LEN(str)); rb_str_set_len(str, buf_len); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/