From cea059e9dd9b290952bcd333221d705ae2cebccf Mon Sep 17 00:00:00 2001 From: terrafrost Date: Wed, 20 Jan 2016 10:09:06 -0600 Subject: [PATCH] Crypt/Base: updates to IV handling per Joey3000 --- phpseclib/Crypt/Base.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/phpseclib/Crypt/Base.php b/phpseclib/Crypt/Base.php index 4c708a84..63f2a5e4 100644 --- a/phpseclib/Crypt/Base.php +++ b/phpseclib/Crypt/Base.php @@ -500,10 +500,9 @@ abstract class Base } /** - * Sets the initialization vector. (optional) + * Sets the initialization vector. * - * SetIV is not required when self::MODE_ECB (or ie for AES: \phpseclib\Crypt\AES::MODE_ECB) is being used. If not explicitly set, it'll be assumed - * to be all zero's. + * setIV() is not required when self::MODE_ECB (or ie for AES: \phpseclib\Crypt\AES::MODE_ECB) is being used. * * @access public * @param string $iv @@ -511,8 +510,10 @@ abstract class Base */ function setIV($iv) { - if ($this->mode == self::MODE_ECB) { - return; + switch ($this->mode) { + case self::MODE_ECB: + case self::MODE_STREAM: + return; } $this->iv = $iv;