r53597 - in /branches/upstream/libcrypt-blowfish-perl/current: Blowfish.pm Changes META.yml README _blowfish.c

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Fri Mar 5 11:29:30 UTC 2010


Author: gregoa
Date: Fri Mar  5 11:29:20 2010
New Revision: 53597

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=53597
Log:
[svn-upgrade] Integrating new upstream version, libcrypt-blowfish-perl (2.12)

Modified:
    branches/upstream/libcrypt-blowfish-perl/current/Blowfish.pm
    branches/upstream/libcrypt-blowfish-perl/current/Changes
    branches/upstream/libcrypt-blowfish-perl/current/META.yml
    branches/upstream/libcrypt-blowfish-perl/current/README
    branches/upstream/libcrypt-blowfish-perl/current/_blowfish.c

Modified: branches/upstream/libcrypt-blowfish-perl/current/Blowfish.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcrypt-blowfish-perl/current/Blowfish.pm?rev=53597&op=diff
==============================================================================
--- branches/upstream/libcrypt-blowfish-perl/current/Blowfish.pm (original)
+++ branches/upstream/libcrypt-blowfish-perl/current/Blowfish.pm Fri Mar  5 11:29:20 2010
@@ -16,7 +16,7 @@
 	new encrypt decrypt
 );
 
-$VERSION = '2.10';
+$VERSION = '2.12';
 bootstrap Crypt::Blowfish $VERSION;
 
 use strict;
@@ -31,43 +31,32 @@
 
 
 sub blocksize   {  8; } # /* byte my shiny metal.. */
-sub keysize     {  0; } # /* we'll leave this at 8 .. for now.  expect change. */
+sub keysize     {  0; } # /* we'll leave this at 8 .. for now. */
 sub min_keysize {  8; }
 sub max_keysize { 56; }  
 
 sub new
 {
 	usage("new Blowfish key") unless @_ == 2;
-
 	my $type = shift; my $self = {}; bless $self, $type;
-
 	$self->{'ks'} = Crypt::Blowfish::init(shift);
-
-	$self;
+	return $self;
 }
 
 sub encrypt
 {
 	usage("encrypt data[8 bytes]") unless @_ == 2;
-
-	my $self = shift;
-	my $data = shift;
-
+	my ($self,$data) = @_;
 	Crypt::Blowfish::crypt($data, $data, $self->{'ks'}, 0);
-
-	$data;
+	return $data;
 }
 
 sub decrypt
 {
 	usage("decrypt data[8 bytes]") unless @_ == 2;
-
-	my $self = shift;
-	my $data = shift;
-
+	my ($self,$data) = @_; 
 	Crypt::Blowfish::crypt($data, $data, $self->{'ks'}, 1);
-
-	$data;
+	return $data;
 }
 
 1;
@@ -75,7 +64,7 @@
 __END__
 #
 # Parts Copyright (C) 1995, 1996 Systemics Ltd (http://www.systemics.com/)
-# New Parts Copyright (C) 2000, 2001 W3Works, LLC (http://www.w3works.com/)
+# New Parts Copyright (C) 1999, 2001 W3Works, LLC (http://www.w3works.com/)
 # All rights reserved.
 #
 
@@ -89,6 +78,9 @@
   my $cipher = new Crypt::Blowfish $key; 
   my $ciphertext = $cipher->encrypt($plaintext);
   my $plaintext  = $cipher->decrypt($ciphertext);
+
+  You probably want to use this in conjunction with 
+  a block chaining module like Crypt::CBC.
 
 =head1 DESCRIPTION
 
@@ -117,8 +109,8 @@
 Returns the size (in bytes) of the block cipher.
 
 Crypt::Blowfish doesn't return a key size due to its ability
-to use variable-length keys. (well, more accurately, it won't
-as of 2.09 .. for now, it does.  expect that to change)
+to use variable-length keys.  More accurately, it shouldn't,
+but it does anyway to play nicely with others. 
 
 =item new
 
@@ -170,12 +162,7 @@
 very good at this.  If you're not going to encrypt more than 
 eight bytes, your data B<must> be B<exactly> eight bytes long.
 If need be, do your own padding. "\0" as a null byte is perfectly
-valid to use for this.  Additionally, the current maintainer for 
-Crypt::Blowfish may or may not release Crypt::CBC_R which 
-replaces the default 'RandomIV' initialization vector in 
-Crypt::CBC with a random initialization vector.  (to the limits 
-of /dev/urandom and associates)  In either case, please email
-amused at pobox.com for Crypt::CBC_R.
+valid to use for this. 
 
 =head1 SEE ALSO
 
