summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-13 05:01:15 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-13 05:01:15 +0000
commit85dd19cf38f5cd42a3b4613789e57288934c6930 (patch)
treea757eaf217c9a7b9969d77fc6251514e0defd929
parent47135def057554c4e9432a30020d659c26089c4f (diff)
* ext/openssl/ossl_pkey.c: Merge ruby/openssl@b9ea8ef [Bug #10735]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--ext/openssl/ossl_pkey.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b9be75..b01f4eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Fri Nov 13 14:00:43 2015 Zachary Scott <zzak@ruby-lang.org>
+
+ * ext/openssl/ossl_pkey.c: Merge ruby/openssl@b9ea8ef [Bug #10735]
+
Fri Nov 13 13:09:16 2015 Zachary Scott <zzak@ruby-lang.org>
* ext/openssl/ossl_ssl.c: Merge ruby/openssl@81e1a30
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index 0b7faf9..4a3d3e5 100644
--- a/ext/openssl/ossl_pkey.c
+++ b/ext/openssl/ossl_pkey.c
@@ -289,6 +289,7 @@ ossl_pkey_sign(VALUE self, VALUE digest, VALUE data)
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, VALUE data)
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);