1
0
mirror of https://github.com/danog/tgseclib.git synced 2024-11-30 04:39:02 +01:00

AES: $pos will always be 0 in the last if statement for CFB

This commit is contained in:
terrafrost 2013-01-11 18:09:28 -06:00
parent 7c0926d94a
commit 76a24dc546

View File

@ -795,7 +795,7 @@ class Crypt_Rijndael {
$iv = $this->_encryptBlock($iv); $iv = $this->_encryptBlock($iv);
//$block = substr($iv, $pos, $len) ^ substr($plaintext, $i, $len); //$block = substr($iv, $pos, $len) ^ substr($plaintext, $i, $len);
$block = substr($iv, $pos) ^ substr($plaintext, $i); $block = substr($iv, $pos) ^ substr($plaintext, $i);
$iv = substr_replace($iv, $block, $pos, $len); $iv = substr_replace($iv, $block, 0, $len);
$ciphertext.= $block; $ciphertext.= $block;
$pos+= $len; $pos+= $len;
} }
@ -927,7 +927,7 @@ class Crypt_Rijndael {
if ($len) { if ($len) {
$iv = $this->_encryptBlock($iv); $iv = $this->_encryptBlock($iv);
$plaintext.= substr($iv, $pos) ^ substr($ciphertext, $i); $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; $pos+= $len;
} }
if ($this->continuousBuffer) { if ($this->continuousBuffer) {