mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-16 18:25:13 +00:00
DES: Fix memory leak in OFB mode
This commit is contained in:
parent
bf3ca6312e
commit
15817a416e
@ -656,8 +656,10 @@ class Crypt_DES {
|
||||
$xor = $this->encryptIV;
|
||||
if (strlen($buffer['xor'])) {
|
||||
for ($i = 0; $i < strlen($plaintext); $i+=8) {
|
||||
$xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
|
||||
$buffer['xor'].= $xor;
|
||||
if (strlen($block) > strlen($buffer['xor'])) {
|
||||
$xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
|
||||
$buffer['xor'].= $xor;
|
||||
}
|
||||
$key = $this->_string_shift($buffer['xor'], 8);
|
||||
$ciphertext.= substr($plaintext, $i, 8) ^ $key;
|
||||
}
|
||||
@ -843,8 +845,10 @@ class Crypt_DES {
|
||||
$xor = $this->decryptIV;
|
||||
if (strlen($buffer['xor'])) {
|
||||
for ($i = 0; $i < strlen($ciphertext); $i+=8) {
|
||||
$xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
|
||||
$buffer['xor'].= $xor;
|
||||
if (strlen($block) > strlen($buffer['xor'])) {
|
||||
$xor = $this->_processBlock($xor, CRYPT_DES_ENCRYPT);
|
||||
$buffer['xor'].= $xor;
|
||||
}
|
||||
$key = $this->_string_shift($buffer['xor'], 8);
|
||||
$plaintext.= substr($ciphertext, $i, 8) ^ $key;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user