More strlen() / empty() changes

This commit is contained in:
terrafrost 2013-01-03 00:26:27 -06:00
parent 9b4240c104
commit 61ad80fd64
3 changed files with 5 additions and 5 deletions

View File

@ -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) {

View File

@ -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) {

View File

@ -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) {