Skip to content

Commit d35f36c

Browse files
committed
Fix test for sha1 digest issue and croak on use_pkcs1_padding
1 parent 0ea9c52 commit d35f36c

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

RSA.pm

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,9 @@ Encrypting user data directly with RSA is insecure.
245245
246246
PKCS #1 v1.5 padding has been disabled as it is nearly impossible to use this
247247
padding method in a secure manner. It is known to be vulnerable to timing
248-
based side channel attacks.
249-
L<Marvin Attack|https://github.com/tomato42/marvin-toolkit/blob/master/README.md>
250-
251-
use_pkcs1_padding() now sets the padding method to use_pkcs1_pss_padding.
248+
based side channel attacks. use_pkcs1_padding() results in a fatal error.
252249
253-
B<Note>: RSA-PSS cannot be used for encryption/decryption and results in a
254-
fatal error. Call C<use_pkcs1_oaep_padding> for encryption operations.
250+
L<Marvin Attack|https://github.com/tomato42/marvin-toolkit/blob/master/README.md>
255251
256252
=item use_pkcs1_oaep_padding
257253
@@ -267,6 +263,9 @@ should be used as a replacement for RSA-PKCS#1 v1.5. The module specifies
267263
the message digest being requested and the appropriate mgf1 setting and
268264
salt length for the digest.
269265
266+
B<Note>: RSA-PSS cannot be used for encryption/decryption and results in a
267+
fatal error. Call C<use_pkcs1_oaep_padding> for encryption operations.
268+
270269
=item use_sslv23_padding
271270
272271
Use C<PKCS #1 v1.5> padding with an SSL-specific modification that

RSA.xs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,7 @@ void
931931
use_pkcs1_padding(p_rsa)
932932
rsaData* p_rsa;
933933
CODE:
934-
p_rsa->padding = RSA_PKCS1_PSS_PADDING;
934+
croak("PKCS#1 1.5 is disabled as it is known to be vulnerable to marvin attacks.");
935935

936936
void
937937
use_pkcs1_oaep_padding(p_rsa)

t/rsa.t

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ sub _Test_Sign_And_Verify {
3737
my $sig = eval { $rsa->sign($plaintext) };
3838
SKIP: {
3939
skip "OpenSSL error: illegal or unsupported padding mode - $hash", 5 if $@ =~ /illegal or unsupported padding mode/i;
40+
skip "OpenSSL error: invalid digest - $hash", 5 if $@ =~ /invalid digest/i;
4041
ok( $rsa_pub->verify( $plaintext, $sig ), "rsa_pub verify $hash");
4142

4243
my $false_sig = unpack "H*", $sig;
@@ -121,7 +122,7 @@ _check_for_croak(
121122

122123
$plaintext .= $plaintext x 5;
123124

124-
my @paddings = qw/pkcs1 pkcs1_oaep pkcs1_pss/;
125+
my @paddings = qw/pkcs1_oaep pkcs1_pss/;
125126
foreach my $padding (@paddings) {
126127
my $p = "use_$padding\_padding";
127128

0 commit comments

Comments
 (0)