Skip to content

Commit 8838561

Browse files
committed
Fix test for sha1 digest issue and croak on use_pkcs1_padding
1 parent c58f6c8 commit 8838561

3 files changed

Lines changed: 5 additions & 7 deletions

File tree

RSA.pm

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,14 +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.
248+
based side channel attacks. use_pkcs1_padding() results in a fatal error.
249249
L<Marvin Attack|https://github.com/tomato42/marvin-toolkit/blob/master/README.md>
250250
251-
use_pkcs1_padding() now sets the padding method to use_pkcs1_pss_padding.
252-
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.
255-
256251
=item use_pkcs1_oaep_padding
257252
258253
Use C<EME-OAEP> padding as defined in PKCS #1 v2.0 with SHA-1, MGF1 and
@@ -267,6 +262,8 @@ should be used as a replacement for RSA-PKCS#1 v1.5. The module specifies
267262
the message digest being requested and the appropriate mgf1 setting and
268263
salt length for the digest.
269264
265+
B<Note>: RSA-PSS cannot be used for encryption/decryption and results in a
266+
fatal error. Call C<use_pkcs1_oaep_padding> for encryption operations.
270267
=item use_sslv23_padding
271268
272269
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: 1 addition & 0 deletions
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;

0 commit comments

Comments
 (0)