From 1c629eff858830131539a5abab1717d93e029439 Mon Sep 17 00:00:00 2001 From: emboss Date: Mon, 13 Jun 2011 04:09:04 +0000 Subject: * ext/openssl/ossl_digest.c: fix error for digests that have no oid (e.g. DSS1). * test/openssl/test_digest.c: add tests for this. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/ossl_digest.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ext/openssl/ossl_digest.c') diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c index ebfca120da..cb0cade1bf 100644 --- a/ext/openssl/ossl_digest.c +++ b/ext/openssl/ossl_digest.c @@ -41,9 +41,12 @@ GetDigestPtr(VALUE obj) if (TYPE(obj) == T_STRING) { const char *name = StringValueCStr(obj); - oid = OBJ_txt2obj(name, 0); - md = EVP_get_digestbyobj(oid); - ASN1_OBJECT_free(oid); + md = EVP_get_digestbyname(name); + if (!md) { + oid = OBJ_txt2obj(name, 0); + md = EVP_get_digestbyobj(oid); + ASN1_OBJECT_free(oid); + } if(!md) ossl_raise(rb_eRuntimeError, "Unsupported digest algorithm (%s).", name); } else { -- cgit v1.2.3