summaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_hmac.c
diff options
context:
space:
mode:
authortechnorama <technorama@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-02 19:00:23 +0000
committertechnorama <technorama@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-04-02 19:00:23 +0000
commit800a0f1ba51d9c4e369702e352f242ef7119655f (patch)
treec43e95f78af3662db83b0641edb4e107bf607021 /ext/openssl/ossl_hmac.c
parent77702f1266722718bd63483405ed25a2a3ebca6c (diff)
downloadruby-800a0f1ba51d9c4e369702e352f242ef7119655f.tar.gz
ruby-800a0f1ba51d9c4e369702e352f242ef7119655f.tar.xz
ruby-800a0f1ba51d9c4e369702e352f242ef7119655f.zip
* ext/openssl/{ossl.[ch],ossl_pkey.c} Add documentation.
* ext/openssl/ossl_hmac.c Add reset method. * ext/openssl/ossl_cipher.c (Cipher#update) Take additional buffer argument. * ext/openssl/{ossl_bio.c,ossl_ssl.c,ruby_missing.h} compatibility with 1.8. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_hmac.c')
-rw-r--r--ext/openssl/ossl_hmac.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c
index 84d378f73..ba85f521f 100644
--- a/ext/openssl/ossl_hmac.c
+++ b/ext/openssl/ossl_hmac.c
@@ -174,6 +174,22 @@ ossl_hmac_hexdigest(VALUE self)
/*
* call-seq:
+ * hmac.reset -> self
+ *
+ */
+static VALUE
+ossl_hmac_reset(VALUE self)
+{
+ HMAC_CTX *ctx;
+
+ GetHMAC(self, ctx);
+ HMAC_Init_ex(ctx, NULL, 0, NULL, NULL);
+
+ return self;
+}
+
+/*
+ * call-seq:
* HMAC.digest(digest, key, data) -> aString
*
*/
@@ -237,6 +253,7 @@ Init_ossl_hmac()
rb_define_method(cHMAC, "initialize", ossl_hmac_initialize, 2);
rb_define_copy_func(cHMAC, ossl_hmac_copy);
+ rb_define_method(cHMAC, "reset", ossl_hmac_reset, 0);
rb_define_method(cHMAC, "update", ossl_hmac_update, 1);
rb_define_alias(cHMAC, "<<", "update");
rb_define_method(cHMAC, "digest", ossl_hmac_digest, 0);