@@ -195,7 +182,7 @@
 copyright of Systemics Ltd ( http://www.systemics.com/ ). 
 
 Code revisions, updates, and standalone release are copyright
-1999-2001 W3Works, LLC.
+1999-2010 W3Works, LLC.
 
 =head1 AUTHOR
 

Modified: branches/upstream/libcrypt-blowfish-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcrypt-blowfish-perl/current/Changes?rev=53597&op=diff
==============================================================================
--- branches/upstream/libcrypt-blowfish-perl/current/Changes (original)
+++ branches/upstream/libcrypt-blowfish-perl/current/Changes Fri Mar  5 11:29:20 2010
@@ -1,4 +1,12 @@
 Revision history for Perl extension Crypt::Blowfish.
+
+2.12 04 Mar 2010
+	- updated Changes to mesh with revision.
+
+2.11  Feb 2010
+	- patched _blowfish.c to stop spurious warnings.
+	- updated POD
+
 2.10  Fri Dec 02 07:36:18 EST 2005
 	- updated the README file to remove the reference
 	  to CBC_R - no longer available.

Modified: branches/upstream/libcrypt-blowfish-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcrypt-blowfish-perl/current/META.yml?rev=53597&op=diff
==============================================================================
--- branches/upstream/libcrypt-blowfish-perl/current/META.yml (original)
+++ branches/upstream/libcrypt-blowfish-perl/current/META.yml Fri Mar  5 11:29:20 2010
@@ -1,10 +1,12 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Crypt-Blowfish
-version:      2.10
-version_from: Blowfish.pm
-installdirs:  site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+--- #YAML:1.0
+name:                Crypt-Blowfish
+version:             2.12
+abstract:            ~
+license:             ~
+author:              ~
+generated_by:        ExtUtils::MakeMaker version 6.42
+distribution_type:   module
+requires:     
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: branches/upstream/libcrypt-blowfish-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcrypt-blowfish-perl/current/README?rev=53597&op=diff
==============================================================================
--- branches/upstream/libcrypt-blowfish-perl/current/README (original)
+++ branches/upstream/libcrypt-blowfish-perl/current/README Fri Mar  5 11:29:20 2010
@@ -1,4 +1,4 @@
-This is Crypt::Blowfish version 2.09, an XS-based implementation of the
+This is Crypt::Blowfish version 2.11, an XS-based implementation of the
 Blowfish cryptography algorithm designed by Bruce Schneier.  It's designed
 to take full advantage of Crypt::CBC when desired.  Blowfish keys may be
 up to 448 bits (56 bytes) long.  This module builds on nearly every platform
@@ -55,10 +55,27 @@
 Crypt::Blowfish_PP module - the Pure Perl implimentation.
 
 Thanks to Thomas Kratz for the Win32 fixup and VMS report.
+Thanks to Sandro Bonazzola for prompting code cleanup.
+
 
 Performance
 -----------
 
+Typical results on a P4 3.0GHz Linux machine:
+Under: Perl-v5.10.0: 
+Running standard mode speed tests.. encrypting with non-cached cipher
+5,000 cycles:  0 wallclock secs ( 0.36 usr +  0.00 sys =  0.36 CPU)
+
+Running standard mode speed tests.. decrypting with non-cached cipher
+5,000 cycles:  1 wallclock secs ( 0.35 usr +  0.00 sys =  0.35 CPU)
+
+Running standard mode speed tests.. encrypting with cached cipher
+10,000 cycles:  0 wallclock secs ( 0.05 usr +  0.00 sys =  0.05 CPU)
+
+Running standard mode speed tests.. decrypting with cached cipher
+10,000 cycles:  0 wallclock secs ( 0.04 usr +  0.00 sys =  0.04 CPU)
+
+
 Typical results on a PII-400 Linux machine:
 Under  Perl-5.005_03:
 Running standard mode speed tests.. encrypting with non-cached cipher

Modified: branches/upstream/libcrypt-blowfish-perl/current/_blowfish.c
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcrypt-blowfish-perl/current/_blowfish.c?rev=53597&op=diff
==============================================================================
--- branches/upstream/libcrypt-blowfish-perl/current/_blowfish.c (original)
+++ branches/upstream/libcrypt-blowfish-perl/current/_blowfish.c Fri Mar  5 11:29:20 2010
@@ -16,20 +16,19 @@
 /* File: bf.c
    Blowfish cipher by Bruce Schneier,
    Code by Bryan Olson, based partly on Schneier's.
-*/
-
+   Improvements and ongoing mantenance by Dave Paris
+*/
+
+#include <string.h>
 
 /* Define IntU32 to be an unsigned in 32 bits long */
 typedef unsigned int IntU32 ;
 typedef unsigned char IntU8 ;
 #define NROUNDS         16
 
-
-
 /* Define IntP to be an integer which
    is the same size as a pointer. */
 typedef unsigned long IntP ;
-
 
 typedef struct
 {
@@ -324,8 +323,6 @@
        r ^= ( (sub(S[0],l>>22 & 0x3fc) + sub(S[1],l>>14 & 0x3fc)) \
 	      ^ sub(S[2],l>>6 & 0x3fc) ) +S[3][l & 0xff] 
 
-
-
 /* This function requires the block to be two 32 bit integers, in 
 whatever endian form the machine uses.  On little endian machines 
 use crypt_8bytes() on user data.  make_bfkey should call crypt_block
@@ -425,7 +422,7 @@
    /* Test init data. */
    if( checksum != 0x55861a61 )
      {
-       strcpy((char *)bfkey, "Bad initialization data");
+       strncpy((char *)bfkey, "Bad initialization data",24);
        return -1;
      }
 
@@ -440,10 +437,9 @@
      crypt_block( dspace, bfkey, 1 ) ;
    if( (checksum!=0xaafe4ebd) || dspace[0] || dspace[1] )
      {
-		strcpy((char *)bfkey, "Error in crypt_block routine");
+		strncpy((char *)bfkey, "Error in crypt_block routine",29);
        return -1;
      }
-
    
    /* Xor key string into encryption key vector */
    j = 0 ;
@@ -455,7 +451,6 @@
 	   data = (data << 8) | key_string[j++ % keylength];
        (bfkey->p)[0][i] ^= data; 
      }
-
 
    for (i = 0 ; i<NROUNDS+2 ; i+=2) 
      {




More information about the Pkg-perl-cvs-commits mailing list