@@ -5,9 +5,9 @@ use Crypt::OpenSSL::Random;
55use Crypt::OpenSSL::RSA;
66use Crypt::OpenSSL::Guess qw( openssl_version) ;
77
8- BEGIN { plan tests => 43 +
9- ( UNIVERSAL::can( " Crypt::OpenSSL::RSA" , " use_sha512_hash" ) ? 4 * 5 : 0 ) +
10- ( UNIVERSAL::can( " Crypt::OpenSSL::RSA " , " use_whirlpool_hash " ) ? 1 * 5 : 0 ) }
8+ BEGIN {
9+ plan tests => 43 + ( UNIVERSAL::can( " Crypt::OpenSSL::RSA" , " use_sha512_hash" ) ? 4 * 5 : 0 ) + ( UNIVERSAL::can( " Crypt::OpenSSL::RSA " , " use_whirlpool_hash " ) ? 1 * 5 : 0 );
10+ }
1111
1212sub _Test_Encrypt_And_Decrypt {
1313 my ( $p_plaintext_length , $p_rsa , $p_check_private_encrypt ) = @_ ;
@@ -34,20 +34,20 @@ sub _Test_Encrypt_And_Decrypt {
3434sub _Test_Sign_And_Verify {
3535 my ( $plaintext , $rsa , $rsa_pub , $hash ) = @_ ;
3636
37- my $sig = eval { $rsa -> sign($plaintext )};
38- SKIP: {
39- skip " OpenSSL error: illegal or unsupported padding mode - $hash " , 5 if $@ =~ / illegal or unsupported padding mode/i ;
40- ok( $rsa_pub -> verify( $plaintext , $sig ) );
37+ my $sig = eval { $rsa -> sign($plaintext ) };
38+ SKIP: {
39+ skip " OpenSSL error: illegal or unsupported padding mode - $hash " , 5 if $@ =~ / illegal or unsupported padding mode/i ;
40+ ok( $rsa_pub -> verify( $plaintext , $sig ) );
4141
42- my $false_sig = unpack " H*" , $sig ;
43- $false_sig =~ tr / [a-f]/ [0a-d]/ ;
44- ok( !$rsa_pub -> verify( $plaintext , pack ( " H*" , $false_sig ) ) );
45- ok( !$rsa -> verify( $plaintext , pack ( " H*" , $false_sig ) ) );
42+ my $false_sig = unpack " H*" , $sig ;
43+ $false_sig =~ tr / [a-f]/ [0a-d]/ ;
44+ ok( !$rsa_pub -> verify( $plaintext , pack ( " H*" , $false_sig ) ) );
45+ ok( !$rsa -> verify( $plaintext , pack ( " H*" , $false_sig ) ) );
4646
47- my $sig_of_other = $rsa -> sign(" different" );
48- ok( !$rsa_pub -> verify( $plaintext , $sig_of_other ) );
49- ok( !$rsa -> verify( $plaintext , $sig_of_other ) );
50- }
47+ my $sig_of_other = $rsa -> sign(" different" );
48+ ok( !$rsa_pub -> verify( $plaintext , $sig_of_other ) );
49+ ok( !$rsa -> verify( $plaintext , $sig_of_other ) );
50+ }
5151}
5252
5353sub _check_for_croak {
@@ -151,21 +151,22 @@ if ( UNIVERSAL::can( "Crypt::OpenSSL::RSA", "use_sha512_hash" ) ) {
151151 _Test_Sign_And_Verify( $plaintext , $rsa , $rsa_pub , " sha512" );
152152}
153153
154- my ($major , $minor , $patch ) = openssl_version();
154+ my ( $major , $minor , $patch ) = openssl_version();
155155
156156SKIP: {
157- skip " ripemd160 in legacy provider between 3.02 and 3.07" , 5 if $major eq ' 3.0' &&
158- ($minor ge ' 2' && $minor le ' 6' );
157+ skip " ripemd160 in legacy provider between 3.02 and 3.07" , 5
158+ if $major eq ' 3.0'
159+ && ( $minor ge ' 2' && $minor le ' 6' );
159160
160- $rsa -> use_ripemd160_hash();
161- $rsa_pub -> use_ripemd160_hash();
162- _Test_Sign_And_Verify( $plaintext , $rsa , $rsa_pub , " ripemd160" );
161+ $rsa -> use_ripemd160_hash();
162+ $rsa_pub -> use_ripemd160_hash();
163+ _Test_Sign_And_Verify( $plaintext , $rsa , $rsa_pub , " ripemd160" );
163164}
164165
165- if (UNIVERSAL::can(" Crypt::OpenSSL::RSA" , " use_whirlpool_hash" ) ) {
166+ if ( UNIVERSAL::can( " Crypt::OpenSSL::RSA" , " use_whirlpool_hash" ) ) {
166167 $rsa -> use_whirlpool_hash();
167168 $rsa_pub -> use_whirlpool_hash();
168- _Test_Sign_And_Verify($plaintext , $rsa , $rsa_pub , " whirlpool" );
169+ _Test_Sign_And_Verify( $plaintext , $rsa , $rsa_pub , " whirlpool" );
169170}
170171
171172# check subclassing
0 commit comments