mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 03:42:40 +00:00
More strlen() / empty() changes
This commit is contained in:
parent
9b4240c104
commit
61ad80fd64
@ -774,7 +774,7 @@ class Crypt_DES {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CRYPT_DES_MODE_CFB:
|
case CRYPT_DES_MODE_CFB:
|
||||||
if (!empty($buffer['ciphertext'])) {
|
if (strlen($buffer['ciphertext'])) {
|
||||||
$plaintext = $ciphertext ^ substr($this->decryptIV, strlen($buffer['ciphertext']));
|
$plaintext = $ciphertext ^ substr($this->decryptIV, strlen($buffer['ciphertext']));
|
||||||
$buffer['ciphertext'].= substr($ciphertext, 0, strlen($plaintext));
|
$buffer['ciphertext'].= substr($ciphertext, 0, strlen($plaintext));
|
||||||
if (strlen($buffer['ciphertext']) == 8) {
|
if (strlen($buffer['ciphertext']) == 8) {
|
||||||
|
@ -741,7 +741,7 @@ class Crypt_Rijndael {
|
|||||||
break;
|
break;
|
||||||
case CRYPT_RIJNDAEL_MODE_CTR:
|
case CRYPT_RIJNDAEL_MODE_CTR:
|
||||||
$xor = $this->encryptIV;
|
$xor = $this->encryptIV;
|
||||||
if (!empty($buffer['encrypted'])) {
|
if (strlen($buffer['encrypted'])) {
|
||||||
for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
|
for ($i = 0; $i < strlen($plaintext); $i+=$block_size) {
|
||||||
$block = substr($plaintext, $i, $block_size);
|
$block = substr($plaintext, $i, $block_size);
|
||||||
$buffer['encrypted'].= $this->_encryptBlock($this->_generate_xor($block_size, $xor));
|
$buffer['encrypted'].= $this->_encryptBlock($this->_generate_xor($block_size, $xor));
|
||||||
@ -862,7 +862,7 @@ class Crypt_Rijndael {
|
|||||||
break;
|
break;
|
||||||
case CRYPT_RIJNDAEL_MODE_CTR:
|
case CRYPT_RIJNDAEL_MODE_CTR:
|
||||||
$xor = $this->decryptIV;
|
$xor = $this->decryptIV;
|
||||||
if (!empty($buffer['ciphertext'])) {
|
if (strlen($buffer['ciphertext'])) {
|
||||||
for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
|
for ($i = 0; $i < strlen($ciphertext); $i+=$block_size) {
|
||||||
$block = substr($ciphertext, $i, $block_size);
|
$block = substr($ciphertext, $i, $block_size);
|
||||||
$buffer['ciphertext'].= $this->_encryptBlock($this->_generate_xor($block_size, $xor));
|
$buffer['ciphertext'].= $this->_encryptBlock($this->_generate_xor($block_size, $xor));
|
||||||
@ -884,7 +884,7 @@ class Crypt_Rijndael {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CRYPT_RIJNDAEL_MODE_CFB:
|
case CRYPT_RIJNDAEL_MODE_CFB:
|
||||||
if (!empty($buffer['ciphertext'])) {
|
if (strlen($buffer['ciphertext'])) {
|
||||||
$plaintext = $ciphertext ^ substr($this->decryptIV, strlen($buffer['ciphertext']));
|
$plaintext = $ciphertext ^ substr($this->decryptIV, strlen($buffer['ciphertext']));
|
||||||
$buffer['ciphertext'].= substr($ciphertext, 0, strlen($plaintext));
|
$buffer['ciphertext'].= substr($ciphertext, 0, strlen($plaintext));
|
||||||
if (strlen($buffer['ciphertext']) == $block_size) {
|
if (strlen($buffer['ciphertext']) == $block_size) {
|
||||||
|
@ -822,7 +822,7 @@ class Crypt_TripleDES {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CRYPT_DES_MODE_CFB:
|
case CRYPT_DES_MODE_CFB:
|
||||||
if (!empty($buffer['ciphertext'])) {
|
if (strlen($buffer['ciphertext'])) {
|
||||||
$plaintext = $ciphertext ^ substr($this->decryptIV, strlen($buffer['ciphertext']));
|
$plaintext = $ciphertext ^ substr($this->decryptIV, strlen($buffer['ciphertext']));
|
||||||
$buffer['ciphertext'].= substr($ciphertext, 0, strlen($plaintext));
|
$buffer['ciphertext'].= substr($ciphertext, 0, strlen($plaintext));
|
||||||
if (strlen($buffer['ciphertext']) == 8) {
|
if (strlen($buffer['ciphertext']) == 8) {
|
||||||
|
Loading…
Reference in New Issue
Block a user