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:
parent
84e835fe4a
commit
00a006511b
3 changed files with 23 additions and 6 deletions
|
@ -70,8 +70,10 @@ ossl_hmac_initialize(VALUE self, VALUE key, VALUE digest)
|
|||
|
||||
StringValue(key);
|
||||
GetHMAC(self, ctx);
|
||||
HMAC_Init_ex(ctx, RSTRING_PTR(key), RSTRING_LENINT(key),
|
||||
GetDigestPtr(digest), NULL);
|
||||
if (HMAC_Init_ex(ctx, RSTRING_PTR(key), RSTRING_LENINT(key),
|
||||
GetDigestPtr(digest), NULL) != 1) {
|
||||
ossl_raise(eHMACError, "HMAC initialization failed.");
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -180,7 +182,9 @@ ossl_hmac_reset(VALUE self)
|
|||
HMAC_CTX *ctx;
|
||||
|
||||
GetHMAC(self, ctx);
|
||||
HMAC_Init_ex(ctx, NULL, 0, NULL, NULL);
|
||||
if (HMAC_Init_ex(ctx, NULL, 0, NULL, NULL) != 1) {
|
||||
ossl_raise(eHMACError, "HMAC initialization failed");
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue