RC4: keys were never being set in continuous mode

This commit is contained in:
terrafrost 2013-01-26 11:16:42 -06:00
parent e7336e6b54
commit d774476bcf

View File

@ -212,6 +212,8 @@ class Crypt_RC4 {
$this->key = $key; $this->key = $key;
if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) { if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) {
mcrypt_generic_init($this->encryptStream, $this->key, '');
mcrypt_generic_init($this->decryptStream, $this->key, '');
return; return;
} }
@ -352,10 +354,10 @@ class Crypt_RC4 {
if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) { if ( CRYPT_RC4_MODE == CRYPT_RC4_MODE_MCRYPT ) {
$keyStream = $mode == CRYPT_RC4_ENCRYPT ? 'encryptStream' : 'decryptStream'; $keyStream = $mode == CRYPT_RC4_ENCRYPT ? 'encryptStream' : 'decryptStream';
if ($this->continuousBuffer) { if (!$this->continuousBuffer) {
return mcrypt_generic($this->$keyStream, $text); mcrypt_generic_init($this->$keyStream, $this->key, '');
} }
mcrypt_generic_init($this->$keyStream, $this->key, '');
return mcrypt_generic($this->$keyStream, $text); return mcrypt_generic($this->$keyStream, $text);
} }
@ -515,4 +517,4 @@ class Crypt_RC4 {
} }
// vim: ts=4:sw=4:et: // vim: ts=4:sw=4:et:
// vim6: fdl=1: // vim6: fdl=1: