diff --git a/phpseclib/Crypt/DES.php b/phpseclib/Crypt/DES.php index e377c3a8..8b857c6c 100644 --- a/phpseclib/Crypt/DES.php +++ b/phpseclib/Crypt/DES.php @@ -774,7 +774,7 @@ class Crypt_DES { } break; case CRYPT_DES_MODE_CFB: - if (!empty($buffer['ciphertext'])) { + if (strlen($buffer['ciphertext'])) { $plaintext = $ciphertext ^ substr($this->decryptIV, strlen($buffer['ciphertext'])); $buffer['ciphertext'].= substr($ciphertext, 0, strlen($plaintext)); if (strlen($buffer['ciphertext']) == 8) { diff --git a/phpseclib/Crypt/Rijndael.php b/phpseclib/Crypt/Rijndael.php index fec684a0..dc22488b 100644 --- a/phpseclib/Crypt/Rijndael.php +++ b/phpseclib/Crypt/Rijndael.php @@ -741,7 +741,7 @@ class Crypt_Rijndael { break; case CRYPT_RIJNDAEL_MODE_CTR: $xor = $this->encryptIV; - if (!empty($buffer['encrypted'])) { + if (strlen($buffer['encrypted'])) { for ($i = 0; $i < strlen($plaintext); $i+=$block_size) { $block = substr($plaintext, $i, $block_size); $buffer['encrypted'].= $this->_encryptBlock($this->_generate_xor($block_size, $xor)); @@ -862,7 +862,7 @@ class Crypt_Rijndael { break; case CRYPT_RIJNDAEL_MODE_CTR: $xor = $this->decryptIV; - if (!empty($buffer['ciphertext'])) { + if (strlen($buffer['ciphertext'])) { for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) { $block = substr($ciphertext, $i, $block_size); $buffer['ciphertext'].= $this->_encryptBlock($this->_generate_xor($block_size, $xor)); @@ -884,7 +884,7 @@ class Crypt_Rijndael { } break; case CRYPT_RIJNDAEL_MODE_CFB: - if (!empty($buffer['ciphertext'])) { + if (strlen($buffer['ciphertext'])) { $plaintext = $ciphertext ^ substr($this->decryptIV, strlen($buffer['ciphertext'])); $buffer['ciphertext'].= substr($ciphertext, 0, strlen($plaintext)); if (strlen($buffer['ciphertext']) == $block_size) { diff --git a/phpseclib/Crypt/TripleDES.php b/phpseclib/Crypt/TripleDES.php index 1e34acf3..f92f7c34 100644 --- a/phpseclib/Crypt/TripleDES.php +++ b/phpseclib/Crypt/TripleDES.php @@ -822,7 +822,7 @@ class Crypt_TripleDES { } break; case CRYPT_DES_MODE_CFB: - if (!empty($buffer['ciphertext'])) { + if (strlen($buffer['ciphertext'])) { $plaintext = $ciphertext ^ substr($this->decryptIV, strlen($buffer['ciphertext'])); $buffer['ciphertext'].= substr($ciphertext, 0, strlen($plaintext)); if (strlen($buffer['ciphertext']) == 8) {