Skip to content

Commit

Permalink
Cleanup whitespace.
Browse files Browse the repository at this point in the history
git-svn-id: svn://localhost/Crypt-GCrypt/trunk@44 c2f821fb-fd85-dc11-8383-000bcdcb7a8f
  • Loading branch information
al committed Nov 22, 2009
1 parent f423700 commit 747bcce
Show file tree
Hide file tree
Showing 9 changed files with 389 additions and 389 deletions.
22 changes: 11 additions & 11 deletions Changelog
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ version 1.17 (2007/10/29):
(untested)

version 1.16 (2006/12/20):
- fixed compilation issue with GCC 2.95
- test compatibility with Crypt::CBC 2.17
- minor code cleanup

- fixed compilation issue with GCC 2.95
- test compatibility with Crypt::CBC 2.17
- minor code cleanup

version 1.15 (2006/01/06):
- fixed t/05-size.t (now skips if we don't have Devel::Size)

- fixed t/05-size.t (now skips if we don't have Devel::Size)

version 1.14 (2006/01/06):

Expand All @@ -63,11 +63,11 @@ version 1.1.1 (2005/12/22):
- added t/03-pod.t and t/04-podcoverage.t

version 1.1 (2005/10/10):
- added finish() to handle partial blocks
- added padding with null and standard methods
- added compatibility test with Crypt::CBC

- added finish() to handle partial blocks
- added padding with null and standard methods
- added compatibility test with Crypt::CBC

version 1.00 (2005/10/09):

- new
- new
20 changes: 10 additions & 10 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ foreach (@ARGV) {
# if we still need $gcrypt_libpath let's try the default
# locations
if (not $gcrypt_libpath and $] >= 5.006001) {
require ExtUtils::Liblist;
($gcrypt_libpath) = ExtUtils::Liblist->ext('-lgcrypt');
require ExtUtils::Liblist;
($gcrypt_libpath) = ExtUtils::Liblist->ext('-lgcrypt');
}

# let's check with Devel::CheckLib;
Expand All @@ -34,13 +34,13 @@ my @extras = $gcrypt_incpath ? (INC => "-I$gcrypt_incpath") : ();
my $libs = $gcrypt_libpath ? "-L$gcrypt_libpath -lgcrypt" : '-lgcrypt';

WriteMakefile(
'NAME' => 'Crypt::GCrypt',
'ABSTRACT' => 'Perl interface to the GNU libgcrypt library',
'AUTHOR' => 'Alessandro Ranellucci <aar@cpan.org>',
'VERSION_FROM' => 'lib/Crypt/GCrypt.pm',
'LIBS' => $libs,
'DEFINE' => '',
'CCFLAGS' => '-funsigned-char',
'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz' },
'NAME' => 'Crypt::GCrypt',
'ABSTRACT' => 'Perl interface to the GNU libgcrypt library',
'AUTHOR' => 'Alessandro Ranellucci <aar@cpan.org>',
'VERSION_FROM' => 'lib/Crypt/GCrypt.pm',
'LIBS' => $libs,
'DEFINE' => '',
'CCFLAGS' => '-funsigned-char',
'dist' => { COMPRESS => 'gzip', SUFFIX => 'gz' },
@extras
);
6 changes: 3 additions & 3 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ ftp://ftp.gnupg.org/gcrypt/libgcrypt/

and then you can install it just doing:

$ ./configure
$ make
# make install
$ ./configure
$ make
# make install

Crypt::GCrypt was tested with libgcrypt 1.2.4.

Expand Down
34 changes: 17 additions & 17 deletions t/01-cipher.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ ok(Crypt::GCrypt::cipher_algo_available('arcfour'));
ok(Crypt::GCrypt::cipher_algo_available('twofish'));

my $c = Crypt::GCrypt->new(
type => 'cipher',
algorithm => 'aes',
mode => 'cbc',
padding => 'null'
type => 'cipher',
algorithm => 'aes',
mode => 'cbc',
padding => 'null'
);
ok(defined $c && $c->isa('Crypt::GCrypt'));
ok($c->keylen == 16);
Expand All @@ -44,10 +44,10 @@ ok(substr($d, 0, length $p) eq $p)
or print STDERR "[",unpack('H*',$d),"]\n";;

$c = Crypt::GCrypt->new(
type => 'cipher',
algorithm => 'aes',
mode => 'ecb',
padding => 'null'
type => 'cipher',
algorithm => 'aes',
mode => 'ecb',
padding => 'null'
);
$c->start('encrypting');
$c->setkey($key);
Expand All @@ -56,9 +56,9 @@ $e .= $c->finish;
ok($e eq $e0) or print STDERR "[",unpack('H*',$e),"]\n";

$c = Crypt::GCrypt->new(
type => 'cipher',
algorithm => 'twofish',
padding => 'null'
type => 'cipher',
algorithm => 'twofish',
padding => 'null'
);
ok($c->keylen == 32);
ok($c->blklen == 16);
Expand All @@ -77,9 +77,9 @@ ok(substr($d, 0, length $p) eq $p)
or print STDERR "[$d|",unpack('H*',$d),"]\n";

$c = Crypt::GCrypt->new(
type => 'cipher',
algorithm => 'arcfour',
padding => 'null'
type => 'cipher',
algorithm => 'arcfour',
padding => 'null'
);
ok($c->keylen == 16);
ok($c->blklen == 1);
Expand All @@ -98,9 +98,9 @@ ok(substr($d, 0, length $p) eq $p)
### 'none' padding
{
$c = Crypt::GCrypt->new(
type => 'cipher',
algorithm => 'aes',
padding => 'none'
type => 'cipher',
algorithm => 'aes',
padding => 'none'
);
$c->start('encrypting');
ok(!eval {my $e2 = $c->encrypt('aaa'); 1}); # this should die
Expand Down
60 changes: 30 additions & 30 deletions t/02-compatibility.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#########################

use Test;
BEGIN {
plan tests => 1; # <--- number of tests
$HAVE_CRYPT_CBC = eval "use Crypt::CBC (); 1;";
$HAVE_CAST5 = eval "use Crypt::CAST5 (); 1;";
BEGIN {
plan tests => 1; # <--- number of tests
$HAVE_CRYPT_CBC = eval "use Crypt::CBC (); 1;";
$HAVE_CAST5 = eval "use Crypt::CAST5 (); 1;";
};

use ExtUtils::testlib;
Expand All @@ -16,30 +16,30 @@ use Crypt::GCrypt;
#########################

skip(!($HAVE_CRYPT_CBC && $HAVE_CAST5), sub {
my $c = Crypt::GCrypt->new(
type => 'cipher',
algorithm => 'cast5',
mode => 'cbc',
padding => 'standard'
);
$c->start('encrypting');
$c->setkey(my $key = "the key, the key");
$c->setiv("12345678");
my $p = 'plain text';
my $e = $c->encrypt($p);
$e .= $c->finish;
my $cipher = Crypt::CBC->new(
-key => $key,
-literal_key => 1,
-cipher => 'CAST5',
-padding => 'standard',
-iv => "12345678",
-header => "none"
);
$cipher->start('decrypting');
my $d = $cipher->crypt($e);
$d .= $cipher->finish;
return ($d eq $p);
my $c = Crypt::GCrypt->new(
type => 'cipher',
algorithm => 'cast5',
mode => 'cbc',
padding => 'standard'
);
$c->start('encrypting');
$c->setkey(my $key = "the key, the key");
$c->setiv("12345678");

my $p = 'plain text';
my $e = $c->encrypt($p);
$e .= $c->finish;

my $cipher = Crypt::CBC->new(
-key => $key,
-literal_key => 1,
-cipher => 'CAST5',
-padding => 'standard',
-iv => "12345678",
-header => "none"
);
$cipher->start('decrypting');
my $d = $cipher->crypt($e);
$d .= $cipher->finish;
return ($d eq $p);
});
16 changes: 8 additions & 8 deletions t/05-size.t
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
use Test::More;

if (eval "use Devel::Size qw[total_size]; 1") {
plan tests => 1;
plan tests => 1;
} else {
plan skip_all => "Devel::Size required for testing memory";
plan skip_all => "Devel::Size required for testing memory";
}

use ExtUtils::testlib;
use Crypt::GCrypt;

my $c = Crypt::GCrypt->new(
type => 'cipher',
algorithm => 'aes',
mode => 'cbc',
padding => 'null'
type => 'cipher',
algorithm => 'aes',
mode => 'cbc',
padding => 'null'
);
$c->start('encrypting');
$c->setkey("the key, the key");
Expand All @@ -22,8 +22,8 @@ my $fp = total_size($c);

my $e;
for (1..50) {
print "$_\n";
$e .= $c->encrypt('plain text' x 4);
print "$_\n";
$e .= $c->encrypt('plain text' x 4);
}
$e .= $c->finish;

Expand Down
14 changes: 7 additions & 7 deletions t/06-multi.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ use ExtUtils::testlib;
use Crypt::GCrypt;

my $c = Crypt::GCrypt->new(
type => 'cipher',
algorithm => 'aes', # blklen == 16
mode => 'cbc',
padding => 'standard'
type => 'cipher',
algorithm => 'aes', # blklen == 16
mode => 'cbc',
padding => 'standard'
);
$c->setkey('b' x 32);

{
my $text = 'a' x 999;

$c->start('encrypting');
my $t1 = substr($text, 0, 512);
my $t2 = substr($text, 512);
Expand Down Expand Up @@ -43,7 +43,7 @@ $c->setkey('b' x 32);
Lorem ipsum dolor sit amet, con
EOF
printf "length of original text is %d\n", length($text);

$c->start('encrypting');
my $e = $c->encrypt($text) . $c->finish;
printf "length of encrypted text is %d\n", length($e);
Expand All @@ -52,7 +52,7 @@ EOF
my $d = $c->decrypt($e);
my $d2 = $c->finish; # discarding finish() output
printf "length of decrypted text is %d\n", length($d);

ok($d eq $text);
ok(length $d == length $text);
}
Expand Down
Loading

0 comments on commit 747bcce

Please sign in to comment.