1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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/trunk@32606 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
emboss 2011-07-22 02:21:26 +00:00
parent 84e835fe4a
commit 00a006511b
3 changed files with 23 additions and 6 deletions

View file

@ -68,7 +68,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;
}
@ -122,7 +124,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;
@ -159,7 +163,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;
}