From 76a24dc54618a00af8a6dfbae14c1c47f7aeeda0 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Fri, 11 Jan 2013 18:09:28 -0600 Subject: [PATCH] AES: $pos will always be 0 in the last if statement for CFB --- phpseclib/Crypt/Rijndael.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpseclib/Crypt/Rijndael.php b/phpseclib/Crypt/Rijndael.php index a2526765..36098eb6 100644 --- a/phpseclib/Crypt/Rijndael.php +++ b/phpseclib/Crypt/Rijndael.php @@ -795,7 +795,7 @@ class Crypt_Rijndael { $iv = $this->_encryptBlock($iv); //$block = substr($iv, $pos, $len) ^ substr($plaintext, $i, $len); $block = substr($iv, $pos) ^ substr($plaintext, $i); - $iv = substr_replace($iv, $block, $pos, $len); + $iv = substr_replace($iv, $block, 0, $len); $ciphertext.= $block; $pos+= $len; } @@ -927,7 +927,7 @@ class Crypt_Rijndael { if ($len) { $iv = $this->_encryptBlock($iv); $plaintext.= substr($iv, $pos) ^ substr($ciphertext, $i); - $iv = substr_replace($iv, substr($ciphertext, $i, $len), $pos, $len); + $iv = substr_replace($iv, substr($ciphertext, $i, $len), 0, $len); $pos+= $len; } if ($this->continuousBuffer) {