summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_digest.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-02-23 17:33:39 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-02-23 17:33:39 +0000
commitd22373455532e99c0adf1a1e5d0b3a864691e2f9 (patch)
tree0dcfe67a2339f2590d4fb213cb4efaa0e255029d /ext/openssl/ossl_digest.c
parent28501bb6e5a31d6ddb8b5167f2f2a87a623bf818 (diff)
Back out the series of changes pending a due discussion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_digest.c')
-rw-r--r--ext/openssl/ossl_digest.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index 3047891..9b8ced5 100644
--- a/ext/openssl/ossl_digest.c
+++ b/ext/openssl/ossl_digest.c
@@ -37,25 +37,18 @@ GetDigestPtr(VALUE obj)
{
const EVP_MD *md;
- if (TYPE(obj) == T_CLASS) {
- EVP_MD_CTX *ctx;
- VALUE digest = rb_funcall(obj, rb_intern("new"), 0, 0);
-
- SafeGetDigest(digest, ctx);
+ if (TYPE(obj) == T_STRING) {
+ const char *name = StringValueCStr(obj);
- md = EVP_MD_CTX_md(ctx);
- } else if (rb_obj_is_kind_of(obj, cDigest)) {
+ md = EVP_get_digestbyname(name);
+ if (!md)
+ ossl_raise(rb_eRuntimeError, "Unsupported digest algorithm (%s).", name);
+ } else {
EVP_MD_CTX *ctx;
SafeGetDigest(obj, ctx);
md = EVP_MD_CTX_md(ctx);
- } else {
- const char *name = StringValueCStr(obj);
-
- md = EVP_get_digestbyname(name);
- if (!md)
- ossl_raise(rb_eRuntimeError, "Unsupported digest algorithm (%s).", name);
}
return md;