Rails 3.1.0 requires this.  The C implementation is new, so none of our
previous patches are necessary.  If a bcrypt-knowledgable developer
could review the C implementation, I'd appreciate it.

The previous regression tests no longer work because they require rspec
2 and ports is still at rspec 1.  I tested manually with rspec 2 and all
of the regression tests still pass.  At p2k11 I'll be splitting the
rspec port into separate versions for 1 and 2 to deal with scenarios
like this.

Tested on amd64 and i386.  I'd like to build the rbx FLAVOR by
default as well.

Jeremy

Index: Makefile
===================================================================
RCS file: /cvs/ports/security/ruby-bcrypt/Makefile,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile
--- Makefile    6 Jan 2011 04:24:24 -0000       1.11
+++ Makefile    2 Sep 2011 20:39:54 -0000
@@ -2,10 +2,9 @@
 
 COMMENT =      Ruby binding for the bcrypt() password hashing algorithm
 
-VERSION =      2.1.2
+VERSION =      3.0.0
 DISTNAME =     bcrypt-ruby-${VERSION}
 PKGNAME =      bcrypt-${VERSION}
-REVISION =     4
 CATEGORIES =   security
 
 HOMEPAGE =     http://bcrypt-ruby.rubyforge.org/
@@ -19,11 +18,5 @@ PERMIT_DISTFILES_FTP = Yes
 MODULES =              lang/ruby
 
 CONFIGURE_STYLE =      ruby gem ext
