summaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_digest.c
diff options
context:
space:
mode:
authoremboss <emboss@ruby-lang.org>2011-06-13 04:09:04 +0000
committeremboss <emboss@ruby-lang.org>2011-06-13 04:09:04 +0000
commit69647d1fc3faa2c2313df0afe6baa7009987bcf6 (patch)
tree0ca01a24330bf39fd67bcde8bd7f04c1ab0bf1ec /ext/openssl/ossl_digest.c
parenta1f1a8d1fda6c44badb853aee4d63d2709a88afe (diff)
downloadruby-openssl-history-69647d1fc3faa2c2313df0afe6baa7009987bcf6.tar.gz
* 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 {