Skip to content

Commit 160af60

Browse files
committed
Fix decryption of ciphertext created with 'header' => 'randomiv'
Patch originally from Paulo Andrade: https://bugzilla.redhat.com/show_bug.cgi?id=2235322 The function sub key_and_iv () in the module Crypt/CBC/PBKDF.pm returns two values: key and iv In sub _read_key_and_iv in Crypt/CBC.pm, the key is set from the second return value rather than the first, causing decryption failures (#6). This commit changes sub _read_key_and_iv to use the first value instead, fixing the problem.
1 parent 524db90 commit 160af60

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Crypt/CBC.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ sub _read_key_and_iv {
661661
croak "Ciphertext does not begin with a valid header for 'randomiv' header mode" unless defined $self->{iv};
662662
croak "randomiv header mode cannot be used securely when decrypting with a >8 byte block cipher.\n"
663663
unless $self->blocksize == 8;
664-
(undef,$self->{key}) = $self->pbkdf_obj->key_and_iv(undef,$self->{passphrase});
664+
($self->{key},undef) = $self->pbkdf_obj->key_and_iv(undef,$self->{passphrase});
665665
substr($$input_stream,0,16) = ''; # truncate
666666
}
667667

0 commit comments

Comments
 (0)