-
-REGRESS_DEPENDS =      devel/ruby-rcov,${MODRUBY_FLAVOR} \
-                       devel/ruby-diff-lcs,${MODRUBY_FLAVOR} \
-                       ${FULLPKGNAME}:${BUILD_PKGPATH}
-
-MODRUBY_REGRESS =      rake rspec
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/security/ruby-bcrypt/distinfo,v
retrieving revision 1.3
diff -u -p -r1.3 distinfo
--- distinfo    13 Oct 2009 18:38:47 -0000      1.3
+++ distinfo    1 Sep 2011 01:34:58 -0000
@@ -1,5 +1,5 @@
-MD5 (bcrypt-ruby-2.1.2.gem) = fsSe+e+0F75EQ/kgkq3KmQ==
-RMD160 (bcrypt-ruby-2.1.2.gem) = SdIgY7FKAA/duY1aVOhPqMPlQec=
-SHA1 (bcrypt-ruby-2.1.2.gem) = d/qXGs5PkI1Ki8ARjkOWW6ACOys=
-SHA256 (bcrypt-ruby-2.1.2.gem) = a3FQxqzPXJmo0XC9YFdUKx+SN94b/Qqlt2ESRs7V5PQ=
-SIZE (bcrypt-ruby-2.1.2.gem) = 44544
+MD5 (bcrypt-ruby-3.0.0.gem) = wpm5+pjrGViXnbFNzN+m+w==
+RMD160 (bcrypt-ruby-3.0.0.gem) = Op+KbldSY7OEbY7bVN7aQ7kT6pA=
+SHA1 (bcrypt-ruby-3.0.0.gem) = 6Xq5cuTk8saO2zufIAjMXoW4ZAM=
+SHA256 (bcrypt-ruby-3.0.0.gem) = 3J228pObP8PMScq15oxW8zh6PwdlvNAJs2DNLSAEHDI=
+SIZE (bcrypt-ruby-3.0.0.gem) = 41984
Index: patches/patch-ext_mri_bcrypt_c
===================================================================
RCS file: patches/patch-ext_mri_bcrypt_c
diff -N patches/patch-ext_mri_bcrypt_c
--- patches/patch-ext_mri_bcrypt_c      1 Jan 2010 20:35:34 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
-$OpenBSD: patch-ext_mri_bcrypt_c,v 1.1 2010/01/01 20:35:34 jcs Exp $
---- ext/mri/bcrypt.c.orig      Wed Dec 31 17:00:00 1969
-+++ ext/mri/bcrypt.c   Thu Dec 31 16:30:45 2009
-@@ -150,7 +150,7 @@ encode_salt(char *salt, uint8_t *csalt, uint16_t clen,
-  */
- 
- char   *
--bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed)
-+_bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed)
- {
-       if (log_rounds < 4)
-               log_rounds = 4;
-@@ -164,7 +164,7 @@ bcrypt_gensalt(char *output, uint8_t log_rounds, uint8
-    i.e. $2$04$iwouldntknowwhattosayetKdJ6iFtacBqJdKe6aW7ou */
- 
- char   *
--bcrypt(char *output, const char *key, const char *salt)
-+_bcrypt(char *output, const char *key, const char *salt)
- {
-       blf_ctx state;
-       uint32_t rounds, i, k;
Index: patches/patch-ext_mri_bcrypt_ext_c
===================================================================
RCS file: patches/patch-ext_mri_bcrypt_ext_c
diff -N patches/patch-ext_mri_bcrypt_ext_c
--- patches/patch-ext_mri_bcrypt_ext_c  1 Jan 2010 20:35:34 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-$OpenBSD: patch-ext_mri_bcrypt_ext_c,v 1.1 2010/01/01 20:35:34 jcs Exp $
---- ext/mri/bcrypt_ext.c.orig  Wed Dec 31 17:00:00 1969
-+++ ext/mri/bcrypt_ext.c       Thu Dec 31 16:30:45 2009
-@@ -30,7 +30,7 @@ static VALUE cBCryptEngine;
-       
-       static VALUE bcrypt_wrapper(void *_args) {
-               BCryptArguments *args = (BCryptArguments *)_args;
--              return (VALUE)bcrypt(args->output, args->key, args->salt);
-+              return (VALUE)_bcrypt(args->output, args->key, args->salt);
-       }
- 
- #endif /* RUBY_1_9 */
-@@ -41,7 +41,8 @@ static VALUE bc_salt(VALUE self, VALUE cost, VALUE see
-       int icost = NUM2INT(cost);
-       char salt[BCRYPT_SALT_OUTPUT_SIZE];
-       
--      bcrypt_gensalt(salt, icost, (uint8_t *)RSTRING_PTR(seed));
-+      _bcrypt_gensalt(salt, icost, (uint8_t *)RSTRING_PTR(seed));
-+
-       return rb_str_new2(salt);
- }
- 
-@@ -70,7 +71,7 @@ static VALUE bc_crypt(VALUE self, VALUE key, VALUE sal
-               /* otherwise, fallback to the non-GIL-unlocking code, just like 
on Ruby 1.8 */
-       #endif
-       
--      if (bcrypt(output, safeguarded, (char *)RSTRING_PTR(salt)) != NULL) {
-+      if (_bcrypt(output, safeguarded, (char *)RSTRING_PTR(salt)) != NULL) {
-               return rb_str_new2(output);
-       } else {
-               return Qnil;
Index: patches/patch-ext_mri_bcrypt_h
===================================================================
RCS file: patches/patch-ext_mri_bcrypt_h
diff -N patches/patch-ext_mri_bcrypt_h
--- patches/patch-ext_mri_bcrypt_h      1 Jan 2010 20:35:34 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,20 +0,0 @@
-$OpenBSD: patch-ext_mri_bcrypt_h,v 1.1 2010/01/01 20:35:34 jcs Exp $
---- ext/mri/bcrypt.h.orig      Wed Dec 31 17:00:00 1969
-+++ ext/mri/bcrypt.h   Thu Dec 31 16:30:45 2009
-@@ -51,7 +51,7 @@
-  *        cryptographically secure random source.
-  * Returns: output
-  */
--char *bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed);
-+char *_bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed);
- 
- /*
-  * Given a secret and a salt, generates a salted hash (which you can then 
store safely).
-@@ -62,6 +62,6 @@ char *bcrypt_gensalt(char *output, uint8_t log_rounds,
-  * salt: The salt, as generated by bcrypt_gensalt().
-  * Returns: output on success, NULL on error.
-  */
--char *bcrypt(char *output, const char *key, const char *salt);
-+char *_bcrypt(char *output, const char *key, const char *salt);
- 
- #endif /* _BCRYPT_H_ */
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/security/ruby-bcrypt/pkg/PLIST,v
retrieving revision 1.4
diff -u -p -r1.4 PLIST
--- pkg/PLIST   8 Nov 2010 23:24:42 -0000       1.4
+++ pkg/PLIST   1 Sep 2011 01:38:38 -0000
@@ -1,31 +1,41 @@
 @comment $OpenBSD: PLIST,v 1.4 2010/11/08 23:24:42 jeremy Exp $
 ${GEM_LIB}/cache/${DISTNAME}.gem
 ${GEM_LIB}/gems/${DISTNAME}/
+${GEM_LIB}/gems/${DISTNAME}/.gitignore
+${GEM_LIB}/gems/${DISTNAME}/.rspec
 ${GEM_LIB}/gems/${DISTNAME}/CHANGELOG
 ${GEM_LIB}/gems/${DISTNAME}/COPYING
-${GEM_LIB}/gems/${DISTNAME}/README
+${GEM_LIB}/gems/${DISTNAME}/Gemfile
+${GEM_LIB}/gems/${DISTNAME}/Gemfile.lock
+${GEM_LIB}/gems/${DISTNAME}/README.md
 ${GEM_LIB}/gems/${DISTNAME}/Rakefile
+${GEM_LIB}/gems/${DISTNAME}/bcrypt-ruby.gemspec
 ${GEM_LIB}/gems/${DISTNAME}/ext/
 ${GEM_LIB}/gems/${DISTNAME}/ext/jruby/
 ${GEM_LIB}/gems/${DISTNAME}/ext/jruby/bcrypt_jruby/
-${GEM_LIB}/gems/${DISTNAME}/ext/jruby/bcrypt_jruby/BCrypt.class
 ${GEM_LIB}/gems/${DISTNAME}/ext/jruby/bcrypt_jruby/BCrypt.java
 ${GEM_LIB}/gems/${DISTNAME}/ext/mri/
 ${GEM_LIB}/gems/${DISTNAME}/ext/mri/Makefile
-${GEM_LIB}/gems/${DISTNAME}/ext/mri/bcrypt.c
-${GEM_LIB}/gems/${DISTNAME}/ext/mri/bcrypt.h
-${GEM_LIB}/gems/${DISTNAME}/ext/mri/bcrypt.o
 ${GEM_LIB}/gems/${DISTNAME}/ext/mri/bcrypt_ext.c
 ${GEM_LIB}/gems/${DISTNAME}/ext/mri/bcrypt_ext.o
 ${GEM_LIB}/gems/${DISTNAME}/ext/mri/bcrypt_ext.so
-${GEM_LIB}/gems/${DISTNAME}/ext/mri/blf.h
-${GEM_LIB}/gems/${DISTNAME}/ext/mri/blowfish.c
-${GEM_LIB}/gems/${DISTNAME}/ext/mri/blowfish.o
+${GEM_LIB}/gems/${DISTNAME}/ext/mri/crypt.c
+${GEM_LIB}/gems/${DISTNAME}/ext/mri/crypt.h
+${GEM_LIB}/gems/${DISTNAME}/ext/mri/crypt.o
+${GEM_LIB}/gems/${DISTNAME}/ext/mri/crypt_blowfish.c
+${GEM_LIB}/gems/${DISTNAME}/ext/mri/crypt_blowfish.o
+${GEM_LIB}/gems/${DISTNAME}/ext/mri/crypt_gensalt.c
+${GEM_LIB}/gems/${DISTNAME}/ext/mri/crypt_gensalt.o
 ${GEM_LIB}/gems/${DISTNAME}/ext/mri/extconf.rb
+${GEM_LIB}/gems/${DISTNAME}/ext/mri/ow-crypt.h
+${GEM_LIB}/gems/${DISTNAME}/ext/mri/wrapper.c
+${GEM_LIB}/gems/${DISTNAME}/ext/mri/wrapper.o
 ${GEM_LIB}/gems/${DISTNAME}/lib/
 ${GEM_LIB}/gems/${DISTNAME}/lib/bcrypt.rb
+${GEM_LIB}/gems/${DISTNAME}/lib/bcrypt_engine.rb
 ${GEM_LIB}/gems/${DISTNAME}/lib/bcrypt_ext.so
 ${GEM_LIB}/gems/${DISTNAME}/spec/
+${GEM_LIB}/gems/${DISTNAME}/spec/TestBCrypt.java
 ${GEM_LIB}/gems/${DISTNAME}/spec/bcrypt/
 ${GEM_LIB}/gems/${DISTNAME}/spec/bcrypt/engine_spec.rb
 ${GEM_LIB}/gems/${DISTNAME}/spec/bcrypt/password_spec.rb

Reply via email to