mirror of
https://github.com/danog/phpseclib.git
synced 2024-11-27 12:55:58 +01:00
More strlen() / empty() changes
This commit is contained in:
parent
9b4240c104
commit
61ad80fd64
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user