From 3930d3b36bfbe7b380595ed835dbd6b36847aab9 Mon Sep 17 00:00:00 2001 From: technorama Date: Mon, 2 Apr 2007 19:00:23 +0000 Subject: * 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 --- ext/openssl/ossl_hmac.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ext/openssl/ossl_hmac.c') 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 @@ -172,6 +172,22 @@ ossl_hmac_hexdigest(VALUE self) return hexdigest; } +/* + * 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); -- cgit v1.2.3