aboutsummaryrefslogtreecommitdiffstats
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
commit3930d3b36bfbe7b380595ed835dbd6b36847aab9 (patch)
treec43e95f78af3662db83b0641edb4e107bf607021 /ext/openssl/ossl_hmac.c
parent790999028d75caa265cb66a8e44d200b8356ed8e (diff)
downloadruby-3930d3b36bfbe7b380595ed835dbd6b36847aab9.tar.gz
* 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: svn+ssh://ci.ruby-lang.org/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 84d378f732..ba85f521f7 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);