Skip to content

Commit a0d296c

Browse files
committed
Fix bitwise & versus logical &&
1 parent c083828 commit a0d296c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/XML/Enc.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -469,10 +469,10 @@ sub _DecryptData {
469469

470470
# XML Encryption 5.2 Block Encryption Algorithms
471471
# The resulting cipher text is prefixed by the IV.
472-
if (defined $encmethods{$method} & $method !~ /gcm/ ){
472+
if (defined $encmethods{$method} && $method !~ /gcm/ ){
473473
my $cbc = Crypt::Mode::CBC->new($encmethods{$method}->{modename}, 0);
474474
$plaintext = $self->_remove_padding($cbc->decrypt($encrypted, $key, $iv));
475-
} elsif (defined $encmethods{$method} & $method =~ /gcm/ ){
475+
} elsif (defined $encmethods{$method} && $method =~ /gcm/ ){
476476
my $gcm = Crypt::AuthEnc::GCM->new("AES", $key, $iv);
477477

478478
# Note that GCM support for additional authentication
@@ -503,13 +503,13 @@ sub _EncryptData {
503503
my $iv = random_bytes ( $ivsize);
504504
${$key} = random_bytes ( $keysize);
505505

506-
if (defined $encmethods{$method} & $method !~ /gcm/ ){
506+
if (defined $encmethods{$method} && $method !~ /gcm/ ){
507507
my $cbc = Crypt::Mode::CBC->new($encmethods{$method}->{modename}, 0);
508508
# XML Encryption 5.2 Block Encryption Algorithms
509509
# The resulting cipher text is prefixed by the IV.
510510
$data = $self->_add_padding($data, $ivsize);
511511
$cipherdata = $iv . $cbc->encrypt($data, ${$key}, $iv);
512-
} elsif (defined $encmethods{$method} & $method =~ /gcm/ ){
512+
} elsif (defined $encmethods{$method} && $method =~ /gcm/ ){
513513
my $gcm = Crypt::AuthEnc::GCM->new($encmethods{$method}->{modename}, ${$key}, $iv);
514514

515515
# Note that GCM support for additional authentication

0 commit comments

Comments
 (0)