summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-18 09:53:29 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-06-18 09:53:29 +0000
commitd761c9b178d8a2b7757ca5ea41135c7ea37c70b2 (patch)
tree2fa288d6bfe10f3c961d9914e7c547666cfe52f3 /ext
parentef73b34c87f52be6a87e0f7ab8d5a03bfcaa983f (diff)
merge revision(s) 32605:32610:
* backport r32609 from trunk. * ext/openssl/ossl_hmac.c: Revert checking return type of HMAC_Init_ex as it is not compatible with OpenSSL < 1.0.0. * backport r32606 from trunk. * ext/openssl/ossl_digest.c: Check return value of EVP_DigestInit_ex. * ext/openssl/ossl_hmac.c: Check return value of HMAC_Init_ex. Thanks, Jared Jennings, for the patch. [ Ruby 1.9 - Bug #4944 ] [ruby-core:37670] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@36126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl_digest.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index 879d399fe7..13111ce631 100644
--- a/ext/openssl/ossl_digest.c
+++ b/ext/openssl/ossl_digest.c
@@ -62,7 +62,9 @@ ossl_digest_new(const EVP_MD *md)
ret = ossl_digest_alloc(cDigest);
GetDigest(ret, ctx);
- EVP_DigestInit_ex(ctx, md, NULL);
+ if (EVP_DigestInit_ex(ctx, md, NULL) != 1) {
+ ossl_raise(eDigestError, "Digest initialization failed.");
+ }
return ret;
}
@@ -104,7 +106,9 @@ ossl_digest_initialize(int argc, VALUE *argv, VALUE self)
if (!NIL_P(data)) StringValue(data);
GetDigest(self, ctx);
- EVP_DigestInit_ex(ctx, md, NULL);
+ if (EVP_DigestInit_ex(ctx, md, NULL) != 1) {
+ ossl_raise(eDigestError, "Digest initialization failed.");
+ }
if (!NIL_P(data)) return ossl_digest_update(self, data);
return self;
@@ -138,7 +142,9 @@ ossl_digest_reset(VALUE self)
EVP_MD_CTX *ctx;
GetDigest(self, ctx);
- EVP_DigestInit_ex(ctx, EVP_MD_CTX_md(ctx), NULL);
+ if (EVP_DigestInit_ex(ctx, EVP_MD_CTX_md(ctx), NULL) != 1) {
+ ossl_raise(eDigestError, "Digest initialization failed.");
+ }
return self;
}