ext/rubysl/openssl/ossl_pkcs5.c in rubysl-openssl-2.10 vs ext/rubysl/openssl/ossl_pkcs5.c in rubysl-openssl-2.11

- old
+ new

@@ -16,11 +16,11 @@ * * +salt+ - string - should be at least 8 bytes long. * * +iter+ - integer - should be greater than 1000. 20000 is better. * * +keylen+ - integer * * +digest+ - a string or OpenSSL::Digest object. * - * Available in OpenSSL 0.9.4. + * Available in OpenSSL >= 1.0.0. * * Digests other than SHA1 may not be supported by other cryptography libraries. */ static VALUE ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen, VALUE digest) @@ -46,11 +46,10 @@ #else #define ossl_pkcs5_pbkdf2_hmac rb_f_notimplement #endif -#ifdef HAVE_PKCS5_PBKDF2_HMAC_SHA1 /* * call-seq: * PKCS5.pbkdf2_hmac_sha1(pass, salt, iter, keylen) => string * * === Parameters @@ -59,11 +58,11 @@ * * +iter+ - integer - should be greater than 1000. 20000 is better. * * +keylen+ - integer * * This method is available in almost any version of OpenSSL. * - * Conforms to rfc2898. + * Conforms to RFC 2898. */ static VALUE ossl_pkcs5_pbkdf2_hmac_sha1(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen) { VALUE str; @@ -79,26 +78,19 @@ len, (unsigned char *)RSTRING_PTR(str)) != 1) ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC_SHA1"); return str; } -#else -#define ossl_pkcs5_pbkdf2_hmac_sha1 rb_f_notimplement -#endif void Init_ossl_pkcs5(void) { - /* - * Password-based Encryption - * - */ +#if 0 + mOSSL = rb_define_module("OpenSSL"); + eOSSLError = rb_define_class_under(mOSSL, "OpenSSLError", rb_eStandardError); +#endif - #if 0 - mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */ - #endif - /* Document-class: OpenSSL::PKCS5 * * Provides password-based encryption functionality based on PKCS#5. * Typically used for securely deriving arbitrary length symmetric keys * to be used with an OpenSSL::Cipher from passwords. Another use case @@ -106,10 +98,10 @@ * computation by increasing the iteration count, computation can be * slowed down artificially in order to render possible attacks infeasible. * * PKCS5 offers support for PBKDF2 with an OpenSSL::Digest::SHA1-based * HMAC, or an arbitrary Digest if the underlying version of OpenSSL - * already supports it (>= 0.9.4). + * already supports it (>= 1.0.0). * * === Parameters * ==== Password * Typically an arbitrary String that represents the password to be used * for deriving a key.