summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_digest.c
diff options
context:
space:
mode:
authoremboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-13 04:09:04 +0000
committeremboss <emboss@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-13 04:09:04 +0000
commit1c629eff858830131539a5abab1717d93e029439 (patch)
tree208b6d199947743bc994452580e51b80bd2cc62c /ext/openssl/ossl_digest.c
parent60947ded03b815692e23c61361c213f35a653e6b (diff)
* 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
Diffstat (limited to 'ext/openssl/ossl_digest.c')
-rw-r--r--ext/openssl/ossl_digest.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index ebfca12..cb0cade 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 {