aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_digest.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-15 06:35:55 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-15 06:35:55 +0000
commit2edbb9d0f802bab53153979c59125dd0afaafccf (patch)
tree76c471687bb6af4c8c0528187471346008838622 /ext/openssl/ossl_digest.c
parent772396882f02ec3738242a4e83a34e4fc32597bb (diff)
downloadruby-2edbb9d0f802bab53153979c59125dd0afaafccf.tar.gz
* lib/set.rb (Set#==): [ruby-dev:25206]
* ext/openssl/ossl_digest.c (ossl_digest_initialize): [ruby-dev:25198] * utf8.c (utf8_is_mbc_ambiguous): [ruby-talk:123561] * utf8.c (utf8_mbc_to_normalize): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_digest.c')
-rw-r--r--ext/openssl/ossl_digest.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index 8ad9f01dc4..d22f022442 100644
--- a/ext/openssl/ossl_digest.c
+++ b/ext/openssl/ossl_digest.c
@@ -85,16 +85,16 @@ ossl_digest_initialize(int argc, VALUE *argv, VALUE self)
char *name;
VALUE type, data;
- GetDigest(self, ctx);
-
rb_scan_args(argc, argv, "11", &type, &data);
- name = StringValuePtr(type);
+ StringValue(type);
if (!NIL_P(data)) StringValue(data);
+ name = StringValuePtr(type);
md = EVP_get_digestbyname(name);
if (!md) {
ossl_raise(rb_eRuntimeError, "Unsupported digest algorithm (%s).", name);
}
+ GetDigest(self, ctx);
EVP_DigestInit_ex(ctx, md, NULL);
if (!NIL_P(data)) return ossl_digest_update(self, data);
@@ -134,8 +134,8 @@ ossl_digest_update(VALUE self, VALUE data)
{
EVP_MD_CTX *ctx;
- GetDigest(self, ctx);
StringValue(data);
+ GetDigest(self, ctx);
EVP_DigestUpdate(ctx, RSTRING(data)->ptr, RSTRING(data)->len);
return self;
@@ -218,13 +218,13 @@ ossl_digest_equal(VALUE self, VALUE other)
EVP_MD_CTX *ctx;
VALUE str1, str2;
- GetDigest(self, ctx);
if (rb_obj_is_kind_of(other, cDigest) == Qtrue) {
str2 = ossl_digest_digest(other);
} else {
StringValue(other);
str2 = other;
}
+ GetDigest(self, ctx);
if (RSTRING(str2)->len == EVP_MD_CTX_size(ctx)) {
str1 = ossl_digest_digest(self);
} else {