|
Posted by Mike Hummel on 04/12/05 23:04
I get the following error when I try your suggestion:
Unknown error type: [8] Undefined variable: iv
Code:
$key = md5($this->_cypherkey);
$key = substr($key, 0, mcrypt_enc_get_key_size($this->td));
$iv_size = mcrypt_enc_get_iv_size($this->td);
#$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$iv = pack("a".$iv_size,$iv);
Tom Rogers wrote:
> Hi,
>
> Saturday, April 9, 2005, 3:35:21 AM, you wrote:
> MH> I have an odd php issue with mcrypt.
> MH> I'm getting a lot of this type of error, but only sometimes:
>
> MH> mcrypt_generic_init(): Iv size incorrect; supplied length: 0, needed: 32
>
> MH> (note, the "supplied length: 0" is not always the same. sometimes it is
> MH> 1, 16, etc).
>
> MH> It doesn't seem to affect the decoding of the file, but it is throwing a
> MH> notice in to my error log. I've tried doing this:
>
> MH> @mcrypt_generic_init($this->td, $key, $iv)
>
> MH> but that doesn't stop it from throwing an error.
>
> MH> The only thing I can think is that I have
> MH> mcrypt_module_close($this->td)
> MH> commented out because my code was dying with it...
>
> MH> System:
> MH> Linux w/ Apache 1.3.31
> MH> PHP Version 4.3.4
> MH> libmcrypt version 2.5.7
>
>
> MH> Suggestions?
>
>
> I do this to set a zero iv
>
> $td = mcrypt_module_open(MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, "");
> $key = substr($secret, 0, mcrypt_enc_get_key_size ($td));
> $iv = pack("a".mcrypt_enc_get_iv_size($td),$iv);
> mcrypt_generic_init ($td, $key, $iv);
>
Navigation:
[Reply to this message]